SELECT 学号,班级,姓名,性别 FROM p_tableName---学生表以上有4个字段, 
查询条件`分别是`学号,班级,姓名,性别``
求一个真正完整的存储过程~~~~``   请不要说我懒``在论坛求救了很久了````自己也写过``没用总是有报错`的``~! 

解决方案 »

  1.   

    create or replace procedure test(CustomerID  In out Varchar2,
                                     
                                     cur_result_out Out sys_refcursor) as
      str_sql Varchar2(200);
    Begin
      If CustomerID is Not Null Then
      
        CustomerID := ' c.CustomerID=';
     
        str_sql       := 'select  *  from  t_mc_customer c  where  ' ||
                           CustomerID ;
      end if;
      Open cur_result_out For str_sql;
    end test;这是我写的例子,OPEN```那一句报错`
      

  2.   

    当然出错!~create or replace procedure test(CustomerID  In out Varchar2, 
                                    
                                    cur_result_out Out sys_refcursor) as 
      str_sql Varchar2(200); 
    Begin 
      If CustomerID is Not Null Then 
      
       
        str_sql      := 'select  *  from  t_mc_customer c  where  
                          c.CustomerID=:CustomerID  '; 
      end if; 
      Open cur_result_out For str_sql using CustomerID  ; 
    end test; 
      

  3.   

        str_sql      := 'select  *  from  t_mc_customer c  where c.Customerid= ' || 
                          CustomerID ; 
      

  4.   

    SELECT 学号,班级,姓名,性别 FROM p_tableName---学生表 以上有4个字段, 
    查询条件`分别是`学号,班级,姓名,性别`` 
    求一个真正完整的存储过程~~~~``  请不要说我懒``在论坛求救了很久了````自己也写过``没用总是有报错`的``~! 
     
    需求再详细点~~ 
    存储过程有哪些参数,要达成一个什么样的目的~ 
    上面有4个字段,4个条件参数,目的就是`能通过存储过程在查询时,对这4个条件进行不同组合的查询,如:学号+班级+姓名\学号+姓名\班级+姓名等多种不同情况的组合.