prashant1988
prashant1988

Reputation: 282

Exact error line number in EXECUTE IMMEDIATE

Below is the procedure in my code:

PROCEDURE OutputShipTo (MonRec IN OUT meta_imi_monitor%ROWTYPE, 
                        CustomerChangesRec IN CustomerChanges%ROWTYPE, 
                        InType In CHAR) 
IS
BEGIN
  EXECUTE IMMEDIATE sql_stmt_loc_insert USING 'ZMSH', 'ZMSH',
      CustomerChangesRec.cab_id,CustomerChangesRec.tab_id,'ZMSH';
END;

When this procedure is getting executed, I'm getting the below error:

ERROR at line 1:
ORA-00904: invalid column name
ORA-06512: at line 601
ORA-06512: at line 1114

It is just giving me the error line number of location of procedure and where it is called. Probably, there is an invalid column in the DML 'sql_stmt_loc_insert', but i'm unable to figure out where it is. Is there any way, I can find out the exact error line number from the DML stmt 'sql_stmt_loc_insert' so that I can see the invalid column and correct it.

I can't give the code of 'sql_stmt_loc_insert' due to very large number of lines.

Thanks!

Upvotes: 1

Views: 686

Answers (1)

Justin Cave
Justin Cave

Reputation: 231851

With the EXECUTE IMMEDIATE interface, there is no way to get more specifics about the error.

Generally, the way people debug code that generates dynamic SQL is to print out (either to the console or to a log table) the SQL statement and the bind variables prior to calling EXECUTE IMMEDIATE. Then you can run the code interactively to get more specifics about the error.

Upvotes: 3

Related Questions