Error PLS-00103 compiling user-defined function in Oracle -
I am trying to create a user-defined function in Oracle which will return on DATE, when a date sub-word Giving a text argument will be given. I have tried some ways of writing this, and all start throwing the same error:
create or function lm_date_convert REPLACE (lm_date_in (50) in VARCHAR2) Date of return determinant returns (IS TO_DATE (REGEXP_REPLACE (lm_date_in, '([[digits:]] {2}) [- /.] * ([[Issue:]] {2}) [- /.] * ([[: Points :]] {4}) ',' \ 3- \ 1- \ 2 '),' YYYY-MM-DD '); End;
Error:
compiled Lm_date_convert function 1/46
PLS-00103: symbol "(" While expecting one of the following: < / P>: =.), Indicating "% of the default character emblem" "symbol": = "was replaced for" ("to continue.
Any ideas on this, and general UDF writing tips (and good references) are welcome!
We restrict datatype The parameters can not be specified in time stored procedures. That is, just use VARCHAR2 instead of VARCHAR2 (50).
Just to prove I 'm your problem arises ... < / P>
SQL> Create or function lm_date_convert REPLACE (lm_date_in (50)) in VARCHAR2 2 Date of return deterministic 3 4 Returns (TO_DATE (REGEXP_REPLACE (lm_date_in, '([[: Numbers:]] {2}) - * ([[:: points:]] {2}) [/.] [- /.] * ([[:: Points:]] {4}) ',' \ 3 \ 1- \ 2 '),' YYYY-MM-DD '); 5 end, 6 / warning. Compile errors with SQL & gt; function; Errors for ShoAnmin Function LM_DATE_CONVERT: Line / COL Error ---------------------------------------- ------------------------------------ 1/4 PLS-00103: Symbol "(" One of the following Expected: =), @% default character symbol ": =" was replaced to continue "(". "> SQL
to fix it now :
SQL & gt; ed 1 afiedt.buf file can be written or REPLACE FUNCTION lm_date_convert (in VARCHAR2 lm_date_in) 2 return date deterministic 3 start 4 profit i.e. (TO_DATE (REGEXP_REPLACE) (Lm_date_in, '([ [: Points:]] {2}) [- /.] * ([[: Issue:]] {2}) [- /.] * ([[: Issue:]] {4}) ',' \ 3- \ 1- \ 2 '),' 5 'end, SQL> Create 1 or function lm_date_convert REPLACE (lm_date_in in VARCHAR2) 2 return date deterministic 3 start 4 profit ie (TO_DATE (REGEXP_REPLACE (lm_date_in, '([[digits:]] {2}) [- /.] * ([[:: Digits:]] {2}) [- /.] * ([[: ]] {4}) ',' \ 3 \ 1- \ sql>
"If you really want a VARCHAR2 (50)) then Announce a type of VARCHAR2 (50) and use the type. "
Declaring a SQL TYPE to implement shaping is a bit of overkill. The YPE in PL / SQL but their size does not actually apply to stored process signatures. There are ways to work in this form.
On the one hand, why are you using Reggae to solve this problem? Or rather, what problem do you try to solve? Which are TO_CHAR and TO_DATE Sector can not be solved with? Format very forgiving of Oracle with masks
Comments
Post a Comment