Hello I am trying to set default value for my parameter in procedure.
First it was something like this.
PROCEDURE arpu
(
P_DATE VARCHAR2 DEFAULT NULL
)
AS
v_date VARCHAR2(10);
BEGIN
IF(p_date IS NULL) THEN
v\_date := TO\_CHAR(sysdate-1,'yyyymmdd');
ELSE
v\_date := p\_date;
END IF;
Meaning if I insert parameter value from my hand it will run that day otherwise sysdate -1 like below.
BEGIN
pk_unv_report.arpu('20200614');
end;
Now I want to change parameter value to
procedure arpu
(
p_date varchar2 default null
)
as
v_date varchar2(10);
begin
if(p_date is null) then
v_date:=to_char(LAST_DAY(ADD_MONTHS(SYSDATE,-1)),'yyyymmdd');
else
v\_date := p\_date ;
end if;
Meaning whether I insert parameter value or not it should run previous month last day value.
The problem is I seem to cant set p_date value to to_char(LAST_DAY(ADD_MONTHS(SYSDATE,-1)),'yyyymmdd')
It is giving me this error. Any solution for this one?
