Note Although stored functions can accept both input and output parameters in the parameter list, they only support input parameters and must return one and only one value if referenced from aSELECTstatement. Therefore, when declaring input parameters for stored functions, be sure to include just the name and type if you are only going to reference the stored functions fromSELECTstatements. Oracle best practices discourages the use of function parameters returning values to the calling program; if you must return more than one value from a subprogram, a stored procedure is more suitable. Perhaps not surprisingly, the datatypes supported as parameters or return values for stored procedures correspond to those supported by Oracle, plus a few specific to PL/SQL. Therefore, you’re free to declare a parameter to be of any datatype you might use when creating a table. To declare a parameter’s purpose, use one of the following three keywords:
Consider the following example to demonstrate the use ofINandOUT. First, create a stored procedure calledRAISE_SALARYthat accepts an employee ID and a salary increase amount and returns the employee name to confirm the salary increase: create PROCEDURE raise_salary Next, use an anonymous PL/SQL block to increase the salary of employee number 105 by $200 per month: DECLARE The results are as follows: -------------------------------------------- Statement processed.
blog comments powered by Disqus |