-1

コンパイルすると、次のようなエラーが発生しますPLS- 00103 "cur1" when expecting one of the following

CREATE OR REPLACE PACKAGE BODY SSS IS

   PROCEDURE sample1(obj_CustomerID IN varchar2,
                    obj_DelUserID  IN varchar2,
                    cur1           OUT T_CURSOR1,
                    cur2           OUT T_CURSOR2)IS


  BEGIN

   TEMP_CUR1 cur1%ROWTYPE;

   TEMP_CUR2 cur2%ROWTYPE;



    OPEN cur1 FOR
      select distinct cf.fleet_id, cf.fleet_name, cf.customer_id
        from customer_fleet cf, vehicle_register vr, asset_register ar
       where cf.customer_id = vr.customer_id
         and cf.fleet_id = vr.fleet_id
         and vr.vehicle_id = ar.vehicle_id
         and vr.customer_id = ar.customer_id
         and vr.is_active = 'Y'
         and cf.is_active = 'Y';
         FETCH cur1
      into temp_cur1;
    close cur1;

    OPEN CUR2 FOR
      select TEMP_CUR1.fleet_id,
             TEMP_CUR1.fleet_name,
             TEMP_CUR1.customer_id
        from cur1
       where customer_id = obj_CustomerID;

    FETCH CUR2
      INTO TEMP_CUR2;
    CLOSE CUR2;

end Sample1;

END SSS;

エラーは行で発生します

   TEMP_CUR1 cur1%ROWTYPE;    
   TEMP_CUR2 cur2%ROWTYPE;
4

2 に答える 2

1

変数の宣言は、 の後ではなくISとの間で行う必要があります。BEGINBEGIN

PROCEDURE sample1(obj_CustomerID IN varchar2, 
                    obj_DelUserID  IN varchar2, 
                    cur1           OUT T_CURSOR1, 
                    cur2           OUT T_CURSOR2)
IS 

   TEMP_CUR1 cur1%ROWTYPE; 
   TEMP_CUR2 cur2%ROWTYPE; 

BEGIN 
于 2012-08-21T06:22:10.170 に答える
0

を使用してStrongly typed REF CURSORいます。

PROCEDURE sample1(obj_CustomerID IN varchar2, 
                    obj_DelUserID  IN varchar2, 
                    cur1           OUT T_CURSOR1, 
                    cur2           OUT T_CURSOR2)
IS 
   TYPE curr1 IS REF CURSOR RETURN T_CURSOR1%ROWTYPE;
   TYPE curr2 IS REF CURSOR RETURN T_CURSOR2%ROWTYPE;

   TEMP_CUR1 curr1; 
   TEMP_CUR2 curr2; 

BEGIN 

その後

 FETCH cur1
  INTO TEMP_CUR1

FETCH cur2
 INTO TEMP_CUR2
于 2012-08-23T22:19:35.700 に答える