| error in creating DBMS_SCHEDULER job [message #578173] |
Mon, 25 February 2013 04:26  |
ajaykumarkona
Messages: 264 Registered: August 2010
|
Senior Member |
|
|
I have create the following procedure to create individual jobs dynamically on each schema.
CREATE OR REPLACE PROCEDURE APSP.JOB_TEST_RAM
AS
V_SQL VARCHAR2 (1000);
BEGIN
FOR i
IN (SELECT gbm.OWNER_NAME owner_name,
vdb.NAME || '_BU_' || gbm.BU_CODE,
gbm.bu_id bu_id
FROM apps_global.GLOBAL_BU_MAPPING gbm, v$database vdb
WHERE OWNER_NAME NOT IN ('APPS_GLOBAL'))
LOOP
V_SQL :=
'BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => '''
|| i.owner_name
|| '_archive_job'',
job_class => '''
|| i.owner_name
|| '_job_class'',
job_type => ''PLSQL_BLOCK'',
job_action => ''begin APSP.POP_TARGET(''APPS_XX'',i.owner,i.buid); end;'',
auto_drop => TRUE,
comments => '''|| i.owner_name||''',
enabled => TRUE);
END;';
EXECUTE IMMEDIATE V_SQL;
END LOOP;
END;
/
The procedure is having following arguments.
CREATE OR REPLACE PROCEDURE APSP.POP_TARGET (
p_schema_name VARCHAR2,
p_actual_schema_name VARCHAR2,
p_buid NUMBER
)
While executing this procedure I am getting the below error.
PLS-00103: Encountered the symbol "APPS_XX" when expecting one of the following:
Please help me.
Thanks in advance .
|
|
|
|
|
|
| Re: error in creating DBMS_SCHEDULER job [message #578175 is a reply to message #578174] |
Mon, 25 February 2013 04:55   |
ajaykumarkona
Messages: 264 Registered: August 2010
|
Senior Member |
|
|
Thanks for your reply.
That's working fine.
What about the variables i.owner,i.buid these variables should be passed dynamically.
Please help me.
If I pass as i.owner,i.buid procedure is taking as it is instead of values for these
variables.
Please help me.
Thanks.
|
|
|
|
| Re: error in creating DBMS_SCHEDULER job [message #578180 is a reply to message #578175] |
Mon, 25 February 2013 05:43   |
cookiemonster
Messages: 9169 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Same way you set i.owner_name.
1st rule of debugging dynamic sql - assign the dynamic string to a variable, display the variable using dbms_output or similar. Check you can run the output string in sqlplus.
|
|
|
|
|
|
|
|