I am trying to execute this code in Oracle 10 SQL Developer:
Function _ is_valid_date (P-Aval VARCHAR2, p_format IN VARCHAR2) returns numeric IS__date VARCHAR2 (100); BEGIN__date: = TO_date (p_val, p_format); Return1; Exceptions while others 0; END is_valid_date; BEGIN DBMS_OUTPUT.PUT_LINE (is_valid_date ('20120101,' 'YYYYMMDD')); End;
But I get a typical error without any specific oracle code, such as this is a syntax problem.
I have to check that a date is valid and for this there is no Oracle built in the function, I have defined it in my script (I do not want to store it global or anywhere).
Edit:
I have found a solution on an oracle forum, using the oracle rezxpea instead of a function. My script is: Select <*>
from mytable * REEGXAPILIEE (Medetfield, '((([[0-9-9] | [12] \ D | 3 [01]) \. [13578] ] | [[02]) \ ((19 | [2-9] \ d). \ D {2}) | | ((0 [1-9] | [12] \ d | 30) \. (0 [13,456,789] | 1 [012]). ((19 | [2-9] \ d) \ d {2}) | (| (0 [1-9] | 1 \ d | 2 [0 -8] ]) \ 02 \. ((19 | [2-9] \ d) \ d {2}) | (29 \ .02 \ (([[6-9] | [2- 9] \ D) (0 [48] | [2468] [048] | [13579] [26]) | ((16 | [2468] [4 9 8] | [3579] [26]) 00))))) 'end;
where DD.MM.YYYY is in the Maidetfield format
If this is your complete script, then you are lost:
The function function is ___ valid_date (p_val in para_a, p_format IN VARCHAR2) return numeric IS__date VARCHAR2 (100); BEGIN__date: = TO_date (p_val, p_format); Return1; Exceptions while others 0; END is_valid_date; BEGIN DBMS_OUTPUT.PUT_LINE (is_valid_date ('20120101,' 'YYYYMMDD')); End; / Anonymous block full 1
Without it you will get a series of errors started
... which I think is a 'common error' that you refer to.
Comments
Post a Comment