Re: SQL select into
Date: Wed, 27 Sep 2000 09:38:53 +0100
Message-ID: <cmiA5.3830$Bw1.2110_at_news.indigo.ie>
Hi Greg,
normally the best when of handling the error is within an embedded anonymous block as follows
declare
var1 as varchar2;
....
....
begin
........
........
begin
select .... into var1 from .....;
exception
when no_data_found then
var1=defaultvalue;
when too_many_rows then
.........
end;
other statements
.....
....
end;
by doing it this way you can handle the error without affecting the rest of the procedure etc, using select count(*) works but it adds unnesscessary overhead onto the database
HTH Conan
Greg wrote in message <39D1AC38.AD5552A0_at_loxinfo.co.th>...
>I have a lot of select into
>query's
>
>If U make a select into and there are no records
>
>U got the error ORA-01403: no data found
>
>so I do first a
>
>select count (....)
>into counter
>...
>
>if counter = 1 then
> select .....
> into
> .....
>end if;
>
>Now im wondering if there is a better solution then
>the way I do it......sure is.....
>
>like do it all in one step
>
>Thanks Greg
>
Received on Wed Sep 27 2000 - 10:38:53 CEST