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!

Can you provide only one default parameter in cursor from many defined?

Blue BirdJul 6 2018 — edited Jul 6 2018

I have cursor with more then one default parameter. If don't pass any, all default are aplied. If I pass all, then mine are used. But what if I want to pass only one of many? Can I do that in Oracle PL/SQL?

Can I do something like below using named parameters which doesn't compile (but work for example in Visual Studio)? I would like to pass only upper limit - in my case display only DepNo 10.

Declare

  Cursor c_Emp(p_MinDeptNo Number := 10, p_MaxDeptNo Number := 30) Is

    Select *

    From Emp

    Where DeptNo Between p_MinDeptNo And p_MaxDeptNo;

Begin

  For rec in c_Emp(p_MaxDeptNo := 10) Loop

    DBMS_OutPut.Put_Line('Emp: ' || rec.Ename); -- Process records

  End Loop;

End;

/

BB

This post has been answered by Solomon Yakobson on Jul 6 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 3 2018
Added on Jul 6 2018
5 comments
634 views