Topics Topics Help/Instructions Help Edit Profile Profile Member List Register Paatha Gnyapakaalu - Archives from Old DB  
Search New Posts 1 | 2 | 8 Hours Search New Posts 1 | 3 | 7 Days Search Search Tree View Tree View Latest tweets Live Tweets
Bewarse Talk Discussion Board * Archives - 2011 * Cine Talk - Reviews, Gossips, Insider Info etc. * Archive through May 12, 2011 * Oracle SQL Help < Previous Next >

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Vidurudu
Pilla Bewarse
Username: Vidurudu

Post Number: 54
Registered: 04-2011
Posted From: 98.238.222.108

Rating: N/A
Votes: 0 (Vote!)

Posted on Thursday, May 12, 2011 - 2:30 am:    Edit Post Delete Post View Post/Check IP

I just saw NEXT_DAY function in Ravanabrahma's post. Looks like this query will always return last monday in May using NEXT_DAY.

select next_day(to_date('0524','mmdd'), 'MONDAY') from dual
Top of pagePrevious messageNext messageBottom of page Link to this message

Vidurudu
Pilla Bewarse
Username: Vidurudu

Post Number: 53
Registered: 04-2011
Posted From: 98.238.222.108

Rating: N/A
Votes: 0 (Vote!)

Posted on Thursday, May 12, 2011 - 2:23 am:    Edit Post Delete Post View Post/Check IP

I am not an expert in SQL, so my oracle query may not be straight forward. But, if you are finding the last monday of May in CURRENT year, the following query may work.

select case
when ( to_char(to_date('0525','mmdd'),'DY') = 'MON' ) then to_date('0525','mmdd')
when ( to_char(to_date('0526','mmdd'),'DY') = 'MON' ) then to_date('0526','mmdd')
when ( to_char(to_date('0527','mmdd'),'DY') = 'MON' ) then to_date('0527','mmdd')
when ( to_char(to_date('0528','mmdd'),'DY') = 'MON' ) then to_date('0528','mmdd')
when ( to_char(to_date('0529','mmdd'),'DY') = 'MON' ) then to_date('0529','mmdd')
when ( to_char(to_date('0530','mmdd'),'DY') = 'MON' ) then to_date('0530','mmdd')
when ( to_char(to_date('0531','mmdd'),'DY') = 'MON' ) then to_date('0531','mmdd')
end
from dual

If you want to find the memorial day for some other year (past or future), you just need to change &year_yyyy with year (example: 2007, 2009 etc) in the below query

select case
when ( to_char(to_date('0525'||year_yyyy,'mmddyyyy'),'DY') = 'MON' ) then to_date('0525'||year_yyyy,'mmddyyyy')
when ( to_char(to_date('0526'||year_yyyy,'mmddyyyy'),'DY') = 'MON' ) then to_date('0526'||year_yyyy,'mmddyyyy')
when ( to_char(to_date('0527'||year_yyyy,'mmddyyyy'),'DY') = 'MON' ) then to_date('0527'||year_yyyy,'mmddyyyy')
when ( to_char(to_date('0528'||year_yyyy,'mmddyyyy'),'DY') = 'MON' ) then to_date('0528'||year_yyyy,'mmddyyyy')
when ( to_char(to_date('0529'||year_yyyy,'mmddyyyy'),'DY') = 'MON' ) then to_date('0529'||year_yyyy,'mmddyyyy')
when ( to_char(to_date('0530'||year_yyyy,'mmddyyyy'),'DY') = 'MON' ) then to_date('0530'||year_yyyy,'mmddyyyy')
when ( to_char(to_date('0531'||year_yyyy,'mmddyyyy'),'DY') = 'MON' ) then to_date('0531'||year_yyyy,'mmddyyyy')
end
from (select '&year_yyyy' year_yyyy from dual)
Top of pagePrevious messageNext messageBottom of page Link to this message

Ravanabrahma
Bewarse Legend
Username: Ravanabrahma

