Skip to Main Content
  • Questions
  • Executed PL/SQL kept in Stored procedure but while compile Compilation error is coming.

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Keshab.

Asked: September 22, 2016 - 12:11 pm UTC

Last updated: September 23, 2016 - 5:07 am UTC

Version: 12.0.1.1

Viewed 1000+ times

You Asked

Hi Tom,

Below PL/SQL is working fine. while same code of PL/SQL as below is used in Stored procedure compilation error is coming while compiling stored procedure. Could you please make a suggestion to keep below PL/SQL in below Stored Procedure so that Stored procedure compiles successfully.


Script of PL/SQL executes Successfully:
Declare
CURSOR c1 IS SELECT FILENAME FROM table(RDSADMIN.RDS_FILE_UTIL.LISTDIR('DATA_PUMP_DIR')) WHERE MTIME < (sysdate-150) ;
BEGIN
FOR c IN c1 Loop
sys.utl_file.fremove('DATA_PUMP_DIR',c.FILENAME);
END LOOP;
END;
/


Stored Procedure Containing same PL/SQL block as above but getting compilation error while compiling SP:
CREATE OR REPLACE PROCEDURE OldDumpLogClear
AS
Declare
CURSOR c1 IS SELECT FILENAME FROM table(RDSADMIN.RDS_FILE_UTIL.LISTDIR('DATA_PUMP_DIR')) WHERE MTIME < (sysdate-150);
BEGIN
FOR c IN c1
Loop
sys.utl_file.fremove('DATA_PUMP_DIR',c.FILENAME);
END LOOP;
END OldDumpLogClear;
/


Regards,
Keshab Raj Basnet

and Connor said...

Unless you're planning on *telling* us what the compilation errors are....then I dont really see how we're going to help you

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Error in compilation

Milind, September 26, 2016 - 3:24 am UTC

The error must be due to DECALRE keyword in procedure. declarative section of procedure do not have DECLARE keyword. Just remove it and try to compile it.

More to Explore

Data Pump

All of the database utilities including Data Pump are explained in the Utilities guide.