Home » Developer & Programmer » Forms » Date overlaping check in form 10g
Date overlaping check in form 10g [message #580955] Sat, 30 March 2013 07:04 Go to next message
irfankundi786@yahoo.com
Messages: 203
Registered: February 2009
Location: pakistan
Senior Member

I have two field date from and date to... i want to enter an employee in date range that range should not be enter again.what should be possible answer???
Re: Date overlaping check in form 10g [message #580957 is a reply to message #580955] Sat, 30 March 2013 07:08 Go to previous messageGo to next message
Littlefoot
Messages: 18822
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Create unique index on (date_from, date_to) columns.
Re: Date overlaping check in form 10g [message #580958 is a reply to message #580957] Sat, 30 March 2013 07:15 Go to previous messageGo to next message
irfankundi786@yahoo.com
Messages: 203
Registered: February 2009
Location: pakistan
Senior Member

i want to control the date range of one emplyee....
eg...date from 01-mar-2013 date_to 10-mar-2013 if this range is enter for the particular employee then between this
range the date should be not enter that is 05,06 upto 10 march should not be enter.
I think this can't be handle through the unique index..
there is code needed..??
Re: Date overlaping check in form 10g [message #580959 is a reply to message #580958] Sat, 30 March 2013 07:40 Go to previous messageGo to next message
Littlefoot
Messages: 18822
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
In a loop through all (date_from, date_to) pairs for a certain employee check whether newly entered values fall between these values. If so, raise an error.
Re: Date overlaping check in form 10g [message #580960 is a reply to message #580959] Sat, 30 March 2013 07:55 Go to previous messageGo to next message
irfankundi786@yahoo.com
Messages: 203
Registered: February 2009
Location: pakistan
Senior Member

i have selected employee of date and check it from the date between this
BEGIN 
    FOR date_cur IN (SELECT pay_emp_id, 
                            from_date, 
                            to_date 
                     FROM   pay_emp_itax 
                     WHERE  pay_emp_id = :PAY_EMP_ID) LOOP 
        IF ( :TEXT_FROM_DATE >= date_cur.from_date 
             AND :TEXT_FROM_DATE <= date_cur.to_date ) THEN ---- 
          Message('Overlaping of Dates is not allowed1'); 

          --EXIT; 
          RAISE form_trigger_failure; 
        END IF; 

        IF ( :TEXT_TO_DATE <= date_cur.to_date 
             AND :TEXT_TO_DATE >= date_cur.from_date ) THEN 
          Message('date is not allowd'); 

          --EXIT; 
          RAISE form_trigger_failure; 
        END IF; 
    END LOOP; 
END; 
but actual problem is
i this date range is
from date          to date
03-03-2013         10-03-2013

now if entered date between thse range work well but if i entered the date like from 01-03-2013 to 12-03-2013 for this it is not worked ...??????????????????
actualy i want to this is also should not enteredddddd

[EDITED by LF: formatted code, applied [code] tags]

[Updated on: Sat, 30 March 2013 09:28] by Moderator

Report message to a moderator

Re: Date overlaping check in form 10g [message #580964 is a reply to message #580960] Sat, 30 March 2013 08:48 Go to previous messageGo to next message
Michel Cadot
Messages: 57606
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" or "Preview Quick Reply" button to verify.

Regards
Michel
Re: Date overlaping check in form 10g [message #580969 is a reply to message #580964] Sat, 30 March 2013 09:31 Go to previous messageGo to next message
Littlefoot
Messages: 18822
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You'll have to broaden IF-THEN-ELSE and check all possibilities. For example:
if :text_from_date < date_cur.from_date then
   if :text_to_date < date_cur.to_date then
      ...
   else
      ....
   end if;
else
  if ...
Re: Date overlaping check in form 10g [message #580975 is a reply to message #580969] Sat, 30 March 2013 10:25 Go to previous messageGo to next message
irfankundi786@yahoo.com
Messages: 203
Registered: February 2009
Location: pakistan
Senior Member

please give me the actual code ...how i can handle it..
i paste my code.....how i can handle it to ovaid this problem????
Re: Date overlaping check in form 10g [message #580976 is a reply to message #580975] Sat, 30 March 2013 10:32 Go to previous message
irfankundi786@yahoo.com
Messages: 203
Registered: February 2009
Location: pakistan
Senior Member

please explain with example...
Previous Topic: How to call the canvas from Module A to Module B
Next Topic: Message from webutil
Goto Forum:
  


Current Time: Thu Apr 17 11:14:51 CDT 2014

Total time taken to generate the page: 0.13358 seconds