Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

procedure to pass default and handle null

spur230Aug 24 2016 — edited Aug 24 2016

I am using 12.1.0.2

I want to create a procedure that takes 1 date parameter with default sysdate. even if NULL is passed I want to treat it as sysdate.  

create or replace  procedure proc1(p_date date default sysdate)

as

begin

dbms_output.put_line(p_date)

end proc1;

exec proc1; -- > should return sysdate

exec proc1(NULL); --> should return sysdate

Is it possible to do it  in procedure declaration or do I have to  use NVL within body?

Thanks

This post has been answered by William Robertson on Aug 24 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 21 2016
Added on Aug 24 2016
9 comments
3,667 views