Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Can't PL/SQL do the simple stuff that Transact-SQL can?
Actually, a simpler solution is just to do the select as in your
original example, then inspect the pseudo column that is returned with
the rowcount. From memory it would look like:
declare
dummy number;
begin
select count(*) into dummy from table;
if sql%rowcount >0 then...
stuff...
endif;
No messing around with cursors. BTW, cursors are used for every statement. It's just ones like the above use implicit cursors, rather than explicit.
Hope it helps,
Andrew.
Jonathan Tew wrote:
>
> Wow, thanks for posting a solution to the problem. That strikes we as
> really complex code though. I've been told that cursors are very
> inefficent things and should be used as little as possible. Under MS
> SQL Server often a cursor will blow up in a stored proc causing
> problems. Does Oracle have such problems with cursors and would this be
> a bad thing performance wise? I'm under the impression that the kinds
> of things that I'm trying to do are simple and common... why hasn't
> Oracle taken care of this problem with an exists() construct?
>
> Thanks,
> Jonathan Tew
Received on Wed Feb 17 1999 - 23:31:08 CST