我从表table1中根据条件查出tmp赋给v_tmp,可结果总是空的。但是我用生成v_Sql是可以查到数据的,
其他地方也用过这样的查询没什么错的
select tmp into v_tmp from table1 where to_number(tno)=to_number(v_tno) and to_number(tnoid)=to_number(v_tnoid);
或者
v_Sql:='select tmp from table1 where to_number(tno)=to_number('||v_tno||') and to_number(tnoid)=to_number('||v_tnoid||')';
execute immediate v_Sql into v_tmp;
其他地方也用过这样的查询没什么错的
select tmp into v_tmp from table1 where to_number(tno)=to_number(v_tno) and to_number(tnoid)=to_number(v_tnoid);
或者
v_Sql:='select tmp from table1 where to_number(tno)=to_number('||v_tno||') and to_number(tnoid)=to_number('||v_tnoid||')';
execute immediate v_Sql into v_tmp;
解决方案 »
- 不同帐号连接oracle的速度差别很大是为什么?
- 请高手指点明灯:用触发器备份含用BLOB表-急
- 向高手请教oracle 里的对象操作的详细答案
- SQL 错误: ORA-31000: 资源 'http://xmlbook.com/sample/contact.xsd' 不是 XDB 方案文档
- 请教:ORA-12154 搜索资料后试过,但都失败,想从各位朋友处看看还有哪些东西没有考虑到的
- 无法在 DLL oci.dll 中找到名为 OCIEnvCreate 的入口点
- 怎样把oracel中的库导入到另外一台机器的oracel数据库?
- 临时表的问题,delphi+oracle,请看正文,谢谢!
- 外连接时on子句的一个小问题
- 谁知道在哪里可以找到sql命令大全的书籍,急需!!!谢谢!
- oracle 返回主键的问题
- 很急,等着用
resultStr out char,
v_p1 VARCHAR2
) is
v_income_seq number;
v_sql varchar2(1000);
v_p2 table2.p2%type,
v_p3 table3.p2%type
cursor curtk IS
SELECT trim(p2),trim(p3) FROM table2 order by desc;
Begin
open curtk;
Fetch curtk into v_p2,p3;
while curtk%found loop
--v_p2,v_p3都有值
/*select tmp into v_tmp from table1 where to_number(tno)=to_number(v_p2) and to_number(tnoid)=to_number(v_p3);*/
v_Sql:='select tmp from table1 where to_number(tno)=to_number('||v_p2||') and to_number(tnoid)=to_number('||v_p3||')'; execute immediate v_Sql into v_tmp;
--生成的v_sql在数据库中是可以查到数据的,但是v_tmp就是没有值
ResultStr:='v_sql:'||v_sql||' v_tmp:'||v_tmp;
Return; Fetch curtk into p2,p3;
end loop;
close curtk;
End;如果select count(*) into v_tmp from ...可以赋值
但是select count(tmp) into v_tmp from ..v_tmp还是空的
貌似不能这样写把
应该可以取到值