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: help with decode command: is there a way to include a select statement in the result of a decode function

Re: help with decode command: is there a way to include a select statement in the result of a decode function

From: Mirko Trifunovic <mirkot_at_interlog.com>
Date: Sat, 06 Jun 1998 19:31:06 -0400
Message-ID: <3579D13A.98F1AA79@interlog.com>


Also, you can try the following:


SET TERMOUT OFF
COLUMN status NEW_VALUE _status
SELECT status status FROM stat WHERE age = 32; SET TERMOUT ON SELECT DECODE(payrate,

	1, 'hi',
	2, laborcode,
	3, '&&_status')

FROM labor;

Stanley Fung wrote:
>
> I don't think you can do this because you can't execute the output of a SQL statement.
>
> You may try to spool the output of a SQL statement to a file, and then run that file.
> However, you have to set the SQL*Plus to eliminate the heading and feedback.
>
> Let me know if there are any solutions!
>
> dan wrote:
> >
> > i want to use the decode command but the result of the search should be a
> > select statement
> >
> > i.e. select decode(payrate, 1, 'text'
> > 2, column name
> > 3, "a select statement with a where
> > clause)
> > from labor;
> >
> > is this possible
> > select decode(payrate, 1, 'hi'
> > 2, laborcode
> > 3, select status from stat where age = 32)
> > from labor;
> >
> > I tried quotes around select etc nothing works any way to do it?
> >
> > Dan Ramriez
>
> --
> ------------------------------------------------------------
> Stanley Fung | Software Analyst
> Mobile Data Solutions Inc. | Direct Line: (604)207-6290
> Suite 135 | Tel: (604)270-9939
> 10551 Shellbridge Way, | Fax: (604)270-1310
> Richmond, B.C. | E-Mail: sfung_at_mdsi.bc.ca
> Canada V6X-2W9 | http://www.mdsi-advantex.com
> ------------------------------------------------------------
Received on Sat Jun 06 1998 - 18:31:06 CDT

Original text of this message

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