Home » SQL & PL/SQL » SQL & PL/SQL » caseexpression
caseexpression [message #277345] Mon, 29 October 2007 12:28 Go to next message
Messages: 48
Registered: February 2007
can anyone please help me writing a sql case expression where a date parameter data_date is passed.if the day of the date is sunday or monday then file_date becomes data_date-2 and for rest other days its data_date-1.

Re: caseexpression [message #277348 is a reply to message #277345] Mon, 29 October 2007 12:50 Go to previous messageGo to next message
Michel Cadot
Messages: 65085
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Post what you already tried and what is the point that sticks you.

Re: caseexpression [message #277452 is a reply to message #277345] Tue, 30 October 2007 03:21 Go to previous message
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Try something like this:
select case when to_char(data_date,'DY') in ('SUN','MON') then data_date-2 
            else data_date -1 end
from dual;
Previous Topic: Queries (merged 4)
Next Topic: dbms_stats for specific tables of different schemas
Goto Forum:

Current Time: Mon Jul 24 05:48:24 CDT 2017

Total time taken to generate the page: 0.06062 seconds