Oracle PL/SQL question Chalanachithram.com | Topics | Search
Hide Clipart | Log Out | Register | Edit Profile

Last 30 mins | 1 | 2 | 4 hours     Last 1 | 7 Days

Chalanachithram.com DB » TF Industry related » Archive through May 11, 2011 » Oracle PL/SQL question « Previous Next »

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

Khaleja
Junior Artist
Username: Khaleja

Post Number: 886
Registered: 09-2009
Posted From: 72.129.47.227

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

Posted on Tuesday, May 10, 2011 - 06:56 pm:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


Humpty_dumpty:




solution is we maintain these rules in a table (for the users its Oracle list of values)

in the coding side..I have a basic date that is po creation date from which I can get the year that I need to calculate these values...based on that I can derive these variables dates for that year for these rules.

say for example, if I see the month as 5, and FIRST monday as the rule, I know the year..I can use the command with next_day and get the date..similarly last monday can be obtained by last_date..3rd monday can be obtained by giving next_day(next_day(next_day...)

I got the solution.

Thanks all for your help :-)
Top of pagePrevious messageNext messageBottom of page Link to this message

Khaleja
Junior Artist
Username: Khaleja

Post Number: 885
Registered: 09-2009
Posted From: 72.129.47.227

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

Posted on Tuesday, May 10, 2011 - 06:51 pm:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


Rediff:




thats correct rediff bhayya..its working...similar ga 2nd, 3rd anedi kanukkovali ante NEXT_DAY command anni sarlu use chesthe saripothundi :-)
Top of pagePrevious messageNext messageBottom of page Link to this message

Twitter
Side Hero
Username: Twitter

Post Number: 8929
Registered: 10-2009
Posted From: 74.90.15.60

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

Posted on Tuesday, May 10, 2011 - 06:50 pm:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


Khaleja:

memorial day is the LAST monday of May, Labor day is the FIRST monday of September etc..so alanti vatiki dates kani pettali for a given year..




to_char ((datetimestamp, 'MM DD YYYY'), 'W')= 1
Top of pagePrevious messageNext messageBottom of page Link to this message

Humpty_dumpty
Moderator
Username: Humpty_dumpty

Post Number: 14104
Registered: 02-2009

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

Posted on Tuesday, May 10, 2011 - 06:47 pm:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


Khaleja:


dates and actual days are variable...so there is no absolute std solution IMO
one way is to have a custom set of days (user configurable) and have ur calculations exclude these
ppl who interact with clients can keep track of updating these
Top of pagePrevious messageNext messageBottom of page Link to this message

Khaleja
Junior Artist
Username: Khaleja

Post Number: 884
Registered: 09-2009
Posted From: 72.129.47.227

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

Posted on Tuesday, May 10, 2011 - 06:47 pm:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

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

Rediff
Junior Artist
Username: Rediff

Post Number: 9
Registered: 12-2006
Posted From: 198.246.249.35

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

Posted on Tuesday, May 10, 2011 - 06:46 pm:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

Following gives - last monday of this month

select next_day((last_day(to_date('05/2011','MM/YYYY')) - 7), 'Monday') AS day FROM dual;



last_day of May 2011 = 5/31/2011
7 days prior to last day = 5/25/2011
first monday since 7 days prior to last day = 5/30/2011
Top of pagePrevious messageNext messageBottom of page Link to this message

Khaleja
Junior Artist
Username: Khaleja

Post Number: 883
Registered: 09-2009
Posted From: 72.129.47.227

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

Posted on Tuesday, May 10, 2011 - 06:36 pm:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

I need to find out all the dates of the holidays for a given year as the dates are variable for these holidays..say for example

memorial day is the LAST monday of May, Labor day is the FIRST monday of September etc..so alanti vatiki dates kani pettali for a given year..
Top of pagePrevious messageNext messageBottom of page Link to this message

Khaleja
Junior Artist
Username: Khaleja

Post Number: 882
Registered: 09-2009
Posted From: 72.129.47.227

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

Posted on Tuesday, May 10, 2011 - 06:34 pm:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


Life_sucks:



Aha:




yaa..meeru cheppindi correct..aa command work ayyindi.


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



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

Aha
Junior Artist
Username: Aha

Post Number: 9
Registered: 01-2011
Posted From: 68.108.79.25

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

Posted on Tuesday, May 10, 2011 - 06:24 pm:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

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

should return the day of the date
Top of pagePrevious messageNext messageBottom of page Link to this message

Life_sucks
Side Hero
Username: Life_sucks

Post Number: 2494
Registered: 05-2008
Posted From: 148.168.40.4

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

Posted on Tuesday, May 10, 2011 - 06:21 pm:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

first daniki
select to_char(sysdate, 'DAY') from dual;
Top of pagePrevious messageNext messageBottom of page Link to this message

Diwakaram_april1
Side Hero
Username: Diwakaram_april1

Post Number: 7900
Registered: 12-2007
Posted From: 75.103.13.52

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

Posted on Tuesday, May 10, 2011 - 06:18 pm:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

JAVA lo simple, must n shud ga PL/SQL answer ante thelidhu.
Top of pagePrevious messageNext messageBottom of page Link to this message

Khaleja
Junior Artist
Username: Khaleja

Post Number: 881
Registered: 09-2009
Posted From: 72.129.47.227

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

Posted on Tuesday, May 10, 2011 - 06:16 pm:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

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?

Add Your Message Here
Post:
Bold text Italics Underline Create a hyperlink Insert a clipart image HASH(0x9593648){Movie Clipart}
Show / Hide regular icons selection options

Click on following links to open cliparts by Alphabetical Order

 A   B   C   D   E   F   G   H   I   J   K   L   M  

 N   O   P   Q   R   S   T   U   V   W   X   Y   Z  

Show / Hide Filmy icons selection options

Click on following links to open cliparts by Alphabetical Order

 A   B   C   D   E   F   G   H   I   J   K   L   M  

 N   O   P   Q   R   S   T   U   V   W   X   Y   Z  


Username: Posting Information:
This is a public posting area. Enter your username and password if you have an account. Otherwise, enter your full name as your username and leave the password blank. Your e-mail address is optional.
Password:
E-mail:
Options: Enable HTML code in message
Automatically activate URLs in message
Action: