Sql_ writing a simple stored procedure to delete employee information

Source: Internet
Author: User

Original works, from the "Blue Blog" blog, Welcome to reprint, please be sure to indicate the following sources, otherwise, the legal responsibility to pursue copyright.

Deep Blue Blog: http://blog.csdn.net/huangyanlong/article/details/43938953

Start the experiment:

(1), query the original data, use the Scott user to conduct the experiment

sql> Select t.*, T.rowid from EMP T

(2), write the stored procedure and execute, as follows:

Create or Replace procedure p_delete_empno (empid in number) is

Begin

Delete from emp where emp.empno=empid;

commit;

End P_delete_empno;

-- parameter Description

--p_delete_empno represents the name of the Create stored procedure

--empid in number represents a parameter in a stored procedure, defined here as Number type

--begin , End keywords that start and end for a stored procedure

(3), test the stored procedure

sql> Select * from EMP;

-- query data, employee number is 7902 the employee information exists as follows

Perform the following actions in the command window:

Sql> Execute P_delete_empno (7902);

sql> Select  *   from EMP;

-- start the query again, the employee number is 7902 employee information no longer exists.

At this point, a simple stored procedure that deletes employee information based on the employee number has been demonstrated.

Original works, from the "Blue Blog" blog, Welcome to reprint, please be sure to indicate the following sources, otherwise, the legal responsibility to pursue copyright.

Deep Blue Blog: http://blog.csdn.net/huangyanlong/article/details/43938953

Sql_ writing a simple stored procedure to delete employee information

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.