--这是包头
create or replace package CRM_CUSTOMER_CUSTOMERRECORD_SH is
   type outList is REF CURSOR;
      procedure getCustomerRecord(  
    key        in nvarchar2,
    result_cursor out outList  
  ); 
end CRM_CUSTOMER_CUSTOMERRECORD_SH;--这是包主体
create or replace package body CRM_CUSTOMER_CUSTOMERRECORD_SH is   procedure getCustomerRecord(
    key        in nvarchar2,
    result_cursor out outList
  )
  is
  
  SQLSTR varchar2;
   
  begin
    SQLSTR:='select * from CRM_Customer_CustomerRecord where MOOD=0';  
  
    IF ids is not null then  
       SQLSTR:=SQLSTR || ' and UPPER(Name_A) like ''%'|| key ||'%'' order by id asc';
    end if
    
    open result_cursor for SQLSTR;
  end;
 
end CRM_CUSTOMER_CUSTOMERRECORD_SH;在PL/SQL编译的时候出现如下问题:Compilation errors for PACKAGE BODY ERPDBADMIN.CRM_CUSTOMER_CUSTOMERRECORD_SHError: PLS-00103: 出现符号 "OPEN"在需要下列之一时:
       ;
Line: 19
Text: open result_cursor for SQLSTR;
请给我提示一下,谢谢了!

解决方案 »

  1.   

    注:
          IF  ids  is  not  null  then      
                 SQLSTR:=SQLSTR    ¦  ¦  '  and  UPPER(Name_A)  like  ''%'  ¦  ¦  key    ¦  ¦'%''  order  by  id  asc';  
           end  if  
    中的ids是改为key.但是,还是同样的错误。
      

  2.   

    1、end if 后少了分号     
    2、SQLSTR varchar2;  没有定义长度