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

Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL problem

Re: PL/SQL problem

From: Paul Brewer <paul_at_paul.brewers.org.uk>
Date: Fri, 7 Feb 2003 21:43:54 -0000
Message-ID: <3e44292c_2@mk-nntp-1.news.uk.worldonline.com>


"Rene Nyffenegger" <rene.nyffenegger_at_gmx.ch> wrote in message news:b2119l$16dlom$1_at_ID-82536.news.dfncis.de...
>
>
> Paul,
>
> I have already answered this in another branch of this thread which
> you obviously chose to ignore. That's fine with me, but then don't call
> this issue 'semantic definition' and 'crap like that'. In fact, it boils
> down to the very fact that it is a semantic definition.
>
> BTW, The error "PLS-00204: function or pseudo-column 'DECODE'
> may be used inside a SQL statement only" supports Billy.
>
>
> Rene
>
>
>
> > Paul Brewer wrote:
> >
> >> Billy,
> >>
> >> It can be used in SQL statements contained in PL/SQL blocks, but not I
> >> think within PL/SQL code.
> >
> > Paul, I prefer no to "think", but to actually try it and Oracle and see
what
> > Oracle "think" about it.
> >
> > Oracle 8.1.7 on HP-UX.
> >
> > SQL> create or replace function YNtoTF( yesno char ) return varchar as
> > 2 truefalse varchar2(5);
> > 3 begin
> > 4 select
> > 5 decode( upper(yesno), 'Y', 'TRUE', 'FALSE' )
> > 6 into truefalse from dual;
> > 7 return( truefalse );
> > 8 end;
> > SQL> /
> >
> > Function created.
> >
> > SQL> select
> > 2 YNtoTF( 'Y' )
> > 3 from dual;
> >
> > YNTOTF('Y')
>
> --------------------------------------------------------------------------
-
> > TRUE
> >
> > SQL> select
> > 2 YNtoTF('crap')
> > 3 from dual;
> >
> > YNTOTF('CRAP')
>
> --------------------------------------------------------------------------

--

> > FALSE
> >
> > SQL>
> >
> >
> > Is the above not PL/SQL code using a DECODE function?
> >
> > Or are we're going to get into semantic definitions of what is PL/SQL
code,
> > SQL code, what is not, and crap like that?
> >
> > The fact is that DECODE *can* be used in PL/SQL. You simply need to know
how
> > to use it. Instead of confusing definitions and quoting 3rd party books
> > (which surprise, surprise, not all of us have), I would think a poster
with
> > a problem would want to know *how* to use the DECODE statement and not
told
> > half untruths that DECODE is not a PL/SQL statement, thus implying that
it
> > can not be used in PL/SQL at all.
> >
> > --
> > Billy
>
>
> --
> no sig today
>
>
Rene, Has this thread got mixed up? It was Billy who said 'crap like that' - not me. This thread is getting confusing - and I didn't try to insult anyone. Regards, Paul
Received on Fri Feb 07 2003 - 15:43:54 CST

Original text of this message

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