通过对存储过程的多天学习`,最后得出以下结果! 好像还有不少问题``希望有高手指点指点``~create or replace procedure test
(CustomerID In Varchar2(20) ,
CustomerCode In varchar2(30) ,
Password In Varchar2(4) ,
CustomerName In Varchar2(4) ,
InputOperatorId In Varchar2(4),
str_sql Varchar2(200),
cur_result_out Out search_result)
Begin
Open cur_result_out For str_sql;
If CustomerID Not Null Then
CustomerID := 'and c.CustomerID=' ;
Else If CustomerCode Not Null Then
CustomerCode := 'and c.CustomerCode=' ;
Else If Password Not Null Then
Password := 'and c.Password=' ;
Else If CustomerName Not Null Then
CustomerName := 'and c.CustomerName=' ;
Else If InputOperatorId Not Null Then
InputOperatorId := 'and c.InputOperatorId=' ;
str_sql := 'select * from t_mc_customer c where 1=1'|| CustomerID ||
CustomerCode || Password || CustomerName || InputOperatorId ;
end test;
(CustomerID In Varchar2(20) ,
CustomerCode In varchar2(30) ,
Password In Varchar2(4) ,
CustomerName In Varchar2(4) ,
InputOperatorId In Varchar2(4),
str_sql Varchar2(200),
cur_result_out Out search_result)
Begin
Open cur_result_out For str_sql;
If CustomerID Not Null Then
CustomerID := 'and c.CustomerID=' ;
Else If CustomerCode Not Null Then
CustomerCode := 'and c.CustomerCode=' ;
Else If Password Not Null Then
Password := 'and c.Password=' ;
Else If CustomerName Not Null Then
CustomerName := 'and c.CustomerName=' ;
Else If InputOperatorId Not Null Then
InputOperatorId := 'and c.InputOperatorId=' ;
str_sql := 'select * from t_mc_customer c where 1=1'|| CustomerID ||
CustomerCode || Password || CustomerName || InputOperatorId ;
end test;
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;