首页 > 代码库 > Oracle存储过程根据传入参数查询

Oracle存储过程根据传入参数查询

Oracle存储过程中根据传入参数查询时无效

环境:Oracle11g

需求:根据传入的参数作为条件,查询相关数据

问题:条件无效

代码:

create or replace procedure XXX(associatedId in varchar,typeinfoid in varchar)

as

sheetcontent clob;

begin

select wm_concat(t.datasource) into sheetcontent from xly_associatedorder t

    where t.associatedid = associatedId and t.typeinfoid = typeinfoid;

  end XXX;

解决办法:

create or replace procedure XXX (associatedId in varchar,typeinfoid in varchar)

as

sheetcontent clob;

p1 varchar(50);

p2 varchar(50);

begin

  p1:=associatedId;

  p2:=typeinfoid;

select wm_concat(t.datasource) into sheetcontent from xly_associatedorder t

    where t.associatedid =p1 and t.typeinfoid =p2;

  end XXX;

Oracle存储过程根据传入参数查询