Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: oracle sql
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
![]() |
![]() |