I have the same situation as described in this post: Porting Oracle procedure to PostgreSQL (exception codes from orafce for utl_file module)
I'm migrating from oracle to postgres with ora2pg and I`m trying to correct the syntax of the exception handling that I have for 'utl_file'. Someone commented a solution in the other post but I didn't understand how to properly apply it.
I have the next code :
V_Step := 1;
FOR Rec_Report IN C_Report LOOP
V_Counter := V_Counter + 1;
-- Header
IF V_Counter = 1 THEN
-- Open File
V_File_Type := UTL_FILE.FOPEN(V_Dir_Name, V_File_Name,'w');
V_Step := 2;
bl_create_flat_file_pg.open_html(V_File_Type);
.......
.......
.......
V_Step :=10
EXCEPTION
when UTL_FILE.INVALID_PATH then
PERFORM control_reports_pg.send_error_mail('invalid_path
V_Step'||V_Step,C_Function_Name);
PERFORM UTL_FILE.FCLOSE(V_File_Type);
when UTL_FILE.INVALID_MODE then
PERFORM control_reports_pg.send_error_mail('INVALID_MODE
V_Step'||V_Step,C_Function_Name);
PERFORM UTL_FILE.FCLOSE(V_File_Type);
Therefore for every step I have a piece of code like this that handles the exception. I get a syntax error : ERROR: syntax error at or near "UTL_FILE".
Please help...