create table test as select emp.empno,emp.ename,'' 新的字段名1, '' 新的字段名2 from emp
create table table_name as select t1.c1,t1.c2,t2.c3,t3.c4,'' new_add_col1,'' new_add_col2,... from t1,t2,t3 where ....
查询结果是这样的怎么加字段?就是通过这个查询结果再创建表,而且要加这两个表之外的字段名。 select swdjzh,nsr_mc from t_dj_jgnsr_t t where swdjzh not in (select qybm from kjywr_info200910)
create table 你的表名 as select swdjzh,nsr_mc ,'' as 你要加的字段名1, '' as 你要加的字段名2 from t_dj_jgnsr_t t where swdjzh not in (select qybm from kjywr_info200910);原理就是在查询语句中增加两个空的列,这两个列的内容是常数,oracle 会把内容自动加载新建立的表上。如果你要建立字符类型的就用'' 数字类型就iyong 0 日期类型就 to_date
'' as sw_gly varchar2(20) 这样不行啊,提示我未找到要求的FROM的关键字。
'' as sw_gly varchar2(20) 这样不行啊,提示我未找到要求的FROM的关键字。 ???? '' as sw_gly varchar2(20) 我可没有加类型啊, 改成这样 '' as sw_gly 就好了
嗯,类型是VARCHAR2就行,字段长度也有限制。
select swdjzh,nsr_mc,null '你要加的字段名1',null '你要加的字段名1' from t_dj_jgnsr_t t where swdjzh not in (select qybm from kjywr_info200910) ;
select emp.empno,emp.ename,'' 新的字段名1, '' 新的字段名2 from emp
select t1.c1,t1.c2,t2.c3,t3.c4,'' new_add_col1,'' new_add_col2,... from t1,t2,t3
where ....
select swdjzh,nsr_mc from t_dj_jgnsr_t t where swdjzh not in (select qybm from kjywr_info200910)
as
select swdjzh,nsr_mc ,'' as 你要加的字段名1,
'' as 你要加的字段名2
from t_dj_jgnsr_t t where swdjzh not in (select qybm from kjywr_info200910);原理就是在查询语句中增加两个空的列,这两个列的内容是常数,oracle 会把内容自动加载新建立的表上。如果你要建立字符类型的就用'' 数字类型就iyong 0 日期类型就 to_date
????
'' as sw_gly varchar2(20)
我可没有加类型啊,
改成这样
'' as sw_gly 就好了
嗯,类型是VARCHAR2就行,字段长度也有限制。
光是这样告诉我:ORA-01723不能加长度为0的列。
ORA-00923未找到要求的FROM关键字。