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: <jeffb_at_halcyon.com>
Date: Fri, 14 Jan 2000 01:28:11 GMT
Message-ID: <85lu2s$u2f$1@nnrp1.deja.com>


Okay, I'm a dope. When I tried this in the past, I thought it didn't work, but now I've tried it with my very own example and it works just fine.

Thanks for making me see the obvious.

In article <B39f4.51686$7S.101623_at_news20.bellglobal.com>,   "Ricardo Melo" <ricardo_melo_at_yahoo.com> wrote:
> 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
>
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Thu Jan 13 2000 - 19:28:11 CST

Original text of this message

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