Error in Package containing function

Oracle database administration questions.

Error in Package containing function

Postby alex » Tue Sep 11, 2012 1:01 am

Hi, Here is my package that i am getting error - "PLS-00103: Encountered the symbol "=" when expecting one of the following"

create or replace package pre_pkg
is

FUNCTION FUN_DATE (a_date date)
RETURN number;

end pre_pkg;

create or replace package body pre_pkg
is

function FUN_DATE (a_date date)
return number
is

BEGIN

IF REGEXP_LIKE(a_date,'^\d{1}|d{2}/\d{1}|d{2}/\d{4} \d{2}:\d{2}:\d{2}.\d{3}$')
AND (REGEXP_INSTR(a_date,'[AP]M',1)=0
AND LENGTH(a_date) > 11
AND LENGTH(TRUNC(to_char(TO_TIMESTAMP(a_date,'MM/DD/YYYY HH24:MIS.FF'),'YYYY')))=4)
THEN
return := 0;

ELSIF REGEXP_LIKE(a_date,'^\d{1}|d{2}/\d{1}|d{2}/\d{4} \d{2}:\d{2}:\d{2} [AP]M$')
AND (REGEXP_INSTR(a_date,'[AP]M',1) > 0
AND LENGTH(TRUNC(to_char(TO_DATE(a_date,'MM/DD/YYYY HH:MIS AM'),'YYYY')))=4)
THEN
return := 0;

ELSIF REGEXP_LIKE(a_date,'^\d{1}|d{2}/\d{1}|d{2}/\d{4}$')
AND (REGEXP_INSTR(a_date,'[AP]M',1)=0
AND LENGTH(TRIM(a_date)) < 11
AND LENGTH(TRUNC(to_char(TO_DATE(a_date,'MM/DD/YYYY'),'YYYY')))=4)
THEN
return := 0;
ELSE
return := 1;

END IF;

EXCEPTION
WHEN OTHERS THEN
return := 1;

END FUN_DATE;

END pre_pkg;
/

Can any one help me in this regard. I am using oracle 10g.
alex
 
Posts: 6
Joined: Tue Jul 14, 2009 9:43 am

Invitations sent: 0
Successful invitations: 0

Re: Error in Package containing function

Postby marian » Tue Sep 11, 2012 1:08 am

I think RETURN statement should not contain " :="
marian
Site Admin
 
Posts: 16
Joined: Tue Jul 14, 2009 9:13 am

Invitations sent: 15
Successful invitations: 2


Return to Oracle Administration

Who is online

Users browsing this forum: No registered users and 1 guest

cron