Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Does PL/SQL has a THIS for procedures?

Does PL/SQL has a THIS for procedures?

From: Jeffrey Mark Braun <jeffb_at_halcyon.com>
Date: 12 Jan 2000 14:17:50 -0800
Message-ID: <85iuie$sa5$1@halcyon.com>


Is there a concept such as THIS in PL/SQL stored procedures or functions?

If I have a parameter to a procedure which is named the same as a column name in a table, is there a way explicitly refer to the parameter and not the column?

Here's an example which might make it more clear what I'm asking.

Let's say I have a table of the following definition:

CREATE TABLE t (

   a       VARCHAR2(20),
   ina     VARCHAR2(20)

);

Next let's say we have a naming convention in which parameter names must start with the mode type of the parameter (in, out, inout).

Thus the following procedure has a problem:

CREATE OR REPLACE PROCEDURE x (

   ina IN VARCHAR2
   inina IN VARCHAR2
)

AS
BEGIN   UPDATE
     t
  SET

     t.a = ina,     -- <-- this is a the problem
     t.ina = inina;

END x;

As you can see we now have a situation in which unintentionally one of the procedures parameters is named exactly the same as a column in the table. Oracle at this point thinks it should update the column T.A to the value of T.INA not the value of the procedure parameter INA. If this were C++ or Java I could use THIS to refer to the procedure itself.

In other words, I would like to be able to do something like this:

  UPDATE
     t
  SET

     t.a = THIS.ina,
     t.ina = inina;

Is there a similar concept in PL/SQL?

Thanks.

Jeff BraunA Received on Wed Jan 12 2000 - 16:17:50 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US