insert table1(a,b) select a1, to_char(a2,'0000000000000') from table2;
table1中的b字段是什么类型的?报什么错
long列是不允许出现在create table xx as select * from yyy里的 In addition, LONG columns cannot appear in these parts of SQL statements: .... SELECT lists of CREATE TABLE ... AS SELECT statements ..... oracle建议使用clob\blob\nclob来代替。 如: create table t(a int,b long); insert into t values(1,'1'); --可以这样创建,不过默认类型就成了clob create table t1 as select a,to_lob(b) from t; --也可以这样,先创建一个表,然后在插入数据时使用to_lob函数转换一下 create table t2 (a int,b long); insert into t2 select a,to_lob(b) from t; 见Oracle® Database SQL Reference的RAW and LONG RAW Datatypes
select a1, to_char(a2,'0000000000000') from table2;
In addition, LONG columns cannot appear in these parts of SQL statements:
....
SELECT lists of CREATE TABLE ... AS SELECT statements
.....
oracle建议使用clob\blob\nclob来代替。
如:
create table t(a int,b long);
insert into t values(1,'1');
--可以这样创建,不过默认类型就成了clob
create table t1 as select a,to_lob(b) from t;
--也可以这样,先创建一个表,然后在插入数据时使用to_lob函数转换一下
create table t2 (a int,b long);
insert into t2 select a,to_lob(b) from t;
见Oracle® Database SQL Reference的RAW and LONG RAW Datatypes