PL/SQL Variable definition doesn't have reserved keyword

I have a valid PL/SQL code in the Declare section at one of code pieces at work. It looks like that

Name1 name2 := name3();

I have hard time to understand what or how this variable is defined. There are no reserved keywords in the line. I understand that Name1 is my variable name and name3() probably is a function that calculates a value and this value is being assigned in name2. I cannot understand how this fits with the expected syntax (after the variable name to have the type/length). Is it possible the name2 value to be the variable type (Number, Vatchar2 etc) and this to be defined from the function name3()? Any suggestions are appreciated.

Upvotes: 0

Views: 66

Answers (1)

Name2 is very definitely the variable type. PL/SQL variable definitions are always

variable_name  variable_type

and optionally an initialization, such as

:= some_value

Note that this is the opposite of what you'd find in C or one of its derivatives where variable definitions are typically

variable_type  variable_name1, variable_name2, etc;

Name2 might be a subtype defined earlier in the particular piece of code you're looking at or, if this is in a package body, might be defined in the package spec.

Share and enjoy.

Upvotes: 1

Related Questions