Oracle 更新或者删除游标行
来源:互联网 发布:淘宝三国杀ol卡是什么 编辑:程序博客网 时间:2024/05/16 08:10
-- 更新或删除游标行
/*注:当使用游标更新或者删除游标时,定义游标必须带有for update子句,在执行更新或者删除游标时必须带有 where current of 子句*/
-- 例:更新游标行
declare
cursor e_cursor is
select * from tg_test_user for update;
dno int :=&no;
begin
for e_record in e_cursor loop
if e_record.tg_test_userid = dno then
dbms_output.put_line('用户名:'||e_record.tg_test_username||',密码:'||e_record.tg_test_password||',ID:'||e_record.tg_test_userid);
update tg_test_user set tg_test_username='chao'where current of e_cursor;
end if;
end loop;
end;
--删除游标行
declare
cursor e_cursor is select * from tg_test_user for update;
names varchar2(225):=lower('&name');
begin
for e_record in e_cursor loop
if lower(e_record.tg_test_username)= names then
null;
delete from tg_test_user where current of e_cursor;
else
dbms_output.put_line('用户名:'||e_record.tg_test_username||',密码:'||e_record.tg_test_password||',ID:'||e_record.tg_test_userid);
end if;
end loop;
end;
/*注:当使用游标更新或者删除游标时,定义游标必须带有for update子句,在执行更新或者删除游标时必须带有 where current of 子句*/
-- 例:更新游标行
declare
cursor e_cursor is
select * from tg_test_user for update;
dno int :=&no;
begin
for e_record in e_cursor loop
if e_record.tg_test_userid = dno then
dbms_output.put_line('用户名:'||e_record.tg_test_username||',密码:'||e_record.tg_test_password||',ID:'||e_record.tg_test_userid);
update tg_test_user set tg_test_username='chao'where current of e_cursor;
end if;
end loop;
end;
--删除游标行
declare
cursor e_cursor is select * from tg_test_user for update;
names varchar2(225):=lower('&name');
begin
for e_record in e_cursor loop
if lower(e_record.tg_test_username)= names then
null;
delete from tg_test_user where current of e_cursor;
else
dbms_output.put_line('用户名:'||e_record.tg_test_username||',密码:'||e_record.tg_test_password||',ID:'||e_record.tg_test_userid);
end if;
end loop;
end;
0 0
- Oracle 更新或者删除游标行
- Oracle 参数 游标[游标更新删除数据]
- Oracle 参数 游标[游标更新删除数据]
- oracle游标的更新与删除数据
- Oracle 10g使用游标更新或删除数据
- Oracle 10g使用游标更新或删除数据
- oracle删除或者更新了表里面的数据…
- Oracle Cursor游标自身更新
- Oracle 遍历游标循环更新
- oracle pl sql 更新游标
- Pro*c使用滚动游标进行更新或删除游标行
- 使用游标更新和删除数据
- 如何分析oracle表是否被人删除或者更新过?
- oracle.for update,更新游标,cursor
- oracle 游标使用根据工龄更新年假
- oracle使用游标更新表中的字段
- 循环逐条修改或者删除数据(游标)
- oracle 游标循环删除表数据 sql
- MIT的《深度学习》精读(6)
- 单列模式
- cgi-fastcgi
- Servlet返回JSON格式的数据
- 4.5 调试Direct3D应用程序
- Oracle 更新或者删除游标行
- html基础知识
- leetcode 1. Two Sum
- 【那些年遇到过的面试题】 struct和typedef struct的用法
- 面试基础
- 日常-request.getSession(false)和request.getSession(true)用法区别
- 安卓6.0相机权限完美解决
- Pop Sequence (25)
- 什么是面向对象