Create, debug, invoke stored procedures in PL/SQL

Source: Internet
Author: User

Description of the function used
Function: Summation and difference
Prototype: Getsumandsub (P1 in number, p2 in number, m out number, b out number)
Parameters: M=p1+p2 B=P1-P2
1. Build the stored procedure first
The Browse window on the left selects procedures, which lists all stored procedures, right-click the folder procedures the menu "new", pops up
Template wizard window, enter getsumandsub in the Name box, fill in Parameters: P1 in number, p2 in number, m
Out number, and b out number. Click OK and the Code window for creating the stored procedure appears on the right. The content is the statement that creates the stored procedure. Enter the specific content between Begin end, as follows;
Create or Replace procedure Getsumandsub (P1 in number, p2 in number, m out number, b out
Number) is
M: = P1+P2;
B: = P1-P2;
End Getsumandsub;
Click the "Save" button to save the SQL statement that created the stored procedure in the file, which is used as a ^_^ and then to execute the SQL statement to create the stored procedure. Find the "gear" icon on the toolbar, and the mouse will show
' EXECUTE (F8) ', click on it. The stored procedure is now complete. But why can't I see this stored procedure in the Procedures folder on the right? Refresh the ok~, please.
2. Test stored Procedures
In the left navigation window, select getsumandsub the stored procedure, right click on the menu "Test" and a new test window will appear on the right.
Note: Below the test window you can see that there is a list of parameters, as input parameter values and view out parameter values with a toolbar above the debug code:
First Magnifier (Start debugger), start debugging.
The second green triangle (run) executes.
A third step into, one-step debugging.
After entering the Debug Code window, you can set breakpoints at will, it is needless to say ~
A We want to enter two parameter values in the Parameters window, p1 is 6,p2 4, M and b do not fill.
b Click Start Debugger, enter the code window for the stored procedure
C Click on Step into to place the mouse on the variable symbol to see the value of the variable
D continue clicking Step into until you are finished. The test window is returned.
E View the parameter list and verify that the M,b value is 8, 4.
Click Save in the Test window to save the test code. When you reopen it later, the values of the parameters you have entered are saved, so that you don't have to re-enter the parameter values for each test.
For parameters with a return type of cursor, the data is not displayed directly, there is a button to the right of the list's parameter value box, and clicking on it will pop up a

3. Calling stored procedures in Oracle

P1 VARCHAR2 (100);
P2 VARCHAR2 (100);
P3 VARCHAR2 (100);
p1:= ' DD ';
p2:= ' 3 ';
TestProcedure (P1,P2, ");

Article reprint self-management network:


Create, debug, invoke stored procedures in PL/SQL

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: 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.