Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: help with select into
Nest the select in begin-exception-end block.
for eg :
Begin
Begin
select into stmt success continue Exception no_data_found populate with new value an then continueEnd
Exception
End
Tarun Agarwal
aptconsulting_at_hotmail.com
> Laura Bellini wrote:
> > Hi.
> > I'm trying to do a fairly simple select into within a stored procedure, but
> > I'm having difficulty getting the statement or statement thereafter to
> > handle the situation when no data is returned.
> >
> > Select match_prod_id
> > into new_prod_id_out
> > from product_up_cross_sell
> > where product_up-cross_sell.base_prod_id = prod_id_in
> > and product_up_cross_sell.match_type = 'U'
> >
> > Prod_id_in is an incoming parameter.
> > If there is no row returned, this is fine - new_prod_id_out will be
> > 'empty'.
> > What I want, however, is to populate new_prod_id_out with another
> > variable's value if this select statement returns no rows.
> >
> > I DO NOT want the procedure to hit an exception and end. All I want to do
> > is fill in this variable with a value, and continue.
> >
> > Does anyone know how to do this?
> >
> > thanks.
> > Laura Bellini
> > laura_bellini_at_compaq.com
Received on Mon Jan 19 1998 - 00:00:00 CST