17,089
社区成员
发帖
与我相关
我的任务
分享
-- 建议检查一下其他的列。
SQL>
SQL> create table t1(id int, name varchar(10));
Table created
SQL> create table t2(id int, name float);
Table created
SQL> begin
2 insert into t1 values(11, 'xxx');
3 insert into t1 values(12, 'yyy');
4 insert into t2 values(21, 9.9);
5 insert into t2 values(22, 11.0);
6 end;
7 /
PL/SQL procedure successfully completed
SQL> create view v1
2 as
3 select id, name from t1
4 union all
5 select id, name from t2
6 ;
create view v1
as
select id, name from t1
union all
select id, name from t2
ORA-01790: 表达式必须具有与对应表达式相同的数据类型
SQL> create view v2
2 as
3 select id, name from t1
4 union all
5 select id, to_char(name) from t2
6 ;
View created
SQL> select * from v1;
select * from v1
ORA-00942: 表或视图不存在
SQL> select * from v2;
ID NAME
---------- ----------------------------------------
11 xxx
12 yyy
21 9.9
22 11
SQL> drop table t1 purge;
Table dropped
SQL> drop table t2 purge;
Table dropped
SQL> drop view v1;
drop view v1
ORA-00942: 表或视图不存在
SQL> drop view v2;
View dropped
SQL>