-1

IF ステートメントに基づいてさまざまな選択ステートメントを実行するクエリを作成しています。以前にOracleでIFを実行したことがなく、何が問題なのかわかりませんが、エラーが発生し、反復回数がゼロで、コードの最初の行を指しています。私はコードを含めましたが、それはたくさんありますが、実際に注意を払う必要があるのは IF だけです。

IF :p_sales_type = 'all_cancel' THEN



  SELECT 
   TO_DATE(SUBSTR(Transaction_Date,1,10), 'MM/DD/YYYY'),Item_Number, 
    REGEXP_REPLACE(SUBSTR(Item_Or_Adj_Description,1,50),'([^[:print:]])',' ') AS Item_Or_Adj_Desctription, 
    Customer_Type, Document_ID, Dealer_ID, Sales_Type, Item_Quantity, Total_Fee, State_Fee, Transaction_Fee, AO_Fee, WDFW_Fee 
  FROM 
  ( 
    -- Sales Transactions 
   SELECT /*+ index(IT ITEM_X4) */ 
      TO_CHAR(IT.it_status_set_date - 2/24, 'MM/DD/YYYY HH24:MI:SS') AS Transaction_Date,  -- Pacific Time
      TO_NUMBER(IT.ic_rcn) AS Item_Number, IT.it_descr AS Item_Or_Adj_Description, 
      DT.di_name AS Customer_Type, IT.it_docid AS Document_ID, IT.ag_id AS Dealer_ID, 
      CASE WHEN UPPER(IST.is_name) = 'ACTIVE' THEN 'SALE' ELSE IST.is_name END AS Sales_Type, 
      NVL(IT.it_quantity * CASE WHEN IT.is_id = 'AC' THEN 1 WHEN IT.is_id = 'DU' THEN 1 ELSE -1 END, 0) AS Item_Quantity,  -- Dups = 1
      NVL(IT.it_state_fee * CASE WHEN IT.is_id IN ('DC','SC') THEN -1.00 ELSE 1.00 END, 0.00) + 
    NVL(IT.it_other_fee * CASE WHEN IT.is_id IN ('DC','SC') THEN -1.00 ELSE 1.00 END, 0.00) AS Total_Fee, 
      NVL(IT.it_state_fee * CASE WHEN IT.is_id IN ('DC','SC') THEN -1.00 ELSE 1.00 END, 0.00) AS State_Fee, 
      NVL(IT.it_other_fee * CASE WHEN IT.is_id IN ('DC','SC') THEN -1.00 ELSE 1.00 END, 0.00) AS Transaction_Fee, 
      CASE WHEN IT.it_other_fee IS NULL OR IT.it_other_fee = 0.00 THEN 0.00 
        ELSE ROUND(IT.it_state_fee * CASE WHEN IT.is_id IN ('DC','SC') THEN -1.00 ELSE 1.00 END * (:p_ao_trx_fee / 100), 2) 
      END AS AO_Fee, 
      CASE WHEN IT.it_other_fee IS NULL OR IT.it_other_fee = 0.00 THEN 0.00 
        ELSE (IT.it_other_fee * CASE WHEN IT.is_id IN ('DC','SC') THEN -1.00 ELSE 1.00 END) - 
          ROUND((IT.it_state_fee * CASE WHEN IT.is_id IN ('DC','SC') THEN -1.00 ELSE 1.00 END * (:p_ao_trx_fee / 100)), 2) 
      END AS WDFW_Fee 
   FROM ITEM IT 
   JOIN DISCOUNT_TYPE DT ON DT.di_id = IT.di_id 
   JOIN ITEM_STATUS_TYPE IST ON IST.is_id = IT.is_id 
   WHERE IT.it_status_ind = 'A' -- Include active ITEM rows only. 
   AND (IT.is_id IN ('AC','DC','SC') OR (IT.is_id = 'DU' AND NVL(IT.it_state_fee, 0) != 0)) -- Exclude voids, exchanges, and false duplicates.
   AND IT.ic_rcn != '999' -- Exclude Dealer Fees. 
   AND IT.it_status_set_date BETWEEN :P_beg_dt  -- Pacific Time
                 AND :P_end_dt
    AND (:p_discount_type IS NULL OR DT.di_id = :p_discount_type)
  -- AND IST.is_name = :SalesType
   UNION ALL

   -- Item Adjustments
   SELECT 
      TO_CHAR(AJ.aj_adjustment_date - 2/24, 'MM/DD/YYYY HH24:MI:SS') AS Transaction_Date,  -- Pacific Time
      TO_NUMBER(IT.ic_rcn) AS Item_Number, AJ.aj_comment AS Item_Or_Adj_Description, 
      DT.di_name AS Customer_Type, IT.it_docid AS Document_ID, AJ.ag_id AS Dealer_ID, 
      AJ.ajt_adjustment_type_name AS Sales_Type, 
      0 AS Item_Quantity, 
      NVL(AJ.aj_state_adj_amt, 0.00) + NVL(AJ.aj_other_adj_amt, 0.00) AS Total_Fee, 
      NVL(AJ.aj_state_adj_amt, 0.00) AS State_Fee, 
      NVL(AJ.aj_other_adj_amt, 0.00) AS Transaction_Fee, 
      CASE WHEN AJ.aj_other_adj_amt IS NULL OR AJ.aj_other_adj_amt = 0.00 THEN 0.00 
    ELSE ROUND(NVL(AJ.aj_state_adj_amt, 0.00) * (:p_ao_trx_fee / 100), 2) END AS AO_Fee, 
      CASE WHEN AJ.aj_other_adj_amt IS NULL OR AJ.aj_other_adj_amt = 0.00 THEN 0.00 
    ELSE AJ.aj_other_adj_amt - ROUND(NVL(AJ.aj_state_adj_amt, 0.00) * (:p_ao_trx_fee / 100), 2) END AS WDFW_Fee 
   FROM ADJUSTMENT AJ 
   JOIN ITEM IT ON IT.it_id = AJ.it_id 
   JOIN DISCOUNT_TYPE DT ON DT.di_id = IT.di_id 
   WHERE AJ.aj_status_ind = 'A' -- Include active adjustments only. 
   AND AJ.it_id IS NOT NULL -- Include Item Adjustments only; rows with a foreign key to the ITEM table are Item Adjustments. 
   AND AJ.ajt_id != '0' -- Unreturned Doc Charge is not an Item Adjustment, it's a Lump Sum Adjustment to the Dealers account. 
   AND IT.ic_rcn != '999' -- Exclude Dealer Fees. 
   AND AJ.aj_adjustment_date BETWEEN :P_beg_dt  -- Pacific Time
                 AND :P_end_dt
    AND (:p_discount_type IS NULL OR DT.di_id = :p_discount_type)
   --AND AJ.Ajt_Adjustment_Type_Name = :SalesType
  ) ReportDetails 

  WHERE-- Sales_Type = :SalesType
                 (:p_ic_rcn is null OR :p_ic_rcn = Item_Number)
                 AND (:p_dealer_id IS NULL OR Dealer_ID = :p_dealer_id)
                 AND Sales_Type in ('DEALER CANCEL', 'STATE CANCEL')



  ORDER BY TO_DATE(SUBSTR(Transaction_Date,1,10), 'MM/DD/YYYY'), Item_Number,  -- Transaction Date, RCN (numerical order), order RCN was purchased. 
       TO_CHAR(TO_DATE(Transaction_Date, 'MM/DD/YYYY HH24:MI:SS'), 'SSSSS');


  ELSE IF :p_sales_type = 'item_adjustment' THEN


   -- Item Adjustments
   SELECT 
      TO_CHAR(AJ.aj_adjustment_date - 2/24, 'MM/DD/YYYY HH24:MI:SS') AS Transaction_Date,  -- Pacific Time
      TO_NUMBER(IT.ic_rcn) AS Item_Number, AJ.aj_comment AS Item_Or_Adj_Description, 
      DT.di_name AS Customer_Type, IT.it_docid AS Document_ID, AJ.ag_id AS Dealer_ID, 
      AJ.ajt_adjustment_type_name AS Sales_Type, 
      0 AS Item_Quantity, 
      NVL(AJ.aj_state_adj_amt, 0.00) + NVL(AJ.aj_other_adj_amt, 0.00) AS Total_Fee, 
      NVL(AJ.aj_state_adj_amt, 0.00) AS State_Fee, 
      NVL(AJ.aj_other_adj_amt, 0.00) AS Transaction_Fee, 
      CASE WHEN AJ.aj_other_adj_amt IS NULL OR AJ.aj_other_adj_amt = 0.00 THEN 0.00 
    ELSE ROUND(NVL(AJ.aj_state_adj_amt, 0.00) * (:p_ao_trx_fee / 100), 2) END AS AO_Fee, 
      CASE WHEN AJ.aj_other_adj_amt IS NULL OR AJ.aj_other_adj_amt = 0.00 THEN 0.00 
    ELSE AJ.aj_other_adj_amt - ROUND(NVL(AJ.aj_state_adj_amt, 0.00) * (:p_ao_trx_fee / 100), 2) END AS WDFW_Fee 
   FROM ADJUSTMENT AJ 
   JOIN ITEM IT ON IT.it_id = AJ.it_id 
   JOIN DISCOUNT_TYPE DT ON DT.di_id = IT.di_id 
   WHERE AJ.aj_status_ind = 'A' -- Include active adjustments only. 
   AND AJ.it_id IS NOT NULL -- Include Item Adjustments only; rows with a foreign key to the ITEM table are Item Adjustments. 
   AND AJ.ajt_id != '0' -- Unreturned Doc Charge is not an Item Adjustment, it's a Lump Sum Adjustment to the Dealers account. 
   AND IT.ic_rcn != '999' -- Exclude Dealer Fees. 
   AND AJ.aj_adjustment_date BETWEEN :P_beg_dt  -- Pacific Time
                 AND :P_end_dt
    AND (:p_discount_type IS NULL OR DT.di_id = :p_discount_type)
    WHERE-- Sales_Type = :SalesType
                 (:p_ic_rcn is null OR :p_ic_rcn = Item_Number)
                 AND (:p_dealer_id IS NULL OR Dealer_ID = :p_dealer_id)
                 AND Sales_Type = 'ADJUSTMENT'

    ORDER BY TO_DATE(SUBSTR(Transaction_Date,1,10), 'MM/DD/YYYY'), Item_Number,  -- Transaction Date, RCN (numerical order), order RCN was purchased. 
       TO_CHAR(TO_DATE(Transaction_Date, 'MM/DD/YYYY HH24:MI:SS'), 'SSSSS');

  ELSE IF :p_sales_type IS NULL 


  SELECT 
   TO_DATE(SUBSTR(Transaction_Date,1,10), 'MM/DD/YYYY'),Item_Number, 
    REGEXP_REPLACE(SUBSTR(Item_Or_Adj_Description,1,50),'([^[:print:]])',' ') AS Item_Or_Adj_Desctription, 
    Customer_Type, Document_ID, Dealer_ID, Sales_Type, Item_Quantity, Total_Fee, State_Fee, Transaction_Fee, AO_Fee, WDFW_Fee 
  FROM 
  ( 
    -- Sales Transactions 
   SELECT /*+ index(IT ITEM_X4) */ 
      TO_CHAR(IT.it_status_set_date - 2/24, 'MM/DD/YYYY HH24:MI:SS') AS Transaction_Date,  -- Pacific Time
      TO_NUMBER(IT.ic_rcn) AS Item_Number, IT.it_descr AS Item_Or_Adj_Description, 
      DT.di_name AS Customer_Type, IT.it_docid AS Document_ID, IT.ag_id AS Dealer_ID, 
      CASE WHEN UPPER(IST.is_name) = 'ACTIVE' THEN 'SALE' ELSE IST.is_name END AS Sales_Type, 
      NVL(IT.it_quantity * CASE WHEN IT.is_id = 'AC' THEN 1 WHEN IT.is_id = 'DU' THEN 1 ELSE -1 END, 0) AS Item_Quantity,  -- Dups = 1
      NVL(IT.it_state_fee * CASE WHEN IT.is_id IN ('DC','SC') THEN -1.00 ELSE 1.00 END, 0.00) + 
    NVL(IT.it_other_fee * CASE WHEN IT.is_id IN ('DC','SC') THEN -1.00 ELSE 1.00 END, 0.00) AS Total_Fee, 
      NVL(IT.it_state_fee * CASE WHEN IT.is_id IN ('DC','SC') THEN -1.00 ELSE 1.00 END, 0.00) AS State_Fee, 
      NVL(IT.it_other_fee * CASE WHEN IT.is_id IN ('DC','SC') THEN -1.00 ELSE 1.00 END, 0.00) AS Transaction_Fee, 
      CASE WHEN IT.it_other_fee IS NULL OR IT.it_other_fee = 0.00 THEN 0.00 
        ELSE ROUND(IT.it_state_fee * CASE WHEN IT.is_id IN ('DC','SC') THEN -1.00 ELSE 1.00 END * (:p_ao_trx_fee / 100), 2) 
      END AS AO_Fee, 
      CASE WHEN IT.it_other_fee IS NULL OR IT.it_other_fee = 0.00 THEN 0.00 
        ELSE (IT.it_other_fee * CASE WHEN IT.is_id IN ('DC','SC') THEN -1.00 ELSE 1.00 END) - 
          ROUND((IT.it_state_fee * CASE WHEN IT.is_id IN ('DC','SC') THEN -1.00 ELSE 1.00 END * (:p_ao_trx_fee / 100)), 2) 
      END AS WDFW_Fee 
   FROM ITEM IT 
   JOIN DISCOUNT_TYPE DT ON DT.di_id = IT.di_id 
   JOIN ITEM_STATUS_TYPE IST ON IST.is_id = IT.is_id 
   WHERE IT.it_status_ind = 'A' -- Include active ITEM rows only. 
   AND (IT.is_id IN ('AC','DC','SC') OR (IT.is_id = 'DU' AND NVL(IT.it_state_fee, 0) != 0)) -- Exclude voids, exchanges, and false duplicates.
   AND IT.ic_rcn != '999' -- Exclude Dealer Fees. 
   AND IT.it_status_set_date BETWEEN :P_beg_dt  -- Pacific Time
                 AND :P_end_dt
    AND (:p_discount_type IS NULL OR DT.di_id = :p_discount_type)
  -- AND IST.is_name = :SalesType
   UNION ALL

   -- Item Adjustments
   SELECT 
      TO_CHAR(AJ.aj_adjustment_date - 2/24, 'MM/DD/YYYY HH24:MI:SS') AS Transaction_Date,  -- Pacific Time
      TO_NUMBER(IT.ic_rcn) AS Item_Number, AJ.aj_comment AS Item_Or_Adj_Description, 
      DT.di_name AS Customer_Type, IT.it_docid AS Document_ID, AJ.ag_id AS Dealer_ID, 
      AJ.ajt_adjustment_type_name AS Sales_Type, 
      0 AS Item_Quantity, 
      NVL(AJ.aj_state_adj_amt, 0.00) + NVL(AJ.aj_other_adj_amt, 0.00) AS Total_Fee, 
      NVL(AJ.aj_state_adj_amt, 0.00) AS State_Fee, 
      NVL(AJ.aj_other_adj_amt, 0.00) AS Transaction_Fee, 
      CASE WHEN AJ.aj_other_adj_amt IS NULL OR AJ.aj_other_adj_amt = 0.00 THEN 0.00 
    ELSE ROUND(NVL(AJ.aj_state_adj_amt, 0.00) * (:p_ao_trx_fee / 100), 2) END AS AO_Fee, 
      CASE WHEN AJ.aj_other_adj_amt IS NULL OR AJ.aj_other_adj_amt = 0.00 THEN 0.00 
    ELSE AJ.aj_other_adj_amt - ROUND(NVL(AJ.aj_state_adj_amt, 0.00) * (:p_ao_trx_fee / 100), 2) END AS WDFW_Fee 
   FROM ADJUSTMENT AJ 
   JOIN ITEM IT ON IT.it_id = AJ.it_id 
   JOIN DISCOUNT_TYPE DT ON DT.di_id = IT.di_id 
   WHERE AJ.aj_status_ind = 'A' -- Include active adjustments only. 
   AND AJ.it_id IS NOT NULL -- Include Item Adjustments only; rows with a foreign key to the ITEM table are Item Adjustments. 
   AND AJ.ajt_id != '0' -- Unreturned Doc Charge is not an Item Adjustment, it's a Lump Sum Adjustment to the Dealers account. 
   AND IT.ic_rcn != '999' -- Exclude Dealer Fees. 
   AND AJ.aj_adjustment_date BETWEEN :P_beg_dt  -- Pacific Time
                 AND :P_end_dt
    AND (:p_discount_type IS NULL OR DT.di_id = :p_discount_type)
   --AND AJ.Ajt_Adjustment_Type_Name = :SalesType
  ) ReportDetails 

  WHERE         (:p_ic_rcn is null OR :p_ic_rcn = Item_Number)
                 AND (:p_dealer_id IS NULL OR Dealer_ID = :p_dealer_id)



  ORDER BY TO_DATE(SUBSTR(Transaction_Date,1,10), 'MM/DD/YYYY'), Item_Number,  -- Transaction Date, RCN (numerical order), order RCN was purchased. 
       TO_CHAR(TO_DATE(Transaction_Date, 'MM/DD/YYYY HH24:MI:SS'), 'SSSSS');


