在期待以下之一时遇到符号“TABLE”:: =。 (@%;符号“:=在”TABLE“之前插入以继续。

时间:2017-05-18 12:27:05

标签: plsqldeveloper

我写了一个函数,看起来一切都很好,但我仍然得到错误,

以下是我的功能:

create or replace FUNCTION TRANSFERQTYBTNDATES 
(
  v_startDate IN DATE,
  v_endDate IN DATE,
  v_storeid IN NUMBER,
  v_areaid IN NUMBER
)
RETURN TransferQtyBtnDates_pkg.tt_TransferQtyBtnDates_type PIPELINED
AS
   v_temp SYS_REFCURSOR;
   v_temp_1 TT_TRANSFERQTYBTNDATES%ROWTYPE;

BEGIN
   TRUNCATE TABLE tt_TransferQtyBtnDates;

   INSERT INTO tt_TransferQtyBtnDates
      SELECT isb.ItemId ,
             SUM(isb.Quantity) TransQty  ,
             isb.ExpiryDate TransExpDates  
        FROM Issues iss
               JOIN IssuedBatches isb
                ON iss.IssueRegisterId = isb.IssueRegisterId
        WHERE iss.IssueType = 'TRANSFER ACCOUNT'
                AND iss.IssuedDate BETWEEN v_startDate AND v_endDate
                AND iss.AreaId = v_areaid
                AND iss.StoreId = v_storeid
        GROUP BY isb.ItemId,isb.Quantity,isb.ExpiryDate;

      OPEN v_temp FOR
      SELECT * 
        FROM tt_TransferQtyBtnDates;

   LOOP
      FETCH v_temp INTO v_temp_1;
      EXIT WHEN v_temp%NOTFOUND;
      PIPE ROW ( v_temp_1 );
   END LOOP;
END;

在此我得到了这些错误

Error(14,13): PLS-00103: Encountered the symbol "TABLE" when expecting one of the following:     := . ( @ % ; The symbol ":= was inserted before "TABLE" to continue. 
Error(21,16): PLS-00103: Encountered the symbol "JOIN" when expecting one of the following:     , ; return returning group having intersect minus start union    where connect 

请帮帮我... 感谢

1 个答案:

答案 0 :(得分:1)

使用以下SQL替换DDL: EXECUTE IMMEDIATE' TRUNCATE TABLE tt_TransferQtyBtnDates&#39 ;;