How to restrict input data [message #355481] |
Fri, 24 October 2008 06:40 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
sreejithmenon
Messages: 15 Registered: October 2008
|
Junior Member |
|
|
Hi all,
I'm developing an application in Oracle-Forms9i and facing a problem now.
My table is,
CREATE TABLE ABC
QUESTION VARCHAR2(100),
ANS_TYPE VARCHAR2(2),
START_RANGE VARCHAR2(10),
END_RANGE VARCHAR2(10);
Based on this table I've created a form. The ans_type can take either of the following values from an LOV; AlphaNumeric(AN) and Numeric(NM).
The concept is that when i insert data, if i select NM as ans_type, then values acceptable in start_range and end_range also should be of datatype Numeric. And if i select AN as answer_type, vise versa.
Please show me a way.
Thanks in advance.
|
|
|
Re: How to restrict input data [message #355488 is a reply to message #355481] |
Fri, 24 October 2008 07:57 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
I guess that WHEN-VALIDATE-ITEM triggers on both "start_range" and "end_range" items should check whether the value entered into the item is a number or a character string.
As there's no function like "is_number" or "is_string", you'll have to write one (or both) by yourself. Testing for a number is relatively easy - check what TO_NUMBER returns; if it is a valid number, fine. If not, raise an exception.
A string might then be "everything that is not a number" (possibly).
|
|
|