SQL _ write a simple Stored Procedure for deleting employee information, SQL stored procedure
Original Works are from the blog of "Deep Blue blog". You are welcome to reprint them. Please note the following source when reprinting them. Otherwise, you will be held legally liable for copyright.
Deep Blue blog:Http://blog.csdn.net/huangyanlong/article/details/43938953
Start the experiment:
(1) query raw data and use scott users for testing
SQL> select t. *, t. rowid from EMP t
(2) Compile and execute the stored procedure as follows:
Create or replace procedure P_delete_Empno (empid innumber) is
Begin
Delete from emp where emp. empno = empid;
Commit;
End P_delete_Empno;
-- Parameter description
-- P_delete_Empno indicates the name of the stored procedure
-- Empid in number indicates the parameter in the stored procedure, which is defined as the number type.
-- Begin and end are keywords for the start and end of a stored procedure.
(3) Test the Stored Procedure
SQL> select * from emp;
-- Query data. The employee information with employee number 7902 exists as follows:
Execute the following operations in the Command window:
SQL> execute p_delete_empno (7902 );
SQL> select * from emp;
-- Initiate a query again. The employee information with employee number 7902 does not exist anymore.
So far, a simple demonstration of how to delete employee information based on employee numbers has been completed.
Original Works are from the blog of "Deep Blue blog". You are welcome to reprint them. Please note the following source when reprinting them. Otherwise, you will be held legally liable for copyright.
Deep Blue blog:Http://blog.csdn.net/huangyanlong/article/details/43938953