假定有两张表,A表和B表。
A 表中有字段ID 、 NAME ,B表中也有字段ID、NAME。A表中的字段NAME为空,要将B表中的字段NAME的值赋给A表。
update a set a.name=(select b.name from b where a.id=b.id)
在SQLPLUS中,用 desc tablename
在PL/SQL工具中,可以通过视图user_tab_columns 查看
select * from user_tab_columns where table_name = upper(tablename)
可以通过user_constraint查看主键盘约束
select * from user_constraint where table_name = upper(tablename)
在PL/SQL工具中,可以通过视图user_tab_columns 查看
select * from user_tab_columns where table_name = upper(tablename)
可以通过user_constraint查看主键盘约束
select * from user_constraint where table_name = upper(tablename)
得到所有表名:
select * From all_objects where object_type='TABLE' AND OWNER='EWMS_EMS'
select * from user_tables
select * from tab
select * From all_objects where object_type='TABLE' AND OWNER='EWMS_EMS'
select * from user_tables
select * from tab