Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Simple SQL request
Mark C. Stock wrote:
> "Bavoux Jean-Baptiste" <jbb1_at_laposte.net> wrote in message > news:41e7ac4a$0$10272$626a14ce_at_news.free.fr... >
> > > look into cursor for loops or 'where exists' sub-queries > > ++ mcs > >
temp PLS_INTEGER;
BEGIN
SELECT 1 INTO temp FROM DUAL WHERE EXISTS ( SELECT * FROM my_table WHERE (my_filters...);) IF (temp IS NULL) THEN ... ELSE ...
This solution seems as fast as the CURSOR method.
The syntax is simplier than CURSOR method,
(not obliged to declare a cursor)
but still complicated... (may be it can be simplified)
I would have prefer
IF EXISTS ( SELECT * FROM my_table ..;) but this doesn't work.
The method with ROWNUM doesn't work because ROWNUM is the row number
from the table and not from the result.
There is a similar methode which works with mySQL with the LIMIT key
word but not in oracle.
Thanks. Received on Fri Jan 14 2005 - 07:39:37 CST