oracle| Stored Procedures
I do not know how to debug a stored procedure when I write it. One way to debug this is to print out the value of a variable in a program that I print on the console in Java. Here's how to do this from the Sqlplus.
1, execute "set serveroptput on" command on Sqlplus
2, in the stored procedure can use Dbms_output. Put_Line (VarName); To print out
Give an example of a stored procedure:
Create or replace procedure test is
Emp_name VARCHAR2 (10);
Cursor C1 is SELECT ename from EMP
WHERE Deptno = 20;
BEGIN
OPEN C1;
LOOP
FETCH C1 into Emp_name;
EXIT when C1%notfound;
Dbms_output. Put_Line (Emp_name);
End LOOP;
End test;
The background creates test this stored procedure, compiles it, takes Scott/tiger account entry, executes set serveroptput on, and executes "exec test"
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