日期:2014-05-17 浏览次数:21158 次
create or replace procedure sp_test1 ( DWMC in VARCHAR2, LX in VARCHAR2 ) IS v_sql VARCHAR2(1000); begin v_sql := 'select * from test_table where dwmc:='+DWMC+' and lx:='+LX+''; execute immediate v_sql; end sp_test1;
--声明包头 CREATE OR REPLACE PACKAGE PACK_TEST AS --这个是游标 TYPE TESTCUR IS REF CURSOR; --这个是过程 PROCEDURE sp_test1(DWMC in VARCHAR2, LX in VARCHAR2, P_CUR OUT TESTCUR); END PACK_TEST; --声明包体 CREATE OR REPLACE PACKAGE BODY PACK_TEST AS PROCEDURE sp_test1(DWMC in VARCHAR2, LX in VARCHAR2, P_CUR OUT TESTCUR) is strsql varchar2(1000); begin strsql:='select * from test_table where dwmc='':dwmc'' and lx='':lx'''; open p_cur for strsql using dwdc,lx;--上一句的:及这一句为绑定变量 end sp_test1; end PACK_TEST;
------解决方案--------------------