日期:2014-05-17  浏览次数:20763 次

这样的SQL语句在存储过程如何执行??
create   or   replace   procedure   procedureName(fields   In   Varchar2,strSql   in   varchar2,p_out   Out   Number)   is

var_sql   varchar2(8000);   --存放构造游标的sql语句
type   mycursor   is   ref   cursor;     --定义游标类型
mycur   mycursor;                               --定义动态游标

begin

var_sql:= 'Update   Jz_Limit_Price   Set   '||fields;
var_sql:=var_sql||   strSql;

--请问这样的Sql如何执行。谢谢

...

------解决方案--------------------
不好意思,可能寫錯了.......
declare
v_cursorid integer;
v_sql varchar2(500);
v_row integer;
begin
v_cursorid=dbms_sql.open_cursor;
v_sql:= 'Update Jz_Limit_Price Set '||fields;
dbms_sql.parse(v_cursorID,v_sql,dbms_sql.native);
v_row:=dbms_sql.execute(v_cursorID);
dbms_sql.close_cursor(v_cursorID);
end;