by Akatsukami » Mon Jul 08, 2013 3:08 pm
Stefan wrote:SELECT
CASE
WHEN DAYOFWEEK(CURRENT TIMESTAMP) = 1 THEN 'SUNDAY'
WHEN DAYOFWEEK(CURRENT TIMESTAMP) = 2 THEN 'MONDAY'
WHEN DAYOFWEEK(CURRENT TIMESTAMP) = 3 THEN 'TUESDAY'
WHEN DAYOFWEEK(CURRENT TIMESTAMP) = 4 THEN 'WEDNESDAY'
WHEN DAYOFWEEK(CURRENT TIMESTAMP) = 5 THEN 'THURSDAY'
WHEN DAYOFWEEK(CURRENT TIMESTAMP) = 6 THEN 'FRIDAY'
ELSE 'SATURDAY'
END
FROM SYSIBM.SYSDUMMY1;
Is that not rather a SQL solution than a PL/I one?
dcl dayofweek char (90;
select (weekday());
when (1) dayofweek = 'Sunday';
when (2) dayofweek = 'Monday';
when (3) dayofweek = 'Tuesday';
when (4) dayofweek = 'Wednesday';
when (5) dayofweek = 'Thursday';
when (6) dayofweek = 'Friday';
when (7) dayofweek = 'Saturday';
end
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day