2.PLSQL writing simple stored procedures (incoming parameters, modify + print)

Source: Internet
Author: User

First, the table

Second, write the stored procedure

 1 Create or Replace procedureRaisesalary (aidinch  Number)--aid: Yes fix passed in Parameter name in: Yes indicates incoming parameter (and outgoing parameter) Number: is the data type 2  as 3Salaryfirst EMPLOYEE. SALARY%Type--define an original salary, type salary field type in the Employee table 4 begin 5   SelectSALARY intoSalaryfirst fromEMPLOYEEwhereEID=aid;6   UpdateEMPLOYEESetSALARY=SALARY+ - whereEID=aid;7Dbms_output.put_line ('The original is:'||Salaryfirst||'; After:'||(Salaryfirst+ -)); 8 End; 9 /Ten  One --Modify to commit a transaction? To!  A --However: Transactions are not typically committed and rolled back in stored procedures and functions, but are committed or rolled back in a program that is used outside.

Third, call the stored procedure (I found not to write a commit can also commit a transaction, as for why I do not know now, I should know later.) )

2.PLSQL writing simple stored procedures (incoming parameters, modify + print)

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.