intcount := select count(*) form pan_integralset where psid =apsid(p);
create or replace package body ProAddProductVolume
is
PROCEDURE AddProductVolume
(
 acid in varchar2,--活动企业ID
 apsid in string_array,--产品编号
 aintegral in integral_array,--产品积分
 aintegralstartdate in sdate_array,--开始日期
 aintegralenddate in edate_array,--结束日期
 v_curLottery  out int_array --返回的结果集
)
as
 v_sqlStr  varchar2(4000):='';
 intcount number(1);
 begin
 stime := to_char(aintegralstartdate, 'YYYY-MM-DD HH24:MI:SS');
 etime := to_char(aintegralenddate, 'YYYY-MM-DD HH24:MI:SS');
     forall p IN apsid.first..apsid.last
      intcount := select count(*) form pan_integralset where psid =apsid(p);       if intcount =1   then
            update pan_integralset set INTEGRAL ='aintegral(p)',INTEGRALSTARTDATE='stime',INTEGRALENDDATE='etime';
       else 
            insert into  pan_integralset
                         (cid,psid,INTEGRAL,INTEGRALSTARTDATE,INTEGRALENDDATE)
                  values(acid,apsid(p),aintegral(p),aINTEGRALSTARTDATE(p),aINTEGRALENDDATE(p));      
       end if;
       commit;
 end AddProductVolume;
end ProAddProductVolume;怎么老是报错列!?    intcount := select count(*) form pan_integralset where psid =apsid(p);
这行说   intcount 出现符号在下列之一时.... 后就一堆..
请高手帮我看看

解决方案 »

  1.   

     select count(*)into intcount from pan_integralset where psid =apsid(p); 
      

  2.   

      谢谢 请问
            forall p IN apsid.first..apsid.last
            select count(*)into intcount from pan_integralset where psid =apsid(p) and cid = acid; 
           if intcount =1   then
                update pan_integralset set INTEGRAL ='aintegral(p)',INTEGRALSTARTDATE='stime',INTEGRALENDDATE='etime';
           else 
            insert into  pan_integralset
                         (cid,psid,INTEGRAL,INTEGRALSTARTDATE,INTEGRALENDDATE)
                  values(acid,apsid(p),aintegral(p),aINTEGRALSTARTDATE(p),aINTEGRALENDDATE(p));             end if;
    我可以这么写吗!? 他说我未申明变量P 
    分不够我再加!
      

  3.   

    V_SQL VARCHAR2(3000);
    intcount  number;V_SQL:='select count(*) form pan_integralset where psid =apsid(p)';
    EXECUTE IMMEDIATE V_SQL
          INTO intcount  ;
      

  4.   


    declare p int;   --定义一下!
      

  5.   

    只要在前面定义一个number型变量叫intcount就可以了
      

  6.   


    应该用into的方式对单结果集赋值。
      

  7.   

    数据库的操作对象和操作结果都是集合,你使用select操作之后,得到的是一个集合,集合当然不能赋值给普通的变量。你可以用into来实现。希望能对你学习数据库有帮助。