存储过程中select...into / execute immediate ... into 赋值总是空
我从表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;
------解决方案--------------------把你的整个代码贴出来
------解决方案--------------------execute immediate v_Sql into v_tmp;
貌似不能这样写把
------解决方案--------------------execute immediate 'select tmp from table1 where to_number(tno)=to_number(''
------解决方案--------------------v_p2
------解决方案--------------------'') and to_number(tnoid)=to_number(''
------解决方案--------------------v_p3
------解决方案--------------------'')' into v_tmp
应该可以取到值