I have created a function which need input as month(11) and year(2018) and it will return the first Sunday of the next month.
Create or replace function get_effectivedate (par_Month in int,Par_Year in int);
Return date
Is
startDate varchar;
edate date;
begin
startDate := par_Month+Par_Year;
edate := select next_day(add_months(trunc(startDate, 'MM'), 1), 'Sunday') as EffectiveDate from dual;
return edate;
end;
This function is prompting me while running and it is throwing some errors on compilation.
Error:
LINE/COL ERROR
--------- -------------------------------------------------------------
7/1 PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following: := . ( @ % ; not null range with default character The symbol ";" was substituted for "BEGIN" to continue.
9/14 PLS-00103: Encountered the symbol "SELECT" when expecting one of the following: ( - + case mod new not null <an identifier> <a double-quoted delimited-identifier> <a bind variable> continue avg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date <a string literal with character set specification> <a number> <a single-quoted SQL string> pipe <an alternatively-quoted string literal with character set specification> <an alternat
11/2 PLS-00103: Encountered the symbol "RETURN"
Errors: check compiler log
Function GET_EFFECTIVEDATE compiled
LINE/COL ERROR
--------- -------------------------------------------------------------
7/1 PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following: := . ( @ % ; not null range with default character The symbol ";" was substituted for "BEGIN" to continue.
9/14 PLS-00103: Encountered the symbol "SELECT" when expecting one of the following: ( - + case mod new not null <an identifier> <a double-quoted delimited-identifier> <a bind variable> continue avg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date <a string literal with character set specification> <a number> <a single-quoted SQL string> pipe <an alternatively-quoted string literal with character set specification> <an alternat
11/2 PLS-00103: Encountered the symbol "RETURN"
Errors: check compiler log
Function GET_EFFECTIVEDATE compiled
LINE/COL ERROR
--------- -------------------------------------------------------------
7/1 PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following: := . ( @ % ; not null range with default character The symbol ";" was substituted for "BEGIN" to continue.
9/14 PLS-00103: Encountered the symbol "SELECT" when expecting one of the following: ( - + case mod new not null <an identifier> <a double-quoted delimited-identifier> <a bind variable> continue avg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date <a string literal with character set specification> <a number> <a single-quoted SQL string> pipe <an alternatively-quoted string literal with character set specification> <an alternat
11/2 PLS-00103: Encountered the symbol "RETURN"
Errors: check compiler log