Post Number: 15700
Registered: 06-2004
Posted From: 72.129.47.227

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, May 11, 2011 - 12:17 am:    Edit Post Delete Post View Post/Check IP


Blazewada:




antha kusalame baa...dinner kanichi netflix lo cinema soothanna inka..
Top of pagePrevious messageNext messageBottom of page Link to this message

Blazewada
Bewarse Legend
Username: Blazewada

Post Number: 15974
Registered: 08-2008
Posted From: 206.53.152.176

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, May 11, 2011 - 12:00 am:    Edit Post Delete Post View Post/Check IP


ravanabrahma:




MOVIEART--hello baa papa ela undi. Ellarum kusalamaa.
A Pat on your Back is few inches away from Kick on your Butt CLIPART--icon_neutral
Top of pagePrevious messageNext messageBottom of page Link to this message

Ravanabrahma
Bewarse Legend
Username: Ravanabrahma

Post Number: 15699
Registered: 06-2004
Posted From: 72.129.47.227

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 11:52 pm:    Edit Post Delete Post View Post/Check IP


Penkonda_tiger:




MOVIEART--bemmi.etakaram
Top of pagePrevious messageNext messageBottom of page Link to this message

Penkonda_tiger
Mudiripoyina Bewarse
Username: Penkonda_tiger

Post Number: 4710
Registered: 06-2005
Posted From: 82.157.134.169

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 11:43 pm:    Edit Post Delete Post View Post/Check IP


Ravanabrahma:

Given a date, can we find out if that is a saturday or sunday?





MOVIEART--ali.lol



to_char(sysdate,'D')
kanapade nijam: Good manners , kanapadanidhi: abusive language
Top of pagePrevious messageNext messageBottom of page Link to this message

Ravanabrahma
Bewarse Legend
Username: Ravanabrahma

Post Number: 15698
Registered: 06-2004
Posted From: 72.129.47.227

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 11:27 pm:    Edit Post Delete Post View Post/Check IP


Symbol_of_king:

first monday value ki +7 aythe 2nd ,+14 aythe 3rd ala vachestayi kada...am i missing something?????




idi koda try chesi chostha mama :-)
Top of pagePrevious messageNext messageBottom of page Link to this message

Symbol_of_king
Yavvanam Kaatesina Bewarse
Username: Symbol_of_king

Post Number: 2084
Registered: 12-2005
Posted From: 76.21.187.173

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 9:58 pm:    Edit Post Delete Post View Post/Check IP


Ravanabrahma:

similar ga 2nd, 3rd, fouth anedi elago chodali..




first monday value ki +7 aythe 2nd ,+14 aythe 3rd ala vachestayi kada...am i missing something?????
Top of pagePrevious messageNext messageBottom of page Link to this message

Ravanabrahma
Bewarse Legend
Username: Ravanabrahma

Post Number: 15697
Registered: 06-2004
Posted From: 72.129.47.227

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 5:58 pm:    Edit Post Delete Post View Post/Check IP


Lilliput:

annai nuvvu adigindhi kochen aaa quiz aaa ...anni answers meere seppesthunnaru MOVIEART--bemmi.okamadiri




ikkada janalani adugthe google chestha..veellu cheppe vatini batti add chesukunte solution vachesthadi...pakka db lo rediff bhayya cheppadu last_day anedi :-)
Top of pagePrevious messageNext messageBottom of page Link to this message

Lilliput
Celebrity Bewarse
Username: Lilliput

Post Number: 7797
Registered: 08-2010
Posted From: 129.107.30.107

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 5:53 pm:    Edit Post Delete Post View Post/Check IP


Ravanabrahma:


annai nuvvu adigindhi kochen aaa quiz aaa ...anni answers meere seppesthunnaru MOVIEART--bemmi.okamadiri
Top of pagePrevious messageNext messageBottom of page Link to this message

Ravanabrahma
Bewarse Legend
Username: Ravanabrahma

Post Number: 15696
Registered: 06-2004
Posted From: 72.129.47.227

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 5:52 pm:    Edit Post Delete Post View Post/Check IP

anthe..2 times NEXT_DAY vesthe 2nd monday annattu..last_day vadithe last monday vachesthadi aa month lo MOVIEART--bemmi.dance3
Top of pagePrevious messageNext messageBottom of page Link to this message

Ravanabrahma
Bewarse Legend
Username: Ravanabrahma

Post Number: 15695
Registered: 06-2004
Posted From: 72.129.47.227

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 5:48 pm:    Edit Post Delete Post View Post/Check IP

2nd ayithe NEXT_DAY ani 2 times pedithe saripodhemo..last anedi ela cheyyalo appudu..kiki
Top of pagePrevious messageNext messageBottom of page Link to this message

Ravanabrahma
Bewarse Legend
Username: Ravanabrahma

Post Number: 15694
Registered: 06-2004
Posted From: 72.129.47.227

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 5:47 pm:    Edit Post Delete Post View Post/Check IP

SQL> -- Finding the first Monday in the month of September.
SQL> SELECT TO_CHAR(NEXT_DAY('01-SEP-97','Monday'),'MM/DD/YYYY HH:MM:SS AM') "Next_Day" from DUAL;

similar ga 2nd, 3rd, fouth anedi elago chodali..
Top of pagePrevious messageNext messageBottom of page Link to this message

Vja
Yavvanam Kaatesina Bewarse
Username: Vja

Post Number: 2147
Registered: 12-2009
Posted From: 72.184.151.231

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 5:43 pm:    Edit Post Delete Post View Post/Check IP

konchem tricky ee rendodii
Strictly Jai Balayya
Top of pagePrevious messageNext messageBottom of page Link to this message

Ravanabrahma
Bewarse Legend
Username: Ravanabrahma

Post Number: 15693
Registered: 06-2004
Posted From: 72.129.47.227

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 5:42 pm:    Edit Post Delete Post View Post/Check IP


Kalki:

SAP lo ayyithe factory calendar ani untadi

danni set seste dates anni ade sooskuntadi




oh..oracle lo undo ledo ala..kastha google setha..
Top of pagePrevious messageNext messageBottom of page Link to this message

Kalki
Bewarse Legend
Username: Kalki

Post Number: 34758
Registered: 04-2005
Posted From: 168.161.192.16

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 5:39 pm:    Edit Post Delete Post View Post/Check IP

SAP lo ayyithe factory calendar ani untadi

danni set seste dates anni ade sooskuntadi
Top of pagePrevious messageNext messageBottom of page Link to this message

Ravanabrahma
Bewarse Legend
Username: Ravanabrahma

Post Number: 15692
Registered: 06-2004
Posted From: 72.129.47.227

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 5:33 pm:    Edit Post Delete Post View Post/Check IP


Kalki:

adi kooda veasy gaa raayocchu




ade soothanna google lo..adi koda rasetham ayithe ee month antha pandage..

Po need by date calculate seyyali kalkesh based on creation date and lead time. rendu kalipithe need by date vasthadi..aa creation date ki and need by date ki madhyalo dates weekend avvakodadu and holiday list lo unda kodadu..unte okati increment chesi malla test cheyyali same condition..so aa holiday list thayaru sesi oka table lo padedham ani working inka..
Top of pagePrevious messageNext messageBottom of page Link to this message

Ravanabrahma
Bewarse Legend
Username: Ravanabrahma

Post Number: 15691
Registered: 06-2004
Posted From: 72.129.47.227

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 5:30 pm:    Edit Post Delete Post View Post/Check IP

the command that worked for me is

select to_char(to_date('05/08/2011', 'mm/dd/yyyy'), 'd') from dual

inka direct date type variable in pass chesthe ee to_date conversion avasaram ledu emo...inka adantha chosukovachu aa next :-)
Top of pagePrevious messageNext messageBottom of page Link to this message

Kalki
Bewarse Legend
Username: Kalki