ELSE

  SELECT 
   TO_DATE(SUBSTR(Transaction_Date,1,10), 'MM/DD/YYYY'),Item_Number, 
    REGEXP_REPLACE(SUBSTR(Item_Or_Adj_Description,1,50),'([^[:print:]])',' ') AS Item_Or_Adj_Desctription, 
    Customer_Type, Document_ID, Dealer_ID, Sales_Type, Item_Quantity, Total_Fee, State_Fee, Transaction_Fee, AO_Fee, WDFW_Fee 
  FROM 
  ( 
    -- Sales Transactions 
   SELECT /*+ index(IT ITEM_X4) */ 
      TO_CHAR(IT.it_status_set_date - 2/24, 'MM/DD/YYYY HH24:MI:SS') AS Transaction_Date,  -- Pacific Time
      TO_NUMBER(IT.ic_rcn) AS Item_Number, IT.it_descr AS Item_Or_Adj_Description, 
      DT.di_name AS Customer_Type, IT.it_docid AS Document_ID, IT.ag_id AS Dealer_ID, 
      CASE WHEN UPPER(IST.is_name) = 'ACTIVE' THEN 'SALE' ELSE IST.is_name END AS Sales_Type, 
      NVL(IT.it_quantity * CASE WHEN IT.is_id = 'AC' THEN 1 WHEN IT.is_id = 'DU' THEN 1 ELSE -1 END, 0) AS Item_Quantity,  -- Dups = 1
      NVL(IT.it_state_fee * CASE WHEN IT.is_id IN ('DC','SC') THEN -1.00 ELSE 1.00 END, 0.00) + 
    NVL(IT.it_other_fee * CASE WHEN IT.is_id IN ('DC','SC') THEN -1.00 ELSE 1.00 END, 0.00) AS Total_Fee, 
      NVL(IT.it_state_fee * CASE WHEN IT.is_id IN ('DC','SC') THEN -1.00 ELSE 1.00 END, 0.00) AS State_Fee, 
      NVL(IT.it_other_fee * CASE WHEN IT.is_id IN ('DC','SC') THEN -1.00 ELSE 1.00 END, 0.00) AS Transaction_Fee, 
      CASE WHEN IT.it_other_fee IS NULL OR IT.it_other_fee = 0.00 THEN 0.00 
        ELSE ROUND(IT.it_state_fee * CASE WHEN IT.is_id IN ('DC','SC') THEN -1.00 ELSE 1.00 END * (:p_ao_trx_fee / 100), 2) 
      END AS AO_Fee, 
      CASE WHEN IT.it_other_fee IS NULL OR IT.it_other_fee = 0.00 THEN 0.00 
        ELSE (IT.it_other_fee * CASE WHEN IT.is_id IN ('DC','SC') THEN -1.00 ELSE 1.00 END) - 
          ROUND((IT.it_state_fee * CASE WHEN IT.is_id IN ('DC','SC') THEN -1.00 ELSE 1.00 END * (:p_ao_trx_fee / 100)), 2) 
      END AS WDFW_Fee 
   FROM ITEM IT 
   JOIN DISCOUNT_TYPE DT ON DT.di_id = IT.di_id 
   JOIN ITEM_STATUS_TYPE IST ON IST.is_id = IT.is_id 
   WHERE IT.it_status_ind = 'A' -- Include active ITEM rows only. 
   AND (IT.is_id IN ('AC','DC','SC') OR (IT.is_id = 'DU' AND NVL(IT.it_state_fee, 0) != 0)) -- Exclude voids, exchanges, and false duplicates.
   AND IT.ic_rcn != '999' -- Exclude Dealer Fees. 
   AND IT.it_status_set_date BETWEEN :P_beg_dt  -- Pacific Time
                 AND :P_end_dt
    AND (:p_discount_type IS NULL OR DT.di_id = :p_discount_type)
  -- AND IST.is_name = :SalesType
   UNION ALL

   -- Item Adjustments
   SELECT 
      TO_CHAR(AJ.aj_adjustment_date - 2/24, 'MM/DD/YYYY HH24:MI:SS') AS Transaction_Date,  -- Pacific Time
      TO_NUMBER(IT.ic_rcn) AS Item_Number, AJ.aj_comment AS Item_Or_Adj_Description, 
      DT.di_name AS Customer_Type, IT.it_docid AS Document_ID, AJ.ag_id AS Dealer_ID, 
      AJ.ajt_adjustment_type_name AS Sales_Type, 
      0 AS Item_Quantity, 
      NVL(AJ.aj_state_adj_amt, 0.00) + NVL(AJ.aj_other_adj_amt, 0.00) AS Total_Fee, 
      NVL(AJ.aj_state_adj_amt, 0.00) AS State_Fee, 
      NVL(AJ.aj_other_adj_amt, 0.00) AS Transaction_Fee, 
      CASE WHEN AJ.aj_other_adj_amt IS NULL OR AJ.aj_other_adj_amt = 0.00 THEN 0.00 
    ELSE ROUND(NVL(AJ.aj_state_adj_amt, 0.00) * (:p_ao_trx_fee / 100), 2) END AS AO_Fee, 
      CASE WHEN AJ.aj_other_adj_amt IS NULL OR AJ.aj_other_adj_amt = 0.00 THEN 0.00 
    ELSE AJ.aj_other_adj_amt - ROUND(NVL(AJ.aj_state_adj_amt, 0.00) * (:p_ao_trx_fee / 100), 2) END AS WDFW_Fee 
   FROM ADJUSTMENT AJ 
   JOIN ITEM IT ON IT.it_id = AJ.it_id 
   JOIN DISCOUNT_TYPE DT ON DT.di_id = IT.di_id 
   WHERE AJ.aj_status_ind = 'A' -- Include active adjustments only. 
   AND AJ.it_id IS NOT NULL -- Include Item Adjustments only; rows with a foreign key to the ITEM table are Item Adjustments. 
   AND AJ.ajt_id != '0' -- Unreturned Doc Charge is not an Item Adjustment, it's a Lump Sum Adjustment to the Dealers account. 
   AND IT.ic_rcn != '999' -- Exclude Dealer Fees. 
   AND AJ.aj_adjustment_date BETWEEN :P_beg_dt  -- Pacific Time
                 AND :P_end_dt
    AND (:p_discount_type IS NULL OR DT.di_id = :p_discount_type)
   --AND AJ.Ajt_Adjustment_Type_Name = :SalesType
  ) ReportDetails 

  WHERE        Sales_Type = :p_sales_type
                AND (:p_ic_rcn is null OR :p_ic_rcn = Item_Number)
                 AND (:p_dealer_id IS NULL OR Dealer_ID = :p_dealer_id)




  ORDER BY TO_DATE(SUBSTR(Transaction_Date,1,10), 'MM/DD/YYYY'), Item_Number,  -- Transaction Date, RCN (numerical order), order RCN was purchased. 
       TO_CHAR(TO_DATE(Transaction_Date, 'MM/DD/YYYY HH24:MI:SS'), 'SSSSS');

  END IF;
4

1 に答える 1

3

「反復回数ゼロ」の意味はわかりませんがINTO、結果を選択して使用するには、次の句ではELSIFなく句が必要ELSE IFです。

IF :p_sales_type = 'all_cancel' 
THEN
   SELECT col_list
     INTO variable_list
     FROM tables
    WHERE <where_clause>;
ELSIF :p_sales_type = 'item_adjustment' 
THEN 
   SELECT col_list
     INTO variable_list
     FROM tables
    WHERE <where_clause>;
ELSIF :p_sales_type IS NULL  
THEN
   SELECT col_list
     INTO variable_list
     FROM tables
    WHERE <where_clause>;
ELSE
   SELECT col_list
     INTO variable_list
     FROM tables
    WHERE <where_clause>;
END IF;

p_sales_type変数/パラメーターの前に偽のコロンがあります。p_sales_type最後に、意図しない不一致がないことを確認するために、UPPERasでラップする価値があるかもしれませUPPER(p_sales_type) = 'ALL_CANCEL'ん(もちろん、値の大文字と小文字が確実でない限り)。

それが役に立てば幸い...

于 2012-04-24T16:01:36.913 に答える