Re: pl/sql question

Re: pl/sql question

 

  

Another solution:

select count(*) into count_var from table a where ...
if(count_var > 0 ) then
update ...
else
insert ...
end if;
----- Original Message -----
From: "Surinder Kaur "
<oracledba-ezmlmshield-x81339384.[Email address protected]
To: "LazyDBA Discussion" <[Email address protected]
Sent: Wednesday, April 06, 2005 7:02 PM
Subject: Re: pl/sql question


> Update statement never throw no_data_found exception
> you have to use SQL%Rowcount to find out how many records has been updated
>
> Update ...
> If SQL%rowcount = 0
> then
> insert statement
> end if;
>
> ----- Original Message -----
> From: "Carlos Barrera "
> <oracledba-ezmlmshield-x40769484.[Email address protected]
> To: "LazyDBA Discussion" <[Email address protected]
> Sent: Wednesday, April 06, 2005 10:23 AM
> Subject: pl/sql question
>
>
> >
> > the following code is not working properly. when the record doesn't
> > exist,
> > it's not inserting it. do i have to use another exception instead of
> > no_data_found?
> >
> > regards.
> >
> > begin
> > update table a
> > set ...
> > where...
> > exception when no_data_found then
> > insert into table a ...
> > end;
> > commit;
> >
> >
> >
> >
> >
> > --------
> > website: http://www.LazyDBA.com
> > Please don't reply to RTFM questions
> > Oracle documentation is here: http://tahiti.oracle.com
> > To unsubscribe: see http://www.lazydba.com/unsubscribe.html
> > To subscribe: see http://www.lazydba.com
> > By using this list you agree to these
> > terms:http://www.lazydba.com/legal.html
> >
> >
>
>
>
> --------
> website: http://www.LazyDBA.com
> Please don't reply to RTFM questions
> Oracle documentation is here: http://tahiti.oracle.com
> To unsubscribe: see http://www.lazydba.com/unsubscribe.html
> To subscribe: see http://www.lazydba.com
> By using this list you agree to these
terms:http://www.lazydba.com/legal.html
>
>
>



Oracle LazyDBA home page