PL/SQL (MOSC)

MOSC Banner

SQLERRM not returning details of full stack after upgrade from 11g to 12c

edited Jul 17, 2018 5:18AM in PL/SQL (MOSC) 6 commentsAnswered

Hi,

I have hit upon a problem where after upgrading to 12c,  SQLEERM is not returning as expected from the error stack, loosing details from the initiating error when raised from a sub-block.

Please see example:

set serveroutput on

declare
  build_failed EXCEPTION;
    PRAGMA EXCEPTION_INIT(build_failed,-20514);
begin --parent block
 
    begin --sub block
     
      raise no_data_found; --exception is triggered here
     
      exception when no_data_found then
        raise build_failed; --propogte error to parent
    end; --sub block

exception WHEN OTHERS THEN
    dbms_output.put_line('sqlerrm is:');
    dbms_output.put_line(SQLERRM);   
    RAISE;

end; --parent block

/

In 11g the output will be:

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center