In the previous modules, you learned to create three different types of PL/SQL stored objects: functions, procedures, and triggers.
A later lesson covers a fourth type of stored object: the PL/SQL package. This lesson covers how to use a parameter in a procedure.
There are three modes of parameters:
- IN: A parameter that comes into a PL/SQL stored object. It cannot be modified within the object.
- OUT: A parameter that is sent from the PL/SQL stored object to the executing environment. It can be modified within the object.
- IN OUT: A parameter that is brought into the PL/SQL stored object and also sent out. It can be modified within the object.
The following
series of images shows you the syntax for using parameters with a procedure, a sample of a procedure that specifies parameters, and then shows you the three methods that can be used to specify parameters when calling the procedure.
- This shows the syntax of placing parameters into a procedure.
- Here is a partial example of a procedure containing parameters.
- Here is a partial example of a PL/SQL block that calls the DO_ADDRESS procedure.
- There are actually three ways to specify the parameters when calling a procedure.
- An advantage to this method is that the actual names of the parameters in the called procedure are not used,
- An advantage to this method is that the actual names of the parameters in the called procedure are not used,
- The third method of specifying parameters is by using a mixture of position and assignment methods.
As described in the
series of images above, you can call a procedure and list the parameters needed by using any of three methods. The most common method is first, where you list each parameter value in the same order as it is defined in the procedure.
The next lesson explores use of parameters and the RETURN command in a function.