1

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

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.
4

1 回答 1

4

反而

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);
于 2015-10-30T07:12:27.860 回答