从另一个存储过程 oracle 调用存储过程
Posted
技术标签:
【中文标题】从另一个存储过程 oracle 调用存储过程【英文标题】:Calling stored procedure from another stored procedure oracle 【发布时间】:2015-10-30 07:10:31 【问题描述】:我们如何从另一个存储过程调用一个存储过程? 下面是我的代码,我试图从另一个存储过程中调用一个存储过程,但是编译会出错
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】:相反
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);
【讨论】:
以上是关于从另一个存储过程 oracle 调用存储过程的主要内容,如果未能解决你的问题,请参考以下文章