PL/SQL bug?

From: Alex Ma <ama_at_mda.ca>
Date: 1996/10/17
Message-ID: <545vdm$cam_at_mailer.mda.ca>#1/1


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 Received on Thu Oct 17 1996 - 00:00:00 CEST

Original text of this message