我在存储过程下面写,并且缺少右括号错误。当我只尝试查询时它起作用了,但是当我在 oracle 12c 中运行完整的存储过程脚本时它会抛出错误。我使用 REGEXP_SUBSTR 表达式的行有错误。如果我将其注释掉,则 proc 运行时不会出现任何错误。请提出解决方案。
PROMPT ** Creating stored procedure TAHolidayCal_FindBrkCls *********************
CREATE OR REPLACE PACKAGE TAHolidayCal_FindBrkClsPkg AS
TYPE RT1 IS RECORD (
InstrumentID Instrument.InstrumentID%TYPE,
Status Instrument.Status%TYPE,
Product Instrument.Product%TYPE,
SysDescription Instrument.SysDescription%TYPE,
TradeAdminStatus EXTTradeStatus.TradeAdminStatus%TYPE,
PayDate InstCfl.PayDate%TYPE
);
TYPE RCT1 IS REF CURSOR RETURN RT1;
END;
/
CREATE OR REPLACE PROCEDURE TAHolidayCal_FindBrkCls
(
calDate DATE,
holCalID CHAR,
InstID01 CHAR ,InstID02 CHAR DEFAULT NULL,InstID03 CHAR DEFAULT NULL,InstID04 CHAR DEFAULT NULL,InstID05 CHAR DEFAULT NULL,InstID06 CHAR DEFAULT NULL,InstID07 CHAR DEFAULT NULL,
InstID08 CHAR DEFAULT NULL,InstID09 CHAR DEFAULT NULL,InstID10 CHAR DEFAULT NULL,InstID11 CHAR DEFAULT NULL,InstID12 CHAR DEFAULT NULL,InstID13 CHAR DEFAULT NULL,InstID14 CHAR DEFAULT NULL,
InstID15 CHAR DEFAULT NULL,InstID16 CHAR DEFAULT NULL,InstID17 CHAR DEFAULT NULL,InstID18 CHAR DEFAULT NULL,InstID19 CHAR DEFAULT NULL,InstID20 CHAR DEFAULT NULL,InstID21 CHAR DEFAULT NULL,
InstID22 CHAR DEFAULT NULL,InstID23 CHAR DEFAULT NULL,InstID24 CHAR DEFAULT NULL,InstID25 CHAR DEFAULT NULL,InstID26 CHAR DEFAULT NULL,InstID27 CHAR DEFAULT NULL,InstID28 CHAR DEFAULT NULL,
InstID29 CHAR DEFAULT NULL,InstID30 CHAR DEFAULT NULL,InstID31 CHAR DEFAULT NULL,InstID32 CHAR DEFAULT NULL,InstID33 CHAR DEFAULT NULL,InstID34 CHAR DEFAULT NULL,InstID35 CHAR DEFAULT NULL,
InstID36 CHAR DEFAULT NULL,InstID37 CHAR DEFAULT NULL,InstID38 CHAR DEFAULT NULL,InstID39 CHAR DEFAULT NULL,InstID40 CHAR DEFAULT NULL,InstID41 CHAR DEFAULT NULL,InstID42 CHAR DEFAULT NULL,
InstID43 CHAR DEFAULT NULL,InstID44 CHAR DEFAULT NULL,InstID45 CHAR DEFAULT NULL,InstID46 CHAR DEFAULT NULL,InstID47 CHAR DEFAULT NULL,InstID48 CHAR DEFAULT NULL,InstID49 CHAR DEFAULT NULL,
InstID50 CHAR DEFAULT NULL,InstID51 CHAR DEFAULT NULL,InstID52 CHAR DEFAULT NULL,InstID53 CHAR DEFAULT NULL,InstID54 CHAR DEFAULT NULL,InstID55 CHAR DEFAULT NULL,InstID56 CHAR DEFAULT NULL,
InstID57 CHAR DEFAULT NULL,InstID58 CHAR DEFAULT NULL,InstID59 CHAR DEFAULT NULL,InstID60 CHAR DEFAULT NULL,InstID61 CHAR DEFAULT NULL,InstID62 CHAR DEFAULT NULL,InstID63 CHAR DEFAULT NULL,
InstID64 CHAR DEFAULT NULL,InstID65 CHAR DEFAULT NULL,InstID66 CHAR DEFAULT NULL,InstID67 CHAR DEFAULT NULL,InstID68 CHAR DEFAULT NULL,InstID69 CHAR DEFAULT NULL,InstID70 CHAR DEFAULT NULL,
InstID71 CHAR DEFAULT NULL,InstID72 CHAR DEFAULT NULL,InstID73 CHAR DEFAULT NULL,InstID74 CHAR DEFAULT NULL,InstID75 CHAR DEFAULT NULL,InstID76 CHAR DEFAULT NULL,InstID77 CHAR DEFAULT NULL,
InstID78 CHAR DEFAULT NULL,InstID79 CHAR DEFAULT NULL,InstID80 CHAR DEFAULT NULL,InstID81 CHAR DEFAULT NULL,InstID82 CHAR DEFAULT NULL,InstID83 CHAR DEFAULT NULL,InstID84 CHAR DEFAULT NULL,
InstID85 CHAR DEFAULT NULL,InstID86 CHAR DEFAULT NULL,InstID87 CHAR DEFAULT NULL,InstID88 CHAR DEFAULT NULL,InstID89 CHAR DEFAULT NULL,InstID90 CHAR DEFAULT NULL,InstID91 CHAR DEFAULT NULL,
InstID92 CHAR DEFAULT NULL,InstID93 CHAR DEFAULT NULL,InstID94 CHAR DEFAULT NULL,InstID95 CHAR DEFAULT NULL,InstID96 CHAR DEFAULT NULL,InstID97 CHAR DEFAULT NULL,InstID98 CHAR DEFAULT NULL,
InstID99 CHAR DEFAULT NULL,InstID100 CHAR DEFAULT NULL,
RC1 IN OUT TAHolidayCal_FindBrkClsPkg.RCT1
)
AS
BEGIN
OPEN RC1 FOR
SELECT DISTINCT i.InstrumentID, i.Status, i.Product, i.SysDescription, e.TradeAdminStatus, TRUNC(TAHolidayCal_FindBrkCls.calDate) AS PayDate
FROM Instrument i LEFT OUTER JOIN EXTTradeStatus e
ON ( i.InstrumentID = e.InstrumentID ) AND ( i.VersionNumber = e.VersionNumber )
INNER JOIN EXTBreakClause b
ON ( i.InstrumentID = b.InstrumentID ) AND ( i.VersionNumber = b.VersionNumber )
WHERE i.VersionNumber = 0
AND i.InstrumentID in
(
TAHolidayCal_FindBrkCls.InstID01,TAHolidayCal_FindBrkCls.InstID02,TAHolidayCal_FindBrkCls.InstID03,TAHolidayCal_FindBrkCls.InstID04,
TAHolidayCal_FindBrkCls.InstID05,TAHolidayCal_FindBrkCls.InstID06,TAHolidayCal_FindBrkCls.InstID07,TAHolidayCal_FindBrkCls.InstID08,
TAHolidayCal_FindBrkCls.InstID09,TAHolidayCal_FindBrkCls.InstID10,TAHolidayCal_FindBrkCls.InstID11,TAHolidayCal_FindBrkCls.InstID12,
TAHolidayCal_FindBrkCls.InstID13,TAHolidayCal_FindBrkCls.InstID14,TAHolidayCal_FindBrkCls.InstID15,TAHolidayCal_FindBrkCls.InstID16,
TAHolidayCal_FindBrkCls.InstID17,TAHolidayCal_FindBrkCls.InstID18,TAHolidayCal_FindBrkCls.InstID19,TAHolidayCal_FindBrkCls.InstID20,
TAHolidayCal_FindBrkCls.InstID21,TAHolidayCal_FindBrkCls.InstID22,TAHolidayCal_FindBrkCls.InstID23,TAHolidayCal_FindBrkCls.InstID24,
TAHolidayCal_FindBrkCls.InstID25,TAHolidayCal_FindBrkCls.InstID26,TAHolidayCal_FindBrkCls.InstID27,TAHolidayCal_FindBrkCls.InstID28,
TAHolidayCal_FindBrkCls.InstID29,TAHolidayCal_FindBrkCls.InstID30,TAHolidayCal_FindBrkCls.InstID31,TAHolidayCal_FindBrkCls.InstID32,
TAHolidayCal_FindBrkCls.InstID33,TAHolidayCal_FindBrkCls.InstID34,TAHolidayCal_FindBrkCls.InstID35,TAHolidayCal_FindBrkCls.InstID36,
TAHolidayCal_FindBrkCls.InstID37,TAHolidayCal_FindBrkCls.InstID38,TAHolidayCal_FindBrkCls.InstID39,TAHolidayCal_FindBrkCls.InstID40,
TAHolidayCal_FindBrkCls.InstID41,TAHolidayCal_FindBrkCls.InstID42,TAHolidayCal_FindBrkCls.InstID43,TAHolidayCal_FindBrkCls.InstID44,
TAHolidayCal_FindBrkCls.InstID45,TAHolidayCal_FindBrkCls.InstID46,TAHolidayCal_FindBrkCls.InstID47,TAHolidayCal_FindBrkCls.InstID48,
TAHolidayCal_FindBrkCls.InstID49,TAHolidayCal_FindBrkCls.InstID50,TAHolidayCal_FindBrkCls.InstID51,TAHolidayCal_FindBrkCls.InstID52,
TAHolidayCal_FindBrkCls.InstID53,TAHolidayCal_FindBrkCls.InstID54,TAHolidayCal_FindBrkCls.InstID55,TAHolidayCal_FindBrkCls.InstID56,
TAHolidayCal_FindBrkCls.InstID57,TAHolidayCal_FindBrkCls.InstID58,TAHolidayCal_FindBrkCls.InstID59,TAHolidayCal_FindBrkCls.InstID60,
TAHolidayCal_FindBrkCls.InstID61,TAHolidayCal_FindBrkCls.InstID62,TAHolidayCal_FindBrkCls.InstID63,TAHolidayCal_FindBrkCls.InstID64,
TAHolidayCal_FindBrkCls.InstID65,TAHolidayCal_FindBrkCls.InstID66,TAHolidayCal_FindBrkCls.InstID67,TAHolidayCal_FindBrkCls.InstID68,
TAHolidayCal_FindBrkCls.InstID69,TAHolidayCal_FindBrkCls.InstID70,TAHolidayCal_FindBrkCls.InstID71,TAHolidayCal_FindBrkCls.InstID72,
TAHolidayCal_FindBrkCls.InstID73,TAHolidayCal_FindBrkCls.InstID74,TAHolidayCal_FindBrkCls.InstID75,TAHolidayCal_FindBrkCls.InstID76,
TAHolidayCal_FindBrkCls.InstID77,TAHolidayCal_FindBrkCls.InstID78,TAHolidayCal_FindBrkCls.InstID79,TAHolidayCal_FindBrkCls.InstID80,
TAHolidayCal_FindBrkCls.InstID81,TAHolidayCal_FindBrkCls.InstID82,TAHolidayCal_FindBrkCls.InstID83,TAHolidayCal_FindBrkCls.InstID84,
TAHolidayCal_FindBrkCls.InstID85,TAHolidayCal_FindBrkCls.InstID86,TAHolidayCal_FindBrkCls.InstID87,TAHolidayCal_FindBrkCls.InstID88,
TAHolidayCal_FindBrkCls.InstID89,TAHolidayCal_FindBrkCls.InstID90,TAHolidayCal_FindBrkCls.InstID91,TAHolidayCal_FindBrkCls.InstID92,
TAHolidayCal_FindBrkCls.InstID93,TAHolidayCal_FindBrkCls.InstID94,TAHolidayCal_FindBrkCls.InstID95,TAHolidayCal_FindBrkCls.InstID96,
TAHolidayCal_FindBrkCls.InstID97,TAHolidayCal_FindBrkCls.InstID98,TAHolidayCal_FindBrkCls.InstID99,TAHolidayCal_FindBrkCls.InstID100
)
AND TAHolidayCal_FindBrkCls.holCalID in
(
SELECT REGEXP_SUBSTR((extract(value(NHC), 'NotificationHolidayCalendar/text()')).getStringVal(),'[^,]+',1,LEVEL)
FROM table(xmlsequence(extract(XMLType(b.BreakClauseDefn, 1), '/Definitions/BreakDefn/NotificationHolidayCalendar'))) NHC
CONNECT BY REGEXP_SUBSTR((extract(value(NHC), 'NotificationHolidayCalendar/text()')).getStringVal(),'[^,]+',1,LEVEL) IS NOT NULL order by 1
);
END;
/
SHOW ERRORS;
EXECUTE DROP_SYNONYM ('TAHolidayCal_FindBrkCls')
EXECUTE CREATE_SYNONYM ('TAHolidayCal_FindBrkCls')
EXECUTE CREATE_PERMISSIONS ('TAHolidayCal_FindBrkCls')