在表A中我要判断属性a和b的值是否相等,如果相等执行表B的更新,如果不等要提示表B更新失败
这样的语句怎样在sqlplus中实现呢?
这样的语句怎样在sqlplus中实现呢?
解决方案 »
- 如何用toad for oracle 监视我的程序执行了哪些slq语句和执行到哪条sql了
- 远程连接两个数据库服务器,更新数据
- 安装 Oracle 11gR2 RAC grid执行到网络配置助手时报错
- 使用sqlldr导入数据时的 SQL*Loader-605 错误
- 刚接触oracle,我想问问是不是大家都是先建立一个用户,再用这个用户建表
- 请教个查询语句
- Data guard下的RAC交叉存档有疑问
- 求助关于vc使用pro* c连接oracle数据库的问题!
- ★★★★☆PL/SQL中如果判断一个日期是周末☆★★★★
- 怎样从文本文件读内容到数据库????????
- 谁有介绍formbuilder的电子书,发一个给我,多谢。
- Create index 问题
using b on (a.id=b.id)
when matched update
when not matched insert 这样可以使用,查查看
楼主的要求,megert实现不了,只能用存储过程
declare
-- Local variables here
cursor a_cursor is
select a,b from A;
begin
-- Test statements here
for A_record in a_cursor loop
if A_record.a=A_record.b then
update B set c='' where a=A_record.a and b=A_record.b;
dbms_output.put_line('表B更新成功');
else
dbms_output.put_line('表B更新失败');
end if;
end loop;
exception
when sql%notfound then
dbms_output.put_line('表B更新失败');
end;
楼主看看,是不是这样的?