当前位置:网站首页>Oracle 存储过程之遍历
Oracle 存储过程之遍历
2022-07-07 18:03:00 【江湖小蟹】
以下内容主要介绍Oracle存储过程中,如何使用for循环遍历拼接好的SQL语句,并执行。
- 循环的写法
注:为了语句简洁,下面代码块中的“SQL语句”的SQL会在下面展示。
FOR ARR IN (SQL语句) LOOP
-- 控制台打印(正式运行时,建议删除或注释)
DBMS_OUTPUT.PUT_LINE(ARR.SS);
-- 执行sql
EXECUTE IMMEDIATE ARR.SS;
END LOOP;
不要纠结下面的语句,看意就好。主要是想表达最终执行的SQL是怎么来的。(拼接sql语句结尾不能加分号,否则执行sql会出错)
SELECT 'UPDATE SCHOOL_ROll SET ROLL = '|| S.ROLL || 'WHERE ID = ' || S.ID FROM STUDNETS AS S
- 完整存储过程语句
CREATE
OR REPLACE PROCEDURE "SP_OA_SL" AS BEGIN
-- 遍历SQL执行结果
FOR ARR IN ( SQL语句 ) LOOP
-- 控制台打印(正式运行时,建议删除或注释)
DBMS_OUTPUT.PUT_LINE ( ARR.SS );
-- 执行sql
EXECUTE IMMEDIATE ARR.SS;
END LOOP;
END;
边栏推荐
- 841. 字符串哈希
- CSDN语法说明
- Force buckle 1961 Check whether the string is an array prefix
- Detailed explanation of Flink parallelism and slot
- Vulnhub tre1
- LeetCode力扣(剑指offer 36-39)36. 二叉搜索树与双向链表37. 序列化二叉树38. 字符串的排列39. 数组中出现次数超过一半的数字
- c语言如何判定是32位系统还是64位系统
- 整型int的拼接和拆分
- 力扣 643. 子数组最大平均数 I
- R language ggplot2 visualization: use the ggdensity function of ggpubr package to visualize the packet density graph, and use stat_ overlay_ normal_ The density function superimposes the positive dist
猜你喜欢

Redis——基本使用(key、String、List、Set 、Zset 、Hash、Geo、Bitmap、Hyperloglog、事务 )

力扣 2319. 判断矩阵是否是一个 X 矩阵

【STL】vector

Open source heavy ware! Chapter 9 the open source project of ylarn causal learning of Yunji datacanvas company will be released soon!

数据孤岛是企业数字化转型遇到的第一道险关

Cloud component development and upgrading

微信公众号OAuth2.0授权登录并显示用户信息

有了ST7008, 蓝牙测试完全拿捏住了

关于cv2.dnn.readNetFromONNX(path)就报ERROR during processing node with 3 inputs and 1 outputs的解决过程【独家发布】

Introduction to bit operation
随机推荐
Welcome to the markdown editor
让这个 CRMEB 单商户微信商城系统火起来,太好用了!
Automatic classification of defective photovoltaic module cells in electroluminescence images-论文阅读笔记
MRS离线数据分析:通过Flink作业处理OBS数据
8 CAS
论文解读(ValidUtil)《Rethinking the Setting of Semi-supervised Learning on Graphs》
关于自身的一些安排
干货分享|DevExpress v22.1原版帮助文档下载集合
JVM class loading mechanism
开源重器!九章云极DataCanvas公司YLearn因果学习开源项目即将发布!
A pot of stew, a collection of common commands of NPM and yarn cnpm
pom.xml 配置文件标签作用简述
【哲思与实战】程序设计之道
Data island is the first danger encountered by enterprises in their digital transformation
831. KMP string
Chapter 9 Yunji datacanvas was rated as 36 krypton "the hard core technology enterprise most concerned by investors"
gorilla官方:golang开websocket client的示例代码
pom. Brief introduction of XML configuration file label function
毕业季|遗憾而又幸运的毕业季
CUDA versions are inconsistent, and errors are reported when compiling apex