Skip to Main Content
  • Questions
  • Proper terminology for named parameter passing or the => operator

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, George.

Asked: November 10, 2021 - 3:20 pm UTC

Last updated: November 12, 2021 - 5:08 pm UTC

Version: 19c

Viewed 1000+ times

You Asked

What is the proper terminology used for the => operator and for named
parameter passing in general. (Feature was apparently introduced in Oracle 10g. I'm using Oracle 19c).

Trying to search for => in most search engines is a total nightmare. Bing doesn't even find anything. Google finds about 1 article in Stack Overflow.

The feature is extremely useful if you have huge parameter lists in any functions or procedures. Obviously, that does beg the question why.

Here is an example.


UTL_MAIL.SEND(  sender      => p_sender,
                recipients  => p_recipient,
                cc          => p_cc,
                subject     => v_subject,
                message     => p_message || sysdate,
                mime_type   => 'text/plain; charset=ascii');


and Connor said...

We call them "named" parameters.

If you didn't name them, we interpret them in the order they are presented, hence we call them "positional" parameters.

You can even mix and match, and we call that ..... (drum roll :-)) "mixed" parameters.

All the details are here:

https://docs.oracle.com/en/database/oracle/oracle-database/21/lnpls/plsql-subprograms.html#GUID-A5DA8CF5-1BCC-4ABE-9B68-DB593FF1D2CC

(and yes I agree , I didn't google search for that, because its hard to do so)

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

also in 9i

Anton Scheffer, November 12, 2021 - 11:34 am UTC

A quick google search( looking for the old PLSQL docs) reveals that even before Oracle 10g the terms mixed, positional and named parameters where used: https://docs.oracle.com/cd/B10501_01/appdev.920/a96624/08_subs.htm#853 or https://docs.oracle.com/cd/A87860_01/doc/appdev.817/a77069/07_subs.htm#853
Chris Saxon
November 12, 2021 - 5:08 pm UTC

Nice research

regardng the "mix" and "match"

Rajeshwaran, Jeyabal, November 12, 2021 - 2:07 pm UTC

Regarding the mix of "named" and "position" parameter, we need to understand this.
if we start with "position" parameter then we can have "named" parameters in-between.
but not the otherway around.
demo@XEPDB1> exec dbms_stats.gather_table_stats(user,'T',cascade=>true);

PL/SQL procedure successfully completed.

demo@XEPDB1> exec dbms_stats.gather_table_stats(ownname=>user,'T',cascade=>true);
BEGIN dbms_stats.gather_table_stats(ownname=>user,'T',cascade=>true); END;

                                                  *
ERROR at line 1:
ORA-06550: line 1, column 51:
PLS-00312: a positional parameter association may not follow a named association
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored


Chris Saxon
November 12, 2021 - 5:08 pm UTC

Good point

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library