PLSQL有关问题请帮忙 多谢
PLSQL问题请帮忙 谢谢!
------解决方案--------------------
update table1 a
set a.name = (select b.name from table2 b where a.id = b.id and exists (select 1 from table2 where a.id = b.id));
如果想要实现第二种功能,就需要使用游标来进行循环判断,看talbe2的id是否在table1中。
------解决方案--------------------
------解决方案--------------------
- SQL code
表1(table1)里的数据全部更新表2(table2)中的数据。 如表1(table1) ID name 01 test1 02 test2 03 test3 04 test4 表2(table2) ID name 01 02 03 用PLSQL更新 想要表1(table1)和表2(table2)相同的ID更新。 表2(table2)中没有ID的用错误输出ID号码。
------解决方案--------------------
update table1 a
set a.name = (select b.name from table2 b where a.id = b.id and exists (select 1 from table2 where a.id = b.id));
如果想要实现第二种功能,就需要使用游标来进行循环判断,看talbe2的id是否在table1中。
------解决方案--------------------
------解决方案--------------------