Home » Developer & Programmer » Forms » Restrict input & Problem in implementing condition (merged)
Restrict input & Problem in implementing condition (merged) [message #389111] Fri, 27 February 2009 05:40 Go to next message
gozuhair
Messages: 206
Registered: January 2008
Senior Member
Dear all

pleas help me for the following situation.

I have a table name as scrap_mst with the following structure.

 FROM_DT                                  DATE
 TO_DT                                    DATE
 REF_NO                                   VARCHAR2(20)

with the following data.

01-JAN-05 31-DEC-05 SVC/TS/1235
01-MAR-06 30-JUN-06 SVC/TS/4444

now i want to restrict user to input the date in "to_dt" column in form level.means user cannot input the date range (already exist in scrap_mst table) between the following values
01JAN05 TO 31DEC05
01MAR06 TO 30JUN06

but can input the values not in a range of above values like
01JAN06 TO 28FEB08
01JAN07 TO 31DEC08


kindly suggest how can i implement the above codition.
I have implemented the following code in a to_date column of forms 6i on when validate item but its not working and give error "bad bind variable 'scrap_mst.to_dt".

Declare
	cursor c1 is select	from_dt,to_dt
	from scrap_mst;
dt1 date;
dt2 date;
Begin
	open c1;
	loop
	fetch c1 into dt1,dt2;
	if :scrap.mst.to_dt between c1.from_dt and c1.to_dt then
	show_common_message('Already exist ......');
	Else
	null;
	End if;
	exit when c1%notfound;
	

	end loop;
	close c1;
End;



please suggest





Re: Restrict input [message #389123 is a reply to message #389111] Fri, 27 February 2009 05:59 Go to previous messageGo to next message
cookiemonster
Messages: 13963
Registered: September 2008
Location: Rainy Manchester
Senior Member
:scrap.mst.to_dt 


Why two dots?
Re: Restrict input [message #389268 is a reply to message #389111] Fri, 27 February 2009 22:38 Go to previous messageGo to next message
gozuhair
Messages: 206
Registered: January 2008
Senior Member
Thanks,its working actually i have added the following code in order to restrict user input and also fix the above error.

Declare
	cursor c1 is select	from_dt,to_dt
	from scrap_mst;
dt1 date;
dt2 date;
Begin
	open c1;
	loop
	fetch c1 into dt1,dt2;
	if :scrap_mst.to_dt between dt1 and dt2 
	or :scrap_mst.from_dt between dt1 and dt2 then
--	or :scrap_mst.from_dt between dt1 and dt2 then
	show_common_message('Already exist ......');
	raise form_trigger_failure;
	Else
	null;
	End if;
	exit when c1%notfound;
	

	end loop;
	close c1;
End;





Once again thank you very much
Re: Problem in implementing condition [message #389659 is a reply to message #389111] Tue, 03 March 2009 00:57 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
In the PL/SQl supported by Forms 6 you can't do the test as an 'IF' statement.

Build the ':scrap.mst.to_dt' into the cursor and return something like 'X' in a variable like 'lv_result' if the range is not good and then use a test like 'c1.lv_result='X'' in your 'IF' statement.

David
Previous Topic: Unable to run forms
Next Topic: connect oracle form to ms access database
Goto Forum:
  


Current Time: Tue Feb 11 03:37:21 CST 2025