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

Home -> Community -> Usenet -> c.d.o.tools -> Re: SELECT within a DECODE alternatives??

Re: SELECT within a DECODE alternatives??

From: Stuhlpfarrer Markus <stuhli_at_tm1.at>
Date: Sun, 24 Jun 2001 16:17:39 GMT
Message-ID: <3B3612B1.FE4583D3@tm1.at>

you write a function something like:

create or replace function functionname (inparam1 in varchar2, inparam2 in number)
return varchar2
as
returnvariable varchar2;

begin
select column1 into returnvariable from tablename where ... ;

return returnvariable;
end functionname;

if you have a more specific question you can send me a mail if you like

Hamm wrote:

> After looking around a bit this seems the
> most viable solution, as examaming every
> record through ado a piece at a time would
> be horribly slow.
>
> Could you give a rough example of this?
> I know very little about pl/sql im afraid :(
>
> Thanks
>
> > a useable alternative would be to write a pl/sql function for it that
> > returns you a value.
> > either it can return the correct value or a true or false
> > which you can decode
> >
> > Hamm wrote:
> >
> > > I was browing through dejanews and found out there is no
> > > support for the select statement within a decode for the
> > > version of oracle I am using (8.0.6 I believe)
> > >
> > > The problem is I need an alternative now.
> > > I am working on a series of statements, with
> > > the core of the problem being a series of if statements
> > > (nested decodes), but the criteria is that a certain field
> > > exists in a lookup table ie. something like
> > >
> > > SELECT DECODE(SELECT FIELD FROM TABLEa A WHERE A.FIELD = 'VALUE',
> > > NULL,
> > > DECODE(..another nested decode..),
> > > NULL )
> > > FROM TABLEb
> > > WHERE bunch of criteria
> > >
> > > Is there an alternative for this in pure sql?
  Received on Sun Jun 24 2001 - 11:17:39 CDT

Original text of this message

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