Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Execute Different SQL Statements Based On Day of Week

808774Oct 27 2010 — edited Oct 27 2010
I need to execute different sql statements based on the day of the week in Oracle 8i. In SQL Server, it's pretty simple. SELECT
CASE DATEPART(dw,GETDATE())
WHEN 4 THEN (SELECT COUNT(*) FROM ADR_VLDN )
END
In Oracle it should be something like this

IF to_char(SYSDATE, 'D') = 2 THEN
SELECT * FROM RSVP_FILE_PRCS WHERE ROWNUM = 1;
ELSEIF to_char(SYSDATE, 'D') = 3 THEN
SELECT * FROM RSVP_FILE_PRCS WHERE ROWNUM = 2;
END IF;

But this doesn't work. Does anyone have any ideas about how to do this in Oracle?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 24 2010
Added on Oct 27 2010
18 comments
3,132 views