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!

Using Default Parameter values with Functions or Procedures?

davejjjMar 20 2013 — edited Mar 21 2013
If you have a procedure or function that has DEFAULT values declared for some of the parameters how do you call that function or procedure when you want to use some of the default values? I tried...

myProcedure(202,,);
myProcedure(202,'','');
myProcedure(202,null,null);
myProcedure(job_id=202);
myProcedure(job_id=>202);

None of the above worked.

PROCEDURE add_job (job_id IN jobs.job_id%TYPE
,job_loc IN jobs.job_location%TYPE DEFAULT 145
,mgr_id IN jobs.mgr_id%TYPE DEFAULT 30
);

Thanks.

EDIT -- Let me say this is a simplified example. Please imagine a much larger parameter list with perhaps half having DEFAULT values. Thanks.

PROCEDURE myProcedure (job_id IN jobs.job_id%TYPE
,job_loc IN jobs.job_location%TYPE DEFAULT 145
,mgr_id IN jobs.mgr_id%TYPE DEFAULT 30
,init_id IN jobs.init_id%TYPE
,sal_id IN jobs.sal_id%TYPE DEFAULT 100
,clock_id IN jobs.clock_id%TYPE DEFAULT 'A'
,shift_id IN jobs.shift_id%TYPE
,lot_id IN jobs.lot_id%TYPE DEFAULT 'BACK'
);

Edited by: davejjj on Mar 20, 2013 4:47 PM
This post has been answered by Peter Gjelstrup on Mar 20 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 18 2013
Added on Mar 20 2013
8 comments
18,522 views