Re: Some questions on SPL, need your help!
Posted in 1997
Xu Wenwei wrote:
>
> Anyone who can answer my questions on SPL? Thanks in advance.
>
> 1. In SPL , after an insert statement , how can I read Rowid and System Serial of
> this record
As you mention that you are using Online V5 you can use the following
code to obtain the serial of the record inserted:
create trigger i_case
insert on tab_name
referencing new as new
for each row (execute procedure get_serial (new.serial_col_name))
create procedure get_serial (p_serial integer)
define global pg_serial integer default 0;
let pg_serial = p_serial;
--The serial id can now be used by other procedures called from the
--same application, since it is stored in a global variable.
end procedure;
> 2. Can sqlca.sqlerrd[] be used in SPL (just as used in 4GL)?
Not in Version 5 Engines.You can use dbinfo to obtain the contents of
sqlca in
Version 6.xx, 7.xx Engines
> 3. In SPL, how to judge the correctness after the operation of database,
> I found * if (SQLCODE = 0) ... * did not work.
>
You must trap the errors with the on exception statement.Read the
"Guide to SQL:Reference" (P 8-29) about details.
> Note, our database engine is Online 5.0
>
> Any of your suggestions will highly appreciated.
>
> Sincerely,
> Wenwei Xu
HTH
Tolis
+---------------------------------------------------------------------+
| V+K Relational Solutions email: tvarnas@compulink.gr |
| Deligiorgi 26 tvarnas@orbit.de |
| 546 42 Thessaloniki Voice: (30) 31 820270 |
| Greece Fax: (30) 31 865463 |
+---------------------------------------------------------------------+