Xref: alice comp.databases.oracle.server:22293
Path: alice!news-feed.fnsi.net!news.idt.net!news-peer.gip.net!news.gsl.net!gip.net!News.Toronto.iSTAR.net!news.istar.net!newsfeed.interlog.com!news.interlog.com!not-for-mail
From: Mirko Trifunovic <mirkot@interlog.com>
Newsgroups: comp.databases.oracle.server
Subject: Re: help with decode command: is there a way to include a select statement in the result of a decode function
Date: Sat, 06 Jun 1998 19:31:06 -0400
Organization: Interlog Internet Services
Lines: 56
Message-ID: <3579D13A.98F1AA79@interlog.com>
References: <6kk7d6$r1l$1@websites.campbellhall.org> <356DBA21.3469@mdsi.bc.ca>
NNTP-Posting-Time: 6 Jun 1998 23:39:01 GMT
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 4.04 [en] (WinNT; U)

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@mdsi.bc.ca
> Canada V6X-2W9               | http://www.mdsi-advantex.com
> ------------------------------------------------------------
