A Validation pblm in Forms [message #79806] |
Mon, 15 July 2002 11:18 |
Deepa
Messages: 269 Registered: November 2000
|
Senior Member |
|
|
I have a field "Social Security Number" which is Number(9) field.I need to validate this field!
A sequence of like digits in SSN (eg., 111111111 or 222222222 or likewise) is invalid!
I need the code for validation in Forms 6i!!!!
If I extract using SUBSTR in a loop,then it works for 111111111 but it gives wrong message for valid SSNs like 113467859 since it finds that the (first digit-second digit) is Zero!
Pls let me know if anybody knows how to validate this!
|
|
|
|
Re: A Validation pblm in Forms [message #79829 is a reply to message #79806] |
Wed, 17 July 2002 01:22 |
UMA MAHESWARA RAO
Messages: 9 Registered: December 2001
|
Junior Member |
|
|
hello
execute the following in the when-validate-item trigger
DECLARE
TEMP1 NUMBER := &SSN;
TEMP_1 NUMBER := 0;
TEMP_2 NUMBER := 0;
TEMP_3 NUMBER := 0;
TEMP_4 NUMBER := 0;
TEMP_5 NUMBER := 0;
TEMP_6 NUMBER := 0;
TEMP_7 NUMBER := 0;
TEMP_8 NUMBER := 0;
TEMP_9 NUMBER := 0;
TEMP3 NUMBER := 0;
BEGIN
TEMP3 := LENGTH(TEMP1);
FOR I IN 1..TEMP3
LOOP
IF SUBSTR(TEMP1,I,1)=1 THEN
TEMP_1 := TEMP_1 + 1;
ELSIF SUBSTR(TEMP1,I,1)=2 THEN
TEMP_2 := TEMP_2 + 1;
ELSIF SUBSTR(TEMP1,I,1)=3 THEN
TEMP_3 := TEMP_3 + 1;
ELSIF SUBSTR(TEMP1,I,1)=4 THEN
TEMP_4 := TEMP_4 + 1;
ELSIF SUBSTR(TEMP1,I,1)=5 THEN
TEMP_5 := TEMP_5 + 1;
ELSIF SUBSTR(TEMP1,I,1)=6 THEN
TEMP_6 := TEMP_6 + 1;
ELSIF SUBSTR(TEMP1,I,1)=7 THEN
TEMP_7 := TEMP_7 + 1;
ELSIF SUBSTR(TEMP1,I,1)=8 THEN
TEMP_8 := TEMP_8 + 1;
ELSIF SUBSTR(TEMP1,I,1)=9 THEN
TEMP_9 := TEMP_9 + 1;
ELSE
NULL;
END IF;
END LOOP;
IF TEMP_1 = TEMP3 THEN
DBMS_OUTPUT.PUT_LINE('ONES');
ELSIF TEMP_2 = TEMP3 THEN
DBMS_OUTPUT.PUT_LINE('TWOS');
ELSIF TEMP_3 = TEMP3 THEN
DBMS_OUTPUT.PUT_LINE('THREES');
ELSIF TEMP_4 = TEMP3 THEN
DBMS_OUTPUT.PUT_LINE('FOURS');
ELSIF TEMP_5 = TEMP3 THEN
DBMS_OUTPUT.PUT_LINE('FIVES');
ELSIF TEMP_6 = TEMP3 THEN
DBMS_OUTPUT.PUT_LINE('SIX');
ELSIF TEMP_7 = TEMP3 THEN
DBMS_OUTPUT.PUT_LINE('SEVEN');
ELSIF TEMP_8 = TEMP3 THEN
DBMS_OUTPUT.PUT_LINE('EIGHT');
ELSIF TEMP_1 = TEMP3 THEN
DBMS_OUTPUT.PUT_LINE('NINES');
ELSE
DBMS_OUTPUT.PUT_LINE('NOTHING OF THE ABOVE');
END IF;
END;
bye
uma
|
|
|
|