Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meaning of PLSQL symbol "=>"

Tags:

What does the => symbol mean in PL/SQL? e.g.

GetAttrNumber(toitemtype => toitemtype,
              toitemkey => toitemkey,
              toactid => toactid)
like image 323
Arav Avatar asked Jun 08 '12 00:06

Arav


People also ask

What does => mean in PLSQL?

That is the keyword/value notation for passing parameters to a PL/SQL procedure or function. The left side is the name of the parameter, the right is the value being passed. It's useful when you don't want to keep to a specific ordering of parameters, or for self-documenting code.

How do you write greater than or equal to in PLSQL?

In Oracle, you can use the >= operator to test for an expression greater than or equal to. SELECT * FROM suppliers WHERE supplier_id >= 1000; In this example, the SELECT statement would return all rows from the suppliers table where the supplier_id is greater than or equal to 1000.

What are PLSQL expressions?

An expression is a combination of one or more values, operators, and SQL functions that evaluate to a value. An expression generally assumes the data type of its components. Expressions have several forms. The sections that follow show the syntax for each form of expression.


2 Answers

That is the keyword/value notation for passing parameters to a PL/SQL procedure or function.

The left side is the name of the parameter, the right is the value being passed.

It's useful when you don't want to keep to a specific ordering of parameters, or for self-documenting code.

like image 57
DCookie Avatar answered Sep 24 '22 06:09

DCookie


The keyword/value notation can be very useful if you have a long list of parameters and only need to specify subset of them. Especially if you want to skip some of the parameters in the middle of the list of parameters (this requires the skipped parameters to use DEFAULT values). As an example if you have a procedure like this:

PROCEDURE my_proc(
    p_param1  NUMBER DEFAULT 1
  , p_param2  NUMBER DEFAULT 2
  , p_param3  NUMBER DEFAULT 3
  , p_param4  NUMBER DEFAULT 4
  , p_param5  NUMBER DEFAULT 5 
);

Now you can call my_proc() only with only first and last parameter,

my_proc(p_param1 => value1, p_param5 => value2);

like image 32
Peter Å Avatar answered Sep 23 '22 06:09

Peter Å