Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> How to get Day of week
How can I get the Day of a week via Oracle functions?
I tried using a function like
Create or replace function DAYOFWEEK (DTTAG IN DATE)
RETURN NUMBER
AS
TAG NUMBER;
VALUE DATE;
BEGIN
VALUE :=trunc(dtTAG);
TAG := TO_NUMBER(TO_CHAR(VALUE,'D'));
RETURN TAG;
END DAYOFWEEK ;
That works fine, but it depends on the NLS_TERRITORY. That means using
Territory = America the week starts with sunday, using german the week
starts with monday.
Does exists a better solution, which is independend from the territory?
Kind regards
Nicolas Bronke
Received on Thu Apr 29 1999 - 15:40:47 CDT