ParametersParameters are the means to pass values to and from the calling environment to the server. These are the values that will be processed or returned via the execution of the procedure. There are three types of parameters: IN, OUT, and IN OUT. ModesModes specify whether the parameter passed is read in or a receptacle for what comes out. Figure 12.1 illustrates the relationship between the parameters when they are in the procedure header versus when the procedure is executed. Figure 12.1. Matching Procedure Call to Procedure Header
Formal and Actual ParametersFormal parameters are the names specified within parentheses as part of the header of a module. Actual parameters are the values ”expressions specified within parentheses as a parameter list ”when a call is made to the module. The formal parameter and the related actual parameter must be of the same or compatible datatypes. Table 12.1 explains the three types of parameters. Passing of Constraints (Datatype) with Parameter ValuesFormal parameters do not require constraints in datatype ”for example, instead of specifying a constraint such as VARCHAR2(60), you just say VARCHAR2 against the parameter name in the formal parameter list. The constraint is passed with the value when a call is made. Matching Actual and Formal ParametersTwo methods can be used to match actual and formal parameters: positional notation and named notation. Positional notation is simply association by position: The order of the parameters used when executing the procedure matches the order in the procedure's header exactly. Named notation is explicit association using the symbol =>. Table 12.1. Three Types of Parameters
Syntax: formal_parameter_name => argument_value In named notation, the order does not matter. If you mix notation, list positional notation before named notation. Default values can be used if a call to the program does not include a value in the parameter list. Note that it makes no difference which style is used; they will both function similarly. |