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 -> Re: Does PL/SQL has a THIS for procedures?

Re: Does PL/SQL has a THIS for procedures?

From: Ricardo Melo <ricardo_melo_at_yahoo.com>
Date: Thu, 13 Jan 2000 00:33:37 GMT
Message-ID: <B39f4.51686$7S.101623@news20.bellglobal.com>


Have you tried x.ina ?

Jeffrey Mark Braun <jeffb_at_halcyon.com> a écrit dans le message : 85iuie$sa5$1_at_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 - 18:33:37 CST

Original text of this message

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