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.