oracle存储过程语法二
来源:互联网 发布:淘宝代销邮费算谁的 编辑:程序博客网 时间:2024/04/29 14:07
type typeaaaa is record(
column1 table1.column1%type,
column2 table1.column2%TYPE,
column3 table1.column3%type,
column4 table1.column4%TYPE
);
record1 typeaaaa;
cursor cur_info is
SELECT column1, column2, column3, column4
FROM table1 A;
BEGIN
open cur_info;
fetch cur_info into record1;
while (cur_info%found) LOOP
UPDATE (SELECT TD.a1,
TD.a2,
TD.a3,
B.ba1,
B.ba2,
B.ba3
FROM table_a TD, table_b B
WHERE TD.no = B.no
AND TD.date = B.date)
SET a1 = ba1, a2 = ba2, a3 = ba3;
UPDATE table1 A
SET column1 = 1,
column2 = '2',
column3 = 0
WHERE NOT EXISTS (SELECT NULL
FROM table2 B
WHERE A.no = B.no
AND A.date = B.date)
AND column1 = 'xxxxx';
MERGE INTO tablea AA
USING (SELECT column1, column2,column3
FROM tableb) BB
ON (AA.column1 = BB.column1 AND AA.column2 = BB.column2 AND AA.column3 = BB.column3)
WHEN MATCHED THEN
UPDATE
SET AA.column5 = BB.column5,
AA.column6 = BB.column6;
fetch cur_info into record1;
end loop;
column1 table1.column1%type,
column2 table1.column2%TYPE,
column3 table1.column3%type,
column4 table1.column4%TYPE
);
record1 typeaaaa;
cursor cur_info is
SELECT column1, column2, column3, column4
FROM table1 A;
BEGIN
open cur_info;
fetch cur_info into record1;
while (cur_info%found) LOOP
UPDATE (SELECT TD.a1,
TD.a2,
TD.a3,
B.ba1,
B.ba2,
B.ba3
FROM table_a TD, table_b B
WHERE TD.no = B.no
AND TD.date = B.date)
SET a1 = ba1, a2 = ba2, a3 = ba3;
UPDATE table1 A
SET column1 = 1,
column2 = '2',
column3 = 0
WHERE NOT EXISTS (SELECT NULL
FROM table2 B
WHERE A.no = B.no
AND A.date = B.date)
AND column1 = 'xxxxx';
MERGE INTO tablea AA
USING (SELECT column1, column2,column3
FROM tableb) BB
ON (AA.column1 = BB.column1 AND AA.column2 = BB.column2 AND AA.column3 = BB.column3)
WHEN MATCHED THEN
UPDATE
SET AA.column5 = BB.column5,
AA.column6 = BB.column6;
fetch cur_info into record1;
end loop;
0 0
- oracle存储过程语法二
- ORACLE存储过程语法
- oracle 存储过程语法
- oracle存储过程语法
- Oracle存储过程语法
- oracle存储过程语法
- oracle存储过程语法
- oracle存储过程语法
- oracle存储过程语法
- oracle存储过程语法
- oracle存储过程语法
- Oracle存储过程语法
- oracle存储过程语法
- Oracle存储过程语法
- Oracle存储过程语法 .
- Oracle-存储过程语法
- oracle存储过程语法
- oracle存储过程语法
- iOS开发基础 - UISearchController
- pssh使用指南
- 【开源框架】EventBus 消息总线使用
- 网易游戏2016笔试题(三)
- linux服务器时间同步——ntpdate 172.20.0.191
- oracle存储过程语法二
- java 版 A*寻路算法具体过程
- JavaScript中的call和apply
- HashMap深度解析(一)
- java 求连续子数组的最大和
- linux下安装配置redis服务
- iOS 9 新特性之实现 3D Touch 就是 So easy -- OC版
- 关于redis集群方案
- 关于类的问题