Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the text associated with a Firebird SQL exception in a "when any" block? [duplicate]

Tags:

sql

firebird

I have the following in a Firebird (version 2.1) stored procedure. When an exception occurs I get the GDSCODE and the SQLCODE but I can't figure how to get the descriptive error message text that goes with the error. Is it possible to do so? Is there a variable like SQLERRORTEXT or some such? My search of Google has not turned up any.

  begin
    insert into BOOKING_STATUS (status_id, description) values ("test1", "test1");      
    when any do begin
      error_code = 1;
      error_message = "Error inserting booking_status. Error: " || GDSCODE || " " || SQLCODE;
      suspend;
      exit; 
    end
  end
like image 864
Jonathan Elkins Avatar asked Nov 15 '25 13:11

Jonathan Elkins


1 Answers

Unfortunately, this is not possible in your version of firebird. Take a look at this request.

It turns out that this facility is present in Firebird 4.0+.


Similar questions:

In FirebirdSql, how to return exception message from procedure

Firebird - handling exception's custom-message

like image 196
Gurwinder Singh Avatar answered Nov 17 '25 10:11

Gurwinder Singh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!