RE: SQL Exists query in SPL If (Can Be Done)
Posted in 1996
All,
Thanks for your input. It CAN be done, thanks to Mark D. Stock. The
layout is:
If [not] exists (select * from ... where ...) then
(do whatever) ;
[else ]
[ (do whatever else) ; ]
end if ;
where the [] represent optional code. It seems the important things are
the placement of the semi-colons (;), the absence of the into ... clause
in the sql statement and the absence of a terminating semi-colon for the
sql statement.
Thanks again to Mark D. Stock
Regards,
Dave
On 29 July 1996, Dave Harding wrote...
> All Gurus,
> In SPL, if I want to test the existance of a particular record, I
either
> select count(*) into x_count ... or> select 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
>
>