Exception.GetCode

Top  Previous  Next

 

Syntax

function Exception.GetCode(): integer

 

Description

Returns the native error code for the current exception. Can be used in exception handling blocks only.

 

See Also

Exception Handling
Exception.GetSQLCode

 

Example

execute udsblock()

returns(textout varchar(200), codeout bigint, nativecodeout bigint)

as

begin

  delete from EX_HANDLING;

  

  insert into ex_handling (pk)

  values (1);

  begin      

    insert into ex_handling (pk)

    values (2);

    insert into ex_handling (pk)

    values (3);

    insert into ex_handling (pk)

    values (1); /* this will raise an error */

    insert into ex_handling (pk)

    values (4); /* this will not be executed */

    when sqlcode -803, exception eat_exception

    do begin   

         textout = Exception.GetMessage();

         codeout = Exception.GetSQLCode();

         nativecodeout = Exception.GetCode();

       end

  end

end