17,377
社区成员
发帖
与我相关
我的任务
分享
create or replace procedure test(CustomerID In out Varchar2,
CustomerCode In out varchar2,
Password In out Varchar2,
CustomerName In out Varchar2,
InputOperatorId In out Varchar2,
cur_result_out Out sys_refcursor) as
str_sql Varchar2(200);
Begin
If CustomerID is Not Null Then
CustomerID := 'and c.CustomerID=';
ElsIf CustomerCode is Not Null Then
CustomerCode := 'and c.CustomerCode=';
ElsIf Password is Not Null Then
Password := 'and c.Password=';
ElsIf CustomerName is Not Null Then
CustomerName := 'and c.CustomerName=';
ElsIf InputOperatorId is Not Null Then
InputOperatorId := 'and c.InputOperatorId=';
str_sql := 'select * from t_mc_customer c where 1=1' ||
CustomerID || CustomerCode || Password ||
CustomerName || InputOperatorId;
end if;
Open cur_result_out For str_sql;
end test;