Reputation: 41
DECLARE
price_to_update NUMBER(6,2) := 20;
updated_price NUMBER(6,2) := 0;
BEGIN
dbms_output.put_line('price before ' || price_to_update);
dbms_output.put_line('updated_price before ' || updated_price);
changePrice (old_price => price_to_update, new_price => updated_price);
dbms_output.put_line('price_to_update after update ' || price_to_update);
dbms_output.put_line('updated_price after update ' || updated_price);
END;
/
in this example user is using => symbol i am unable to figure out for what purpose user using it ... KIndly Help me out ... thanks
Upvotes: 4
Views: 274
Reputation: 146460
It's the named notation for subprogram parameters (vs. positional notation). This syntax allows to:
Example:
PROCEDURE FOO(A VARCHAR2:=NULL, B VARCHAR2:=NULL, C VARCHAR2:=NULL)
... can be called as:
FOO(C=>'FOO', A=>'BAR');
Upvotes: 8
Reputation: 132580
It is called "named parameter notation". If you have this procedure:
procedure changeprice (old_price number, new_price number);
then you can call it with positional notation:
changeprice (price_to_update, updated_price);
or you can call it with positional notation:
changeprice (old_price => price_to_update, new_price => updated_price);
See documentation for more details.
Upvotes: 3
Reputation: 262534
Oracle PL/SQL also supports called functions with named parameters (as opposed to positional parameters). This is what the => does.
Upvotes: 0