Question on EXEC procedures stored in variables [message #357643] |
Thu, 06 November 2008 02:21 |
wmgonzalbo
Messages: 98 Registered: November 2008
|
Member |
|
|
* If my table TABLE1 has a field named PROC_NAME which stores a name (VARCHAR2) of a working stored procedure..
Table: TABLE1
Field: PROC_NAME -- VARCHAR2 (30 BYTE)
Data: PROC_1 --> name of a working procedure
* I need to run the procedures named in PROC_NAME in TABLE1.
* In an another procedure named MAIN_PROC i have this code..
CREATE OR REPLACE PROCEDURE MAIN_PROC IS
TYPE cv_rconfig IS REF CURSOR;
cv_prconfig cv_rconfig;
v_row REPORT_CONFIG%ROWTYPE;
BEGIN
OPEN cv_prconfig FOR 'SELECT process_order, proc_name from TABLE1 order by process_order';
loop
fetch cv_prconfig into v_row.process_order, v_row.proc_name;
exit when cv_prconfig%NOTFOUND;
IF <some condition> then
-- if conditions are met, run PROC1
PROC1;
ELSIF ....
-- cant i change this to 'EXEC v_row.proc_name;' (which raises errors) or some other way so that i can execute procedures 'dynamically'?
-- to make it more clear, what im trying to do is IF <some condition> THEN run the name of the procedure stored in the variable v_row.procname.
-- Using a JOB is not an requirement/objective...
-- Any Suggestions or Comments will do..
Thanks,
Wilbert
|
|
|
|
|
Re: Question on EXEC procedures stored in variables [message #357651 is a reply to message #357648] |
Thu, 06 November 2008 02:54 |
wmgonzalbo
Messages: 98 Registered: November 2008
|
Member |
|
|
* flyboy, rajavu1 thanks a million! you guys Rock!
-- Hope this mistake will help other newbies like me...
* Did that a while ago but kept receiving errors..
ORA-06550: line 1, column 17:
PLS-00103: Encountered the symbol "END" when expecting one of the following:
:= . ( @ % ;
ORA-06512: at "ARGON_RS.PROC_REPORT_CONFIG", line 20
ORA-06512: at line 2
* Its the semi-colon (;)!!!
IF <condition> THEN
EXECUTE IMMEDIATE 'BEGIN '||v_row.proc_name||'; END;';
PL/SQL procedure successfully completed.
Again, thanks a million!
[Updated on: Thu, 06 November 2008 02:54] Report message to a moderator
|
|
|
|