当前位置:网站首页>How does Oracle use circular control keywords exit, goto, continue
How does Oracle use circular control keywords exit, goto, continue
2022-04-22 10:17:00 【=PNZ=BeijingL】

Catalog
4. oracle I won't support it break
1. exit Use
exit For jumping out of the loop , stay 10g and 11g Can be used normally
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL> begin
2 for i in 1 .. 20 loop
3 if (i = 5) then
4 exit;
5 end if;
6 dbms_output.put_line(i);
7 end loop;
8 end;
9 /
PL/SQL procedure successfully completed
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> begin
2 for i in 1 .. 20 loop
3 if (i = 5) then
4 exit;
5 end if;
6 dbms_output.put_line(i);
7 end loop;
8 end;
9 /
PL/SQL procedure successfully completed
2. goto Use
goto Can be in 10g and 11g Use , Some people say 11g It is wrong not to use a proven statement , goto How to use it is as follows
- <<next_step>> Is a circular label , The name can be customized , For example, the example can also be replaced with <<next>>
- When using goto next_step When , The program will jump to the defined <<next_step>> label
- <<next_step>> Can't follow end loop perhaps exception keyword , So use NULL separate
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL> begin
2
3 for i in 1 .. 20 loop
4 if (i > 5) then
5 goto next_step;
6 end if;
7 dbms_output.put_line(i);
8
9 <<next_step>> --goto Jump here and enter the next cycle
10 NULL;
11 end loop;
12
13 end;
14 /
PL/SQL procedure successfully completed
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> begin
2 for i in 1 .. 20 loop
3 if (i > 5) then
4 goto next_step;
5 end if;
6 dbms_output.put_line(i);
7
8 <<next_step>> --goto Jump here and enter the next cycle
9 NULL;
10 end loop;
11 end;
12 /
PL/SQL procedure successfully completed
3. continue Use
continue Used to continue the next cycle , continue Keywords are 11g increase , So in Oracle 10g When used in, it will prompt No statement CONTINUE
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL> begin
2 for i in 1 .. 20 loop
3 -- Judge
4 if (i = 5) then
5 continue;
6 end if;
7 dbms_output.put_line(i);
8 end loop;
9 end;
10 /
ORA-06550: line 6, column 7:
PLS-00201: identifier 'CONTINUE' must be declared
ORA-06550: line 6, column 7:
PL/SQL: Statement ignored
continue The key word in Oracle 11g Can be used in
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> begin
2 for i in 1 .. 20 loop
3 -- Judge
4 if (i = 5) then
5 continue;
6 end if;
7 dbms_output.put_line(i);
8 end loop;
9 end;
10 /
PL/SQL procedure successfully completed
4. oracle I won't support it break
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL> begin
2 for i in 1 .. 20 loop
3 -- Judge
4 if (i = 5) then
5 break;
6 end if;
7 dbms_output.put_line(i);
8 end loop;
9 end;
10 /
ORA-06550: line 6, column 7:
PLS-00201: identifier 'BREAK' must be declared
ORA-06550: line 6, column 7:
PL/SQL: Statement ignored
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> begin
2 for i in 1 .. 20 loop
3 -- Judge
4 if (i = 5) then
5 break;
6 end if;
7 dbms_output.put_line(i);
8 end loop;
9 end;
10 /
ORA-06550: The first 6 That's ok , The first 7 Column :
PLS-00201: identifier 'BREAK' must be declared
ORA-06550: The first 6 That's ok , The first 7 Column :
PL/SQL: Statement ignored
版权声明
本文为[=PNZ=BeijingL]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221013072823.html
边栏推荐
- Transform based deep learning target detection (Detr model)
- 跨平台编译
- CLA:减少开源社区合规风险的银弹?
- A case of MySQL implicit conversion
- Linux 7 silent installation oracle12c reports an error [fatal] [ins-35344] the value is not specified
- UVC camera 封装类
- Analysis of image lazy loading (three implementation methods and two optimization methods)
- source_ Insight is a method to create a new project and search for a variable or function in the whole document
- Android被爆安全漏洞 根源是苹果的无损音频编解码器
- [flutter topic] 125 illustrated autobiography ace_ ICON. Ttf Icon Library
猜你喜欢

Oracle 如何使用循环控制关键字exit、goto、continue

How to select Bi tools? These three questions are the key

多目标追踪——拓展卡尔曼滤波(EKF)

Share some unknown and super easy-to-use API functions in sklearn module

Error message during unity3d build: missing project ID in unity solution
The root cause of Android's security vulnerability is Apple's lossless audio codec

J'ai eu un entretien d'une demi - heure avec Semaphore.

Linux Installation Oracle 19C Full Version (graphics + silent installation)

openEuler Kernel 技术解读 | 内核中断子系统介绍

MySQL隐式转换案例一则
随机推荐
[C language advanced level 10 -- character and string functions and their simulation implementation (1)]
天梯22模拟 L3-2 拼题A打卡奖励 (30 分)
build perl from source
Analysis of image lazy loading (three implementation methods and two optimization methods)
SQL expression
Beyond iterm! Known as the next generation terminal artifact, powerful!
Simple operation of QT axobject Library
[untitled]
NavigationView的使用
中商惠⺠交易中台架构演进:对 Apache ShardingSphere 的应⽤
dataguard (ADG)备库移动(迁移)数据文件
美团一面:有在⼯作时间中使⽤过 jstat, jmap, mat⼯具吗? 能给⼀个实际的例⼦说明⼀下吗?
Golang time strings common methods
Sorting of remote sensing deep learning target detection data set
CLA: silver bullet to reduce the compliance risk of open source community?
Three minute quick understanding of interactive graffiti
P8 data broadcasting
CLA:减少开源社区合规风险的银弹?
Cross platform compilation
用MySQL创建学生管理系统