Re: SQL Exists query in SPL If
Posted in 1996
Topics: Stored Procedures & SPL, Server Administration
Item Subject: SQL Exists query in SPL If
Hi Dave,
This is what I've done to get around the same problem:
select rowid
into x_exists
from...
where....
If x_exists is NOT Null then
Do Something {*row found*}
Else
Do Something else {*row not found*}
End if;
I found that if you select into a variable and that row is not found,
then that variable gets set to Null.
Of course, standard disclaimers apply since I've not tested it
exhaustively but it works for me.
Hope it helps!
Anisha
anisha_vaswani@hp.com
______________________________ Reply Separator _________________________________
Subject: SQL Exists query in SPL If
Author: Non-HP-informix-list-owner (informix-list-owner@rmy.emory.edu) at
HP-Boise,shargw4
Date: 7/29/96 8:28 AM
All Gurus,
In SPL, if I want to test the existance of a particular record, I either
select count(*) into x_count ... orselect rowid into x_exists ..... and then test the value of either x_count
or x_exists. It seems to me that you should be able to say something like
"if [not] exists select ...then ...etc etc. I have had a bit of a fiddle
but nothing is ever easy is it?
Has anyone nutted this one out already or discovered that it can't be
done, I'd appreciate some feedback.
Thanks
Dave Harding
System Admin/DBA
Trivium Project,
BBC Radio.
email: hardid02@bh.bbc.co.uk
--
Dave Harding
__________________________
TRIVIUM Project
BBC Network Radio
__________________________
HARDID02@bh.bbc.co.uk