Ok, so I'm a complete newb with oracle. Now that itβs not,
I think you can understand what I'm trying to do below. For each stored procedure found, output the DDL in the name of the file with its name.
The problem is that I cannot figure out how to get the spool target to get the FileName value set by the cursor.
DECLARE objName varchar2(50); FileName varchar2(50); cursor curProcs is select OBJECT_NAME into objName FROM ALL_PROCEDURES WHERE OWNER = 'AMS' ORDER BY OBJECT_NAME; -- get all procs in db BEGIN open curProcs; if curProcs%ISOPEN THEN LOOP FETCH curProcs into objName; EXIT WHEN curProcs%NOTFOUND; FileName := 'C:\ ' || objName || '.PRC.SQL'; spool FileName; --BREAKS DBMS_METADATA.GET_DDL('PROCEDURE',objName); spool off; END LOOP; END IF; END;
Any ideas on where I am going wrong? and if anyone has an example of this, I would really appreciate it.
I feel like I have to dance around, because if I create the column initially then
spool &ColName
I get the result, I just canβt change the dynamic change of this & colname
Thank you for your help.
source share