The end-user is prompted to enter a value. What I need to do is to check that they have entered the correct data. Hence check that it is either a date, number etc and give a warning message to the end-user if they enter incorrect data.
Not really. You must make up your own functions. If you send your variable out to your custom IsNumber function and it converts to a number, fine and return True. If it fails, then you know it is not a number and return false. Easy. But, Date is another matter. You must either force your user to enter one type of date format, or you must check all possible formats. I did something like that, had a Package that defined an array with possible date formats, then had a function that checked this array. So, the check date function could look like:
FUNCTION IsDate_Fun (InDateString IN VARCHAR2)
RETURN BOOLEAN IS
TempDate DATE;
Mask_Index PLS_INTEGER := 0;
BEGIN
Mask_Index := DateFmts.FIRST;
LOOP
EXIT WHEN Mask_Index IS NULL;
BEGIN
ReturnDate := TO_DATE
(InDateString, DateFmts(Mask_Index));
RETURN TRUE;
EXCEPTION
WHEN OTHERS THEN
Mask_Index := DateFmts.NEXT (Mask_Index);
END;
END LOOP;
RETURN FALSE;
END IsDate_Fun;
/
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.