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: oracle sql

Re: oracle sql

From: DA Morgan <damorgan_at_psoug.org>
Date: Tue, 23 Aug 2005 21:23:56 -0700
Message-ID: <1124857397.464582@yasure>


jwa6 wrote:
> select
> PL.SYSTEM_CONTROL_NO AS "SCN",
> PL.AGENCY_CASE_NO AS "OCA",
> PL.AGENCY_ORI_NO AS "ORI",
> PL.NCIC_NUMBER AS "NIC",
> FTC.FILE_TYPE_DESCR AS "FILE TYPE",
> comment_field as either "this is a ncic record" or
> "this is a cbib record"
> from
> ANNUAL_PURGE AP,
> PURGE_LOG PL,
> FILE_TYPE_CODE FTC
> where
> ap.PURGE_RESULT_CD IN ('NCICN','CIBN') AND
> PL.FILE_TYPE_CD = FTC.FILE_TYPE_CD
> ORDER BY PL.AGENCY_ORI_NO, PL.FILE_TYPE_CD;
>
>
> i need to do this if possible..if a record is
> ap.PURGE_RESULT_CD ='NCICN' then the comment field in the select list
> needs to read "this is a ncic record" or
> if a record is
> ap.PURGE_RESULT_CD ='CIBN' then the comment field in the select list
> needs to read "this is a cbib record"
>
> is this possible in a single select?
>
> thanks
> jwa

Look up DECODE and CASE. Either will do what you appear to be asking.

http://www.psoug.org
click on Morgan's Library
click on DECODE.

-- 
Daniel A. Morgan
http://www.psoug.org
damorgan_at_x.washington.edu
(replace x with u to respond)
Received on Tue Aug 23 2005 - 23:23:56 CDT

Original text of this message

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