Re: PL/SQL bug?

From: Loyal Barber <lbarber_at_ix.netcom.com>
Date: 1996/10/21
Message-ID: <326B8136.6E27_at_ix.netcom.com>#1/1


Alex Ma wrote:
>
> The following sample procedure takes in an input parameter P_NAME
> and inside the procedure I use the P_NAME in the SELECT statement:
>
> procedure XXX(P_NAME in varchar2) is
> l_field number(10);
> begin
> SELECT field
> INTO l_field
> FROM table
> WHERE table.NAME = P_NAME
> end;
>
> The above code would compile but returns wrong result. In fact it will
> raise an exception of no_data_found.
>
> However, if I use a local varible for P_NAME and use it in the query,
> everything will work fine.
> i.e.
> l_name := P_NAME
> SELECT ... INTO ... FROM ... WHERE table.NAME = l_name;
>
> This implies that an input parameter is not being used the same way as
> a local variable. I am quite confused with this and hope somebody might
> have an answer.
>
> Alex Ma
> ama_at_mda.ca
My suggestion would be to check and make sure you are really doing things the same way in both cases. I use the parameter style construction all of he time with no problems.

Loyal Received on Mon Oct 21 1996 - 00:00:00 CEST

Original text of this message