Oracle stored procedure notation.

Source: Internet
Author: User
Tags goto

Create or Replace procedure Testwzm (V_GDJDM in varchar2) is
v_id VARCHAR2 (10);
V_xlname varchar2 (100);
V_count number (4);
Begin
v_count:=0;

Defining cursors
DECLARE CURSOR line_cur is
Select Line_code,line_name from Ods_yx.line where GDJDM=V_GDJDM and rownum<10;

Custom internal exception error. (if it is a defined error within Oracle, it cannot be defined again.) )

Zfcd_error exception;
pragma exception_init (zfcd_error,-06502);


Begin
For My_data in Line_cur loop

The process exception module requires a BEGIN end;
Begin
V_id:=my_data.line_code;

Handles the ora06502 exception module.
Exception when Zfcd_error then
V_id:=substr (My_data.line_code, 1, 5);
Dbms_output.put_line (' Unexpected ' | | V_ID);
End
V_xlname:=my_data.line_name;
v_count:=v_count+1;
Dbms_output.put_line (v_id| | V_xlname);
If V_count=6 Then
Goto Line6//Jump out of the loop to Line6 for data processing.
Elsif V_count=9 Then
Begin
Select Line_name into V_xlname from Ods_yx.line where line_code=v_id;
Dbms_output.put_line (' Hahaha ' | | V_xlname);
Exception when No_data_found then
Dbms_output.put_line (' No_data_found ');
End
End If;

End Loop;
End

Defines external goto processing content.
<<line6>>
Dbms_output.put_line (' I am line 6666 ');
End TESTWZM;

Oracle stored procedure notation.

Related Article

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.