Re: Testing NotFound in SPL !%#$!!!!
Posted in 1995
In 5.0 of the engines you could select rowid as part of your query. Regards, Bob Colombo Joe For (joefor@antenore.iperv.it) wrote: : Hi ALL! : I'm working with SPL from few months and all goes fine (<g>), but I still : have a little doubtful point. The question is: what is the correct way : to test if a select returns no rows? In 4GL, I can test the Status variable : for NotFound value (or test Sqlca.Sqlcode), but these variables don't : exist in SPL (I believe!). I'm workarounding the problem by selecting : a NOT NULL column and testing if the returned value is null, for example: : SELECT col1 {not null column, usually the key}, col2, ... INTO c1, c2 ... : IF c1 IS NULL THEN { means no rows found } .... : Naturally, if I unfortunately have no NOT NULL columns, this method goes out. : So, I'm thinking that the method is probably uncorrect..... :-| : I have also tried with ON EXCEPTION IN (100), but on exception seems to work : only on negative errors.... :-((( : Another similar (and related) problem is: : In 4GL: UPDATE foo SET.... : IF SqlCa.SqlErrd[3] = 0 THEN INSERT INTO foo ... : : In SPL????? I actually do a select, test if row is found by the debatable : method above (!!!!) and then I issue the insert (if not found) or update. : Too much stress.... : Help! : ___*____ : Ciao! | |_ e-mail : (_|oe |or <joefor@iperv.it> : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~