Home » Developer & Programmer » Forms » When-Validate-Item (Oracle 10g Forms Builder)
When-Validate-Item [message #533326] Tue, 29 November 2011 08:09 Go to next message
ShaneS
Messages: 2
Registered: November 2011
Junior Member
I am currently having trouble validating the item Vehicle_Reg_No
I have to ensure that it starts with a letter and ends with a number. The code below gives me the TRUCK_START but for every other scenario the form throws an unhandled exception. Any assistance will be appreciated.

DECLARE
TRUCK_START VARCHAR2(100);
TRUCK_END VARCHAR2(100);
NUM_ALERT NUMBER;
BEGIN
IF :M_ORDER_ITEMS.VEHICLE_REG_NO IS NOT NULL THEN
truck_start := substr (:M_ORDER_ITEMS.VEHICLE_REG_NO,1,1);
truck_end := substr (:M_ORDER_ITEMS.VEHICLE_REG_NO,-1,1);
truck_start:= to_number(truck_start,0);
truck_end := to_number(truck_end,0);

if((truck_start >=65 AND truck_start <=90) OR (truck_start >=97 AND truck_start <=122)and
(truck_end >=0 and truck_end <=9))then
message ('correct');


elsIF(not((truck_start >=65 AND truck_start <=90) OR (truck_start >=97 AND truck_start <=122)))THEN
MESSAGE(TRUCK_START);
elsIF(not (truck_end >=48 and truck_end <=57))THEN
MESSAGE(TRUCK_END);
END IF;
END IF;
END;

[Updated on: Tue, 29 November 2011 08:11]

Report message to a moderator

Re: When-Validate-Item [message #533327 is a reply to message #533326] Tue, 29 November 2011 08:15 Go to previous messageGo to next message
cookiemonster
Messages: 13926
Registered: September 2008
Location: Rainy Manchester
Senior Member
Looks like you're trying to check ascii codes without bothering to get them. To_number does not give ascii codes. The ascii function does.

And next time you post code can you please follow the instructions in How to use [code] tags and make your code easier to read?
Re: When-Validate-Item [message #533329 is a reply to message #533327] Tue, 29 November 2011 08:21 Go to previous message
ShaneS
Messages: 2
Registered: November 2011
Junior Member
Thank you. Sorry about the formatting, will rectify next time.
Previous Topic: Canvas Property && wait Property in Forms (merged 2)
Next Topic: How handover software???
Goto Forum:
  


Current Time: Wed Jul 10 08:30:17 CDT 2024