select A into v_tbname from search where intyear=tyear and intmonth=tmonth;
execute immediate 'insert into q select * from '||v_tbname;
...
execute immediate 'insert into q select * from '||v_tbname;
...
解决方案 »
- 求教数据库同步的问题
- 存储过程执行时间比较长,次数很频繁! 里面有个UPDATE造成LOW LOCK 该如何优化?
- 日期转换的问题
- 那里有关于连接oracle和web services的资料
- 求一条sql语句
- PL/SQL中的变量声明问题?
- 我在XP下装了个Oracle 9.0,但系统一启动就自动启动了Oracle,想让系统启动时,不启动Oracle,怎么办?
- Oracle9i登录问题
- 如何 删除datafile
- 请问有谁知道google的后台数据库是用什么数据库?
- 从一部机A将一个方案里的所有表,触发齐序列号存储过程导入到另一机B是否一定要在B里建同样的表空间和用户名的?
- 入门问题,回答得都有分,(回答得多的话我会再给帖子加分^_^)
因为你的表名是动态的!
v_tabname varchar2(20);
begin
delete from qq ;
select A into v_tabname from B where coid=coid and intyear=tyear and intmonth=tmonth ;
execute immediate ' insert into qq select * from '||v_tabname;
commit;
end transbal;
现在我编译无错误,但我测试时,总报select那行有错误,但是我在哪张表用同样的参数传过去,结果只有一张表,没有错,这是为什么?
ora-06512:在"ttt.transbal",Line 5
ora-06512:在line3我参数依次用:2004,1,B002-01试的但我在b表中写
select A from b where coid='B002-01' and intyear=2004 and intmonth=1
这样查询出来就是一条数据,请帮忙看一下。
你在前面加一个判断看一下就知道了!
select count(*) into v_cnt from b where where coid=coid and intyear=tyear and intmonth=tmonth ;
if v_cnt=1 then
select A into v_tabname from B where coid=coid and intyear=tyear and intmonth=tmonth ;
end if;这样试一下就知道了!
and rownum=1;