| Title: | SQL notes |
| Moderator: | NOVA::SMITHI |
| Created: | Wed Aug 27 1986 |
| Last Modified: | Thu Jun 05 1997 |
| Last Successful Update: | Fri Jun 06 1997 |
| Number of topics: | 3895 |
| Total number of notes: | 17726 |
Hi,
I have a (dumb) "philosphical" question about GET DIAGNOSTICS and
returned_sqlcode and its behavior in compound statements.
Ok, when an exception is generated (NO_DUP error ect.) in a compound
statment in a module , it terminates and the only way you can trap the
error from a calling routine is the error status the module itself
returns. Thats fine, but why have the GET DIAGNOSTIC 1 :x =
returned_sqlcode if the procedure will just abort on an exception? what
if you want to do if/then's in the module/procedure and rollback or commit,
you can't do it within the procedure, you have to do the sqlcode check
after the CALL statement.
thank you.
jk
| T.R | Title | User | Personal Name | Date | Lines |
|---|---|---|---|---|---|
| 3859.1 | NOVA::SMITHI | Don't understate or underestimate Rdb! | Thu Jan 30 1997 21:40 | 30 | |
The MSP language is based closely on the SQL92 PSM (Persistent Stored Modules) standard. The language exists to trap and process exceptions. It is just that Rdb has not implemented the exception handler. This is currently an architectural restriction which we plan to address eventually. Currently, GET DIAGNOSTICS can be used to test for success, and various warnings such as string-truncation, end-of-stream, and null-elimination. In addition the syntax: get diagnostics exception n = returned_sqlcode allows you get various levels of exception. We currently only support 1. i.e. get diagnostics exception 2 = returned_sqlcode is legal according to ANSI and ISO SQL. ~when an exception is generated (NO_DUP error ect.) in a compound statment in ~a module A better method is to avoid the exception: if exists (select * from T where a = :val) then signal 'xxxxx' else insert into T (...) values (..., :val, ...); end if; cheers, Ian | |||||
| 3859.2 | THANKS | M5::JAKUHN | RDB: 34% better than real life | Sun Feb 02 1997 13:11 | 11 |
Thanks very much for your explanation.
jay
+------------------------------------------------------------------------+
| "Yes, I think it can be most easily done, out on Rdb 6.1"
|
| -- Bob Dylan
| Rdb 6.1 Revisited
+------------------------------------------------------------------------+
| |||||