Home » Developer & Programmer » Forms » pl/sql looping
pl/sql looping [message #218129] Tue, 06 February 2007 23:14 Go to next message
vdsk
Messages: 41
Registered: February 2006
Location: India & UAE
Member
I have a Master_detail form & the detail block is like :-
From_time To_time
Before user commits , I need to validate that there r no
time clashes in each record. ie. all records should be unique
eg. From_Time in 2nd record should not be between From_time & to_time in first record or any record..
Pl tell what kind of pl/sql loop i should use.. (I amusing Form 6i over Ora 10g)

Re: pl/sql looping [message #218141 is a reply to message #218129] Tue, 06 February 2007 23:58 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Have a look at http://www.orafaq.com/forum/m/147107/67467/?srch=validate+master+detail+record+group#msg_147107

David
Re: pl/sql looping [message #218232 is a reply to message #218129] Wed, 07 February 2007 07:26 Go to previous messageGo to next message
vdsk
Messages: 41
Registered: February 2006
Location: India & UAE
Member
I went thru that link..but what I understood is is that it checks
the values against a table, but what I want is to compare & check the values within that block & user can save only if the 'From_time' is not between From & To time of all other records..I guess I have to loop thru each record and compare it with each other records..
eg:-
From_Time To_Time
9.00 11.00
10.30 12.00
13.00 15.00
Now if user tries to save , it should return error bcoz
row2 is violating row1..

Hope problem is clear..

Re: pl/sql looping [message #218604 is a reply to message #218232] Thu, 08 February 2007 23:18 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
The thread I pointed you to recommends using a record_group to hold the database entries and the data that has been recently entered but not yet commited.

The easiest method is to commit after ever record, but many people don't like doing that.

Yes you will have to loop through each record, but not the physical record in the block but the copy of their data in the record group.

To test the date/time you will have to find the maximum date/time that is less that this record's 'to_time' and make sure that the 'from_time' is greater that it. Then find the minimum date/time that is greater than the 'from_time' and make sure that the 'to_time' is less than it.

David
Previous Topic: PLD to PLL conversion
Next Topic: URGENT: 'FRM-40505: unable to perform query error
Goto Forum:
  


Current Time: Sun Dec 04 13:00:17 CST 2016

Total time taken to generate the page: 0.05292 seconds