我正在尝试在我的生产服务器上创建一个无法编译的视图 - 但是,该视图已经存在于我们的测试服务器上而没有错误。
我收到此错误:
ORA-00604: error occurred at recursive SQL level 1
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 27
然而,最令人困惑的是错误本身指向视图列定义。我不确定如何处理这个问题,再次考虑到我们的测试环境中存在相同的例程而没有任何问题。
以下是视图,并警告它非常大:
CREATE OR REPLACE FORCE VIEW V2RPT.VW_DM
(
ACCESSION_LABEL,
RECEIVED_DATE,
ACCESSIONING_TS,
TTR_TUMOR_TYPE_INFO,
SPEC_TYPE,
TUMOR_TYPE,
TUMOR_SUBTYPE,
PRIM_MET,
TUMOR_SITE,
EXTRACT_DATE,
CELL_SOURCE_STATUS,
MIXTURE_STATUS,
PLATE_STATUS,
CS_TERM_REASON,
ASSAYS_ORDERED,
ASSAYS_REPORTED,
AOF_GEN_TS,
AOF_TRANS_TS,
AOF_PROC_TS,
FIRST_TERM_REPORT_TRANS_TS,
COMPLETE_WITHOUT_REPORT_TS,
RELATED_CELL_SOURCE,
FACILITY,
RELEASED_DATE,
IHC_DATE, --Error is happening here
T,
M,
N,
TUMOR_STAGE,
TUMOR_GRADE,
TUMOR_DIFF,
I_COUNT,
R_COUNT,
N_COUNT,
MIXTURE_ID,
PLATED_TS,
TREATED_TS,
FIXED_STAINED_TS,
SCANNED_TS,
COUNTED_TS,
ASSAYS_PLATED,
CELL_YIELD,
EXPLANTED_BY,
REPLATE,
AVG_CONTROL,
CELL_SUSPENSION_CREATOR,
CELL_SUSPENSION_TS,
IN_CULTURE_TS,
ENOUGH_CELLS_TS,
MIXTURE_ON_PLATE_TS,
TERM_MIXTURE_TS,
MIXTURE_TERM_REASON,
COMPLETE_TS,
VALIDATED_TS,
SALES_REP,
DRUG_SEL_TS,
DRUGS_ON_PANEL,
FINAL_PATH_COMP_TS,
PHYSICIAN,
CELL_SOURCE_TYPE_ID,
LXWXH,
PCT_SOLID,
PCT_FATTY,
PCT_FIBROUS,
PCT_BLOODY,
PCT_NECROTIC,
PCT_OTHER,
LESS_THAN_100MG,
OVERSIZED,
UNDERSIZED,
FLASK_TYPE,
VITROGEN_COATED,
AB_WASH_REQUIRED,
DIM_X,
DIM_Y,
DIM_Z,
MANUAL_PLATE,
LAB_SITE_ABBR,
REGION_TERRITORY,
MEDIUM_TYPE,
TUMOR_TYPE_FP,
TUMOR_TYPE_PP,
CR_ENTRY_CREATOR,
CR_ENTRY_CREATED_TS,
ICC_ENTRY_CREATOR,
ICC_ENTRY_CREATED_TS,
AOF_TRANS_CREATOR
)
AS
SELECT cs.accession_label,
cs.received_date,
cs.created_timestamp AS ACCESSIONING_TS,
PW.TTR_TUMOR_TYPE_INFO,
VW_CS.SPEC_TYPE,
VW_CS.TUMOR_TYPE,
VW_CS.TUMOR_SUBTYPE,
VW_CS.PRIM_MET,
VW_CS.TUMOR_SITE,
VW_CS.EXTRACT_DATE,
VW_CS.CELL_SOURCE_STATUS,
VW_CS.MIXTURE_STATUS,
VW_CS.PLATE_STATUS,
VW_CS.CS_TERM_REASON,
VW_CS.ASSAYS_ORDERED,
VW_CS.ASSAYS_REPORTED,
VW_CS.AOF_GEN_TS,
VW_CS.AOF_TRANS_TS,
VW_CS.AOF_PROC_TS,
VW_CS.FIRST_TERM_REPORT_TRANS_TS,
VW_CS.COMPLETE_WITHOUT_REPORT_TS,
VW_CS.RELATED_CELL_SOURCE,
VW_CS.VW_CS.FACILITY,
VW_CS.RELEASED_DATE,
VW_CS.IHC_DATE,
VW_CS.T,
VW_CS.M,
VW_CS.N,
VW_CS.TUMOR_STAGE,
VW_CS.TUMOR_GRADE,
VW_CS.TUMOR_DIFF,
VW_CS.I_COUNT,
VW_CS.R_COUNT,
VW_CS.N_COUNT,
MIXTURE.TERM_MC_MIXTURE_ID AS Mixture_ID,
MIXTURE.PLATED_TS,
MIXTURE.TREATED_TS,
MIXTURE.FIXED_STAINED_TS,
MIXTURE.SCANNED_TS,
MIXTURE.COUNTED_TS,
Mixture.Assays_Plated,
Mixture.CELL_YIELD,
Mixture.EXPLANTED_BY,
NVL (Mixture.REPLATE, 0) Replate,
Mixture.AVG_CONTROL,
Mixture.CELL_SUSPENSION_CREATOR,
Mixture.CELL_SUSPENSION_TS,
Mixture.IN_CULTURE_TS,
Mixture.ENOUGH_CELLS_TS,
Mixture.MIXTURE_ON_PLATE_TS,
Mixture.TERM_MIXTURE_TS,
Mixture.MIXTURE_TERM_REASON,
Mixture.COMPLETE_TS,
Mixture.VALIDATED_TS,
PW.SALES_REP,
PW.DRUG_SEL_TS,
PW.DRUGS_ON_PANEL,
PW.FINAL_PATH_COMP_TS,
PW.PHYSICIAN,
CS.CELL_SOURCE_TYPE_ID,
VW_CS.LXWXH,
VW_CS.PCT_SOLID,
VW_CS.PCT_FATTY,
VW_CS.PCT_FIBROUS,
VW_CS.PCT_BLOODY,
VW_CS.PCT_NECROTIC,
VW_CS.PCT_OTHER,
VW_CS.LESS_THAN_100MG,
VW_CS.OVERSIZED,
VW_CS.UNDERSIZED,
MIXTURE.FLASK_TYPE,
MIXTURE.VITROGEN_COATED,
VW_CS.AB_WASH_REQUIRED,
VW_CS.DIM_X,
VW_CS.DIM_Y,
VW_CS.DIM_Z,
MIXTURE.MANUAL_PLATE,
CS.LAB_SITE_ABBR,
V2.CRM_ACCOUNT_ADDRESS.STATE REGION_TERRITORY,
MIXTURE.MEDIUM_TYPE,
VW_CS.TUMOR_TYPE_FP,
VW_CS.TUMOR_TYPE_PP,
MIXTURE.CR_ENTRY_CREATOR,
MIXTURE.CR_ENTRY_CREATED_TS,
MIXTURE.ICC_ENTRY_CREATOR,
MIXTURE.ICC_ENTRY_CREATED_TS,
VW_CS.AOF_TRANS_CREATOR
FROM V2.cell_Source cs
INNER JOIN V2RPT.TEMP_DM_CS_TYPE
ON CS.CELL_SOURCE_TYPE_ID =
V2RPT.TEMP_DM_CS_TYPE.CELL_SOURCE_TYPE_ID
LEFT OUTER JOIN V2RPT.TEMP_DM_CS VW_CS
ON CS.CELL_SOURCE_ID = VW_CS.CELL_SOURCE_ID
LEFT OUTER JOIN V2RPT.TEMP_DM_MIXTURE MIXTURE
ON MIXTURE.cell_Source_id = CS.CELL_SOURCE_ID
LEFT OUTER JOIN V2RPT.VW_DM_PW PW
ON PW.cell_source_ID = cs.cell_source_ID
LEFT OUTER JOIN V2.CRM_ACCOUNT
ON V2.CRM_ACCOUNT.CRM_ACCOUNT_ID = CS.CRM_ACCOUNT_ID
LEFT OUTER JOIN ( SELECT MAX (
V2.CRM_ACCOUNT_ADDRESS.
CRM_ACCOUNT_ADDRESS_ID)
Max_AA_ID,
V2.CRM_ACCOUNT_ADDRESS.CRM_ACCOUNT_ID
FROM V2.CRM_ACCOUNT_ADDRESS
GROUP BY V2.CRM_ACCOUNT_ADDRESS.CRM_ACCOUNT_ID) Max_AA
ON Max_AA.CRM_ACCOUNT_ID = V2.CRM_ACCOUNT.CRM_ACCOUNT_ID
LEFT OUTER JOIN V2.CRM_ACCOUNT_ADDRESS
ON V2.CRM_ACCOUNT_ADDRESS.CRM_ACCOUNT_ADDRESS_ID =
max_aa.Max_AA_ID;
我有点失落 - 有什么想法吗?我的意思是,甚至没有任何变量赋值,所以我不知道'字符串缓冲区可能太小'
感谢帮助。
答案 0 :(得分:4)
在创建视图时,您是否在数据库上触发了任何触发器?对我来说,行error occurred at recursive SQL level 1
表示触发器中存在错误。也许有某种审计触发器是审计正在创建的对象,而您创建的视图太大而无法应对此触发器?
以下是创建视图时如何生成与您的错误类似的错误的演示。首先,我们创建一个触发器,当您尝试创建某些内容时会导致character string buffer too small
错误。可能是导致您出现问题的触发器并不是那么愚蠢:
SQL> create or replace trigger error_trigger 2 before create on database 3 declare 4 a varchar(1); 5 begin 6 a := '12'; 7 end; 8 / Trigger created.
现在,当我们尝试创建视图时,会出现错误:
SQL> create view some_view as select * from dual; create view some_view as select * from dual * ERROR at line 1: ORA-00604: error occurred at recursive SQL level 1 ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06512: at line 4
这个视图与PL / SQL或字符串缓冲区无关,甚至没有第4行,但由于我们创建的触发器,我们仍然会得到上述错误。使用此触发器,第1行(declare
)是触发器本身的第一行,而不是创建它的create trigger
语句,因此第4行是行a := '12';
。
要跟踪此触发器,我们可以查询dba_triggers
数据字典视图。在下面的示例中,它出现在底行:
SQL> select trigger_name, trigger_type, owner from dba_triggers 2 where trigger_type in ('BEFORE EVENT', 'AFTER EVENT'); TRIGGER_NAME TRIGGER_TYPE OWNER ------------------------------ ---------------- ------------------------------ AW_DROP_TRG AFTER EVENT SYS AW_TRUNC_TRG AFTER EVENT SYS AW_REN_TRG AFTER EVENT SYS XDB_PI_TRIG BEFORE EVENT SYS SDO_DROP_USER AFTER EVENT MDSYS SDO_ST_SYN_CREATE BEFORE EVENT MDSYS SDO_TOPO_DROP_FTBL BEFORE EVENT MDSYS ERROR_TRIGGER BEFORE EVENT LUKE