2013-03-29 60 views
-3

正在执行下面的查询并导致错误。在oracle中将数据从一个表复制到另一个表 - 不工作

insert into me.attr (EXPS) 
values(select EXPS from mine.attr 
      where fiscal_year=2012 
      and accounting_period=11 
      and gaap_cd='ZA'); 


Error: insert into me.attr (EXPS) values (select EXPS from mine.attr 
where fiscal_year=2012 and accounting_period=11 and gaap_cd='ZA') 
Error at Command Line:31 Column:2 
Error report: 
SQL Error: ORA-00936: missing expression 
00936. 00000 - "missing expression" 
*Cause:  
*Action: 

有人可以帮我解决这个问题。

+0

做的表是什么样子? – clav

回答

3

当你的insert内使用select,您不使用values子句:试试这个:

insert into 
    me.attr (EXPS) 
    select EXPS 
    from mine.attr 
    where fiscal_year=2012 and 
      accounting_period=11 and 
      gaap_cd='ZA' 
+0

谢谢,如果我需要将数据从一个数据库复制到另一个数据库? – uday

+0

嗨,我用上面提到的语法,但查询失败,出现以下错误。 SQL错误:ORA-00942:表或视图不存在 00942. 00000 - “表或视图不存在” – uday

相关问题