Home » SQL & PL/SQL » SQL & PL/SQL » caseexpression
caseexpression [message #277345] Mon, 29 October 2007 12:28 Go to next message
dr46014
Messages: 49
Registered: February 2007
Member
hi
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: 68733
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Post what you already tried and what is the point that sticks you.

Regards
Michel
Re: caseexpression [message #277452 is a reply to message #277345] Tue, 30 October 2007 03:21 Go to previous message
JRowbottom
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: Fri Feb 07 21:15:38 CST 2025