Home » SQL & PL/SQL » SQL & PL/SQL » Day Number to Full Day Name Conversion (Oralce 10.2.0.1)
Day Number to Full Day Name Conversion [message #401671] Wed, 06 May 2009 01:40 Go to next message
anwaarrana
Messages: 2
Registered: April 2009
Location: Pakistan
Junior Member

Hi All

I want to convert day number(1-7) to full day name('sunday'-'saturday') in sql query. How it can done.

Thanks in Advance

Anwar ul haq Rana
Re: Day Number to Full Day Name Conversion [message #401673 is a reply to message #401671] Wed, 06 May 2009 01:58 Go to previous messageGo to next message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
case num
  when 1 then 'thumb'
  when 2 then 'index finger'
  when 3 then 'middle finger'
  when 4 then 'ring finger'
  when 5 then 'little finger'
end

Regards
Michel
Re: Day Number to Full Day Name Conversion [message #401675 is a reply to message #401671] Wed, 06 May 2009 02:05 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Another option: Take a date for which you know the day and add the day-number to it. Then use to_char to get the day-name
This will still enable you to display nls-specific names.
Re: Day Number to Full Day Name Conversion [message #401681 is a reply to message #401671] Wed, 06 May 2009 02:41 Go to previous messageGo to next message
danish_fsd@yahoo.com
Messages: 38
Registered: February 2008
Location: Pakistan
Member
Try Following. Hope it will help you.

SELECT TO_CHAR((sysdate - (TO_CHAR(sysdate,'d') - 1)),'Day') 
FROM DUAL;


Here '1' is the day number and query will return 'Sunday'.

Regards

Danish.
Re: Day Number to Full Day Name Conversion [message #401682 is a reply to message #401681] Wed, 06 May 2009 02:53 Go to previous messageGo to next message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

It depends on your country.
So OP has to detail his requirements.
Must 1-7 matches to Sunday-Saturday?
Does this can/must depend on country? in numbers and/or names?
...

Regards
Michel
Re: Day Number to Full Day Name Conversion [message #402024 is a reply to message #401681] Thu, 07 May 2009 06:25 Go to previous message
anwaarrana
Messages: 2
Registered: April 2009
Location: Pakistan
Junior Member

Thanks Danish.

It is realy helpful to me

Anwar ul haq Rana
Previous Topic: How to send refcursor result to a procedure as in parameter to get result
Next Topic: query
Goto Forum:
  


Current Time: Fri Dec 02 16:47:46 CST 2016

Total time taken to generate the page: 0.28152 seconds