从另一个存储过程oracle调用存储过程

时间:2015-10-30 07:10:31

标签: oracle stored-procedures plsql compiler-errors pls-00103

我们如何从另一个存储过程调用存储过程? 下面是我的代码,我试图从另一个存储过程调用存储过程,但编译给出错误

CREATE OR REPLACE PROCEDURE USP_BookMovieTickets
(
  p_SIId number,
  p_NoOfTickets number,
  p_TicketPrice number,
  p_TicketTaxes number,
  p_TicketTotal number,
  p_EmailID varchar2
)
AS
  v_tid_         NUMBER(10);
  v_uid_         NUMBER(10);
  v_ord_         VARCHAR2(8);
  v_cnt          NUMBER(10);
  v_insertticket NUMBER(10);
  BEGIN

    execute USP_INSERTTICKETINFO( p_SIId, p_NoOfTickets, p_TicketPrice, p_TicketTaxes, p_TicketTotal);

    --EXECUTE IMMEDIATE  USP_InsertTicketInfo; p_SIId, p_NoOfTickets, p_TicketPrice, p_TicketTaxes, p_TicketTotal

    SELECT MAX(tid) INTO v_tid_ FROM bm_ticketinfo;

    SELECT COUNT(*) INTO v_cnt FROM bm_userdetails WHERE emailid = p_emailid;

    IF (v_cnt > 1) THEN

      SELECT UId INTO v_uid_
      FROM bm_userdetails WHERE emailid = p_emailid;

    ELSE

      execute USP_InsertUserDetails(' ', p_EmailID, ' ', ' ')

      --EXECUTE IMMEDIATE  USP_InsertUserDetails; '',p_EmailID,'',''

      SELECT MAX(UId) INTO v_uid_ FROM bm_userdetails;

    END IF;

    execute USP_InsertUserDetails(v_UId_, v_UId_, NULL, 17, 1,13, p_TicketTotal)

    --EXECUTE IMMEDIATE  v_Ord_; = USP_InsertBookingHistory v_UId_,v_TId_,NULL,17,1,13,p_TicketTotal
  END;
  /

错误:

Error(16,9): PLS-00103: Encountered the symbol "USP_INSERTTICKETINFO"
when expecting one of the following:     := . ( @ % ; immediate The
symbol ":=" was substituted for "USP_INSERTTICKETINFO" to continue.

1 个答案:

答案 0 :(得分:1)

相反

EXECUTE USP_INSERTTICKETINFO( p_SIId, p_NoOfTickets, p_TicketPrice,p_TicketTaxes,p_TicketTotal);

只是使用

USP_INSERTTICKETINFO( p_SIId, p_NoOfTickets, p_TicketPrice,p_TicketTaxes,p_TicketTotal);