![]() ![]() The procedure GRANT_RAISES applies an increase across the board to all employees. Increase_wage(emp_rec.employee_id, pct_increase, upper_bound) loop through each record in the employees tableĭBMS_OUTPUT.PUT_LINE(emp_rec.first_name || ' ' || emp_rec.last_name) SELECT employee_id, first_name, last_name CREATE OR REPLACE PROCEDURE grant_raises (pct_increase IN NUMBER, upper_bound IN NUMBER) ![]() Here's an example:ĮXEC different_schema.increase_wage(emp_rec.employee_id, pct_increase, upper_bound) Ī procedure can also be invoked from within another procedure by simply typing the name and placing the parameters inside parentheses, if there are any. In such a scenario, use dot notation to qualify the procedure name. It is also possible to execute a procedure that is contained within other schemas, if the current user has execute privileges on that procedure. Both the long and shortened versions will work. If you are running a single procedure from SQL*Plus, then using EXEC is certainly a good choice.Ī stored procedure can be executed using the EXEC keyword. Using this technique, invoking the stored procedure would resemble the following: BEGINīoth techniques work equally well, but the latter would be better to use if you wanted to execute more than one procedure or follow up with more PL/SQL statements. ![]() You can also execute a stored procedure by creating a simple anonymous block that contains the procedure call, as depicted in the following code: BEGIN This would invoke the INCREASE_WAGE procedure, passing three parameters: EMPLOYEE_ID, a percentage of increase, and an upper salary bound. Execute the procedure by issuing the following command: EXEC procedure_name() įor instance, to execute the procedure that was created in this blog, you would issue the following command: EXEC increase_wage(198. Open SQL*Plus, and connect to the database schema that contains the procedure you are interested in executing. You want to execute a stored procedure from SQL*Plus. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |