Subject Re: [firebird-support] Firebird 4 and RDB$ERROR
Author Helen Borrie
Steve Bailey wrote:

> I am using Firebird 4.0 Beta 1.

So - off-topic in Firebird Support. But, anyway...

> The release notes describe a new system function RDB$ERROR:

> "The function RDB$ERROR() takes a PSQL error context as input and
> returns the specific context of the active
> exception. Its scope is confined to the context of the
> exception-handling block in PSQL. Outside the exception
> handling block, RDB$ERROR always returns NULL"

> To test this in iSQL I have tried: select rdb$error(gdscode) from rdb$database

> This results in:
> Statement failed, SQLSTATE = 42000
> Dynamic SQL Error
> -SQL error code = -104
> -Token unknown

> I was expecting NULL to be returned. Have I misunderstood?
Yes. You read that text in the chapter entitled 'PSQL'. That's
procedural SQL, the language for writing stored procedures, triggers
and executable blocks. And it's about the exception-handling block in
PSQL - meaning you will get null if you try to access it from a part
of your PSQL code that is not an exception handling block. Logically,
that's because the current exception is visible only within the EH
block and, of course, only if an exception actually occurred that
threw execution into the EH block.

Nowhere does it suggest that you could expect anything by trying to
use the function in DSQL.


This email has been checked for viruses by AVG.