Thanks for the question, Huy Toan.
Asked: August 18, 2016 - 3:56 am UTC
Last updated: August 19, 2016 - 4:29 am UTC
Version: 4.0
Viewed 10K+ times! This question is
You Asked
Hi thatjeffsmith,
I'm from Vietnam. I have a trouble need your help
I want to run this queries in SQL developer automatically, frequency will be daily:
spool D:\test.csv
select /*csv*/ * from dwh.DEPARTMENT_TCB where rownum <= 10
/
spool off
/
I tried to create a job but it did not work. This is my code to create my job:
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => '"DUONGCT"."toan2"',
job_type => 'PLSQL_BLOCK',
job_action => 'spool D:\test.csv
select /*csv*/ * from dwh.DEPARTMENT_TCB where rownum <= 10
/
spool off
/',
number_of_arguments => 0,
start_date => NULL,
repeat_interval => NULL,
end_date => NULL,
enabled => FALSE,
auto_drop => FALSE,
comments => '');
DBMS_SCHEDULER.SET_ATTRIBUTE(
name => '"DUONGCT"."toan2"',
attribute => 'logging_level', value => DBMS_SCHEDULER.LOGGING_OFF);
DBMS_SCHEDULER.enable(
name => '"DUONGCT"."toan2"');
END;
But the "Output Script" tab in SQL Developer prints: Anonymous block. I also tried to enable DBMS_OUTPUT but it failed. I think the reason why I can not create a job is that I don't have permission to do this (my bank' information security).
You can give me another method to automatically execute queries above or create a job?
Thank you in advance.
I'm looking forward to hearing from you soon!
and Connor said...
Is this answer out of date? If it is, please let us know via a Comment