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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: DECODE or not to DECODE

RE: DECODE or not to DECODE

From: Carol Bristow <Carol.Bristow_at_dpra.com>
Date: Mon, 04 Aug 2003 06:59:25 -0800
Message-ID: <F001.005C8D10.20030804065925@fatcity.com>


Eva -

I dredged this out of some ancient code that I wrote against a 7.2 database. The inner trunc functions were there to get rid of the time - I don't remember why the outer trunc function was there at this point
(it was five years ago). This doesn't get you completely there, but
will hopefully get you started.

Decode
(sign(30-(trunc(trunc(SysDate)-trunc(col_date)))),
1,'30 days',null)

Carol Bristow
DPRA Inc.
1300 N 17th St Suite 950
Rosslyn, VA 22209
Work: 703-841-8025
Fax: 703-524-9415

-----Original Message-----
Sent: Monday, August 04, 2003 10:24 AM
To: Multiple recipients of list ORACLE-L

Hello Listers,

I need some help please,
I am trying to create a DECODE statement, on a date column and looks something like this, but does not work.
SELECT COL1,

                COL2,
                DECODE((SYSDATE - COL_DATE), <= 30, '30_days', NULL)
Days30,
                DECODE((SYSDATE - COL_DATE), (between 31 and 60), '60
Days',
NULL) Days60,
.......
.......
FROM ACCOUNT_TBL
WHERE COL = '0' Obviously, I have worked out that this can not be done. The problem is also
that the server is 7.3.4 and I need to use the code in a view. Does anyone have any solutions/work arounds for this? Any help will be appraciated.

TIA
Denham Eva
Oracle DBA




This e-mail message has been scanned for Viruses and Content and cleared

by MailMarshal

For more information please visit www.marshalsoftware.com



########################################################################
#############
Note:
This message is for the named person's use only. It may contain confidential,
proprietary or legally privileged information. No confidentiality or privilege
is waived or lost by any mistransmission. If you receive this message in error,
please immediately delete it and all copies of it from your system, destroy any
hard copies of it and notify the sender. You must not, directly or indirectly,
use, disclose, distribute, print, or copy any part of this message if you are not
the intended recipient. TFMC and any of its subsidiaries each reserve the right to monitor all e-mail communications through its networks.

Any views expressed in this message are those of the individual sender, except where
the message states otherwise and the sender is authorized to state them to be the
views of any such entity.

Thank You.

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Denham Eva
  INET: EvaD_at_TFMC.co.za

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L

(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Carol Bristow INET: Carol.Bristow_at_dpra.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
Received on Mon Aug 04 2003 - 09:59:25 CDT

Original text of this message

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