Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: procedure error
Memphis rs wrote:
>
> Does anyone know why I am getting a error when executing the following:
You are confusing two different constructions.
In the first, you declare a cursor in the DECLARE section, then open it, fetch from it (probably in a loop) and close it in the body of the procedure (i.e. after the BEGIN).
In the other, you execute a "select ... INTO .." statement in the procedure body. This will only return one row and will give an error if more than one row qualifies according to your WHERE clause.
Personally, I *always* use the first form, even if I am only retrieving
a single row, because:
a) All my SQL statements are in a single group in the DECLARE section,
which makes debugging easier.
b) It's more efficient, since PL/SQL *always* attempts to retrieve
another row with the second version (to see if there is an error) and
this operation costs.
Hope ths helps.
Chrysalis. Received on Tue Feb 25 1997 - 00:00:00 CST