Post Number: 34757
Registered: 04-2005
Posted From: 168.161.192.16

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 5:29 pm:    Edit Post Delete Post View Post/Check IP

adi kooda veasy gaa raayocchu
Top of pagePrevious messageNext messageBottom of page Link to this message

Ravanabrahma
Bewarse Legend
Username: Ravanabrahma

Post Number: 15690
Registered: 06-2004
Posted From: 72.129.47.227

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 5:28 pm:    Edit Post Delete Post View Post/Check IP


Vja:

select to_char(to_date('10-MAY-2011'),'day') from dual




yes baa..ippude chosa idi :-)
Top of pagePrevious messageNext messageBottom of page Link to this message

Ravanabrahma
Bewarse Legend
Username: Ravanabrahma

Post Number: 15689
Registered: 06-2004
Posted From: 72.129.47.227

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 5:28 pm:    Edit Post Delete Post View Post/Check IP


Kalki:

excel lo raayocchu easy gaa ...so SQl lo inka easy gaa raayocchu anukunta




satudat and sunday naa cheppatam easy nee..ippude test chesa..

select to_char(date, 'd') from dual return a number ranging from 0 to 6.

0 = saturday
1 = sunday
2 = monday
.
.
.

so if the value is 0 or 1 then I can say that is weekend.

inka rule ni batti. I mean in the 5th month LAST monday of a given year anedi ee date anedi ela anedi chodali
Top of pagePrevious messageNext messageBottom of page Link to this message

Kalki
Bewarse Legend
Username: Kalki

Post Number: 34755
Registered: 04-2005
Posted From: 168.161.192.16

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 5:26 pm:    Edit Post Delete Post View Post/Check IP

rey daiper gaa knowledge daaram lo neekem pani
Top of pagePrevious messageNext messageBottom of page Link to this message

Vja
Yavvanam Kaatesina Bewarse
Username: Vja

Post Number: 2143
Registered: 12-2009
Posted From: 72.184.151.231

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 5:26 pm:    Edit Post Delete Post View Post/Check IP

select to_char(to_date('10-MAY-2011'),'day') from dual
Strictly Jai Balayya
Top of pagePrevious messageNext messageBottom of page Link to this message

Kalki
Bewarse Legend
Username: Kalki

Post Number: 34754
Registered: 04-2005
Posted From: 168.161.192.17

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 5:26 pm:    Edit Post Delete Post View Post/Check IP

=CHOOSE(WEEKDAY(A1),"Sun","Mon","Tue","Wed","Thu","Fri","Sat")

A1 lo date iste vacchestadi
Top of pagePrevious messageNext messageBottom of page Link to this message

Lilliput
Celebrity Bewarse
Username: Lilliput

Post Number: 7793
Registered: 08-2010
Posted From: 129.107.30.107

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 5:25 pm:    Edit Post Delete Post View Post/Check IP


Kalki:

excel lo raayocchu easy gaa ...so SQl lo inka easy gaa raayocchu anukunta


\blessme
Top of pagePrevious messageNext messageBottom of page Link to this message

Kalki
Bewarse Legend
Username: Kalki

Post Number: 34753
Registered: 04-2005
Posted From: 168.161.192.16

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 5:25 pm:    Edit Post Delete Post View Post/Check IP

excel lo raayocchu easy gaa ...so SQl lo inka easy gaa raayocchu anukunta
Top of pagePrevious messageNext messageBottom of page Link to this message

Ravanabrahma
Bewarse Legend
Username: Ravanabrahma

Post Number: 15688
Registered: 06-2004
Posted From: 72.129.47.227

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, May 10, 2011 - 5:12 pm:    Edit Post Delete Post View Post/Check IP

Given a date, can we find out if that is a saturday or sunday?

Also, how to find the date based on some rule. For eg: find the memorial day in 2011. Memorial day comes as the LAST Monday in Month May. How to find the date if based on Last monday in 5th month?

Topics | Last Hour | Last Day | Last Week | Tree View | Search | Help/Instructions | Program Credits Administration