基本上我试图传递一个xml字符串到存储过程。XML字符串作为clob传递给oracle存储过程
我在读第一个尝试和解析XML具有以下优良工程:
下面提供基于上述例子select * FROM xmltable('//list//model.ProfilingSync'
passing xmlType.createxml('<list>
<model.ProfilingSync>
<screDocId>106</screDocId>
<evalStatCd>B</evalStatCd>
<evalChgDt>2014-2-13 9:41:49. 260034000</evalChgDt>
<ssn>000001060</ssn>
<evalRptIndivCd>A</evalRptIndivCd>
<rankAb>WO1</rankAb>
<indTypCd>A</indTypCd>
<civPayPlanCd>AB</civPayPlanCd>
<performanceTypCd/>
<performanceCd/>
<redactPerfCd/>
<civPayGrLvlNr>AB</civPayGrLvlNr>
</model.ProfilingSync>
<model.ProfilingSync>
<screDocId>106</screDocId>
<evalStatCd>B</evalStatCd>
<evalChgDt>2014-2-13 9:41:49. 260034000</evalChgDt>
<ssn>724629831</ssn>
<evalRptIndivCd>B</evalRptIndivCd>
<rankAb/>
<indTypCd>A</indTypCd>
<civPayPlanCd>ES</civPayPlanCd>
<performanceTypCd>100</performanceTypCd>
<performanceCd>1000</performanceCd>
<redactPerfCd>1000</redactPerfCd>
<civPayGrLvlNr>6</civPayGrLvlNr>
</model.ProfilingSync>
<model.ProfilingSync>
<screDocId>106</screDocId>
<evalStatCd>B</evalStatCd>
<evalChgDt>2014-2-13 9:41:49. 260034000</evalChgDt>
<ssn>001623791</ssn>
<evalRptIndivCd>D</evalRptIndivCd>
<rankAb>GEN</rankAb>
<indTypCd>A</indTypCd>
<civPayPlanCd>AB</civPayPlanCd>
<performanceTypCd>130</performanceTypCd>
<performanceCd>1160</performanceCd>
<redactPerfCd/>
<civPayGrLvlNr>AB</civPayGrLvlNr>
</model.ProfilingSync>
</list>')
columns SRC_DOC_ID NUMBER path '//screDocId',
EVAL_STAT_CD varchar(4) path '//evalStatCd',
EVAL_CHG_DT VARCHAR(200) path '//evalChgDt',
SSN VARCHAR(9) path '//ssn',
EVAL_RPT_INDIV_CD VARCHAR(4) path '//evalRptIndivCd',
RANK_AB VARCHAR(4) path '//rankAb',
PERFORMANCE_TYP_CD NUMBER path '//performanceTypCd',
PERFORMANCE_CD NUMBER path '//performanceCd',
REDACT_PERF_CD VARCHAR(4) path '//redactPerfCd',
IND_TYP_CD VARCHAR(4) path '//indTypCd',
CIV_PAY_PLAN_CD VARCHAR(4) path '//civPayPlanCd',
CIV_PAY_GR_LVL_NR VARCHAR(4) path '//civPayGrLvlNr') my_profiling_xml_table;
我的存储proceedure也正常编译:
create or replace PROCEDURE CU_SEPS_PROFILING_IMPORT ( P_XML_STRING IN CLOB
, P_RECORDSET OUT SYS_REFCURSOR
) /* Returns a list of evals with person info that have been completed from today back to the submitted date. VAR RC REFCURSOR; EXECUTE CU_SEPS_PROFILING_IMPORT ('P_XML_STRING',P_RECORDSET => :RC) print :rc; */
AS BEGIN OPEN P_RECORDSET FOR
SELECT * FROM xmltable('//list//model.ProfilingSync' passing XMLTYPE(P_XML_STRING) columns SRC_DOC_ID xmltype path '//screDocId', EVAL_STAT_CD xmltype path '//evalStatCd', EVAL_CHG_DT xmltype path '//evalChgDt', SSN xmltype path '//ssn', EVAL_RPT_INDIV_CD xmltype path '//evalRptIndivCd', RANK_AB xmltype path '//rankAb', PERFORMANCE_TYP_CD xmltype path '//performanceTypCd', PERFORMANCE_CD xmltype path '//performanceCd', REDACT_PERF_CD xmltype path '//redactPerfCd', IND_TYP_CD xmltype path '//indTypCd', CIV_PAY_PLAN_CD xmltype path '//civPayPlanCd', CIV_PAY_GR_LVL_NR xmltype path '//civPayGrLvlNr') my_profiling_xml_table; END CU_SEPS_PROFILING_IMPORT;
但是,当我尝试t我认为这是我希望有人能找到我的错误的地方。
VAR RC REFCURSOR;
EXECUTE CU_SEPS_PROFILING_IMPORT ('<list>
<model.ProfilingSync>
<screDocId>106</screDocId>
<evalStatCd>B</evalStatCd>
<evalChgDt>204-2-13 9:41:49. 260034000</evalChgDt>
<ssn>000001060</ssn>
<evalRptIndivCd>A</evalRptIndivCd>
<rankAb>WO1</rankAb>
<indTypCd>A</indTypCd>
<civPayPlanCd>AB</civPayPlanCd>
<performanceTypCd/>
<performanceCd/>
<redactPerfCd/>
<civPayGrLvlNr>AB</civPayGrLvlNr>
</model.ProfilingSync>
<model.ProfilingSync>
<screDocId>106</screDocId>
<evalStatCd>B</evalStatCd>
<evalChgDt>2014-2-13 9:41:49. 260034000</evalChgDt>
<ssn>724629831</ssn>
<evalRptIndivCd>B</evalRptIndivCd>
<rankAb/>
<indTypCd>A</indTypCd>
<civPayPlanCd>ES</civPayPlanCd>
<performanceTypCd>100</performanceTypCd>
<performanceCd>1000</performanceCd>
<redactPerfCd>1000</redactPerfCd>
<civPayGrLvlNr>6</civPayGrLvlNr>
</model.ProfilingSync>
<model.ProfilingSync>
<screDocId>106</screDocId>
<evalStatCd>B</evalStatCd>
<evalChgDt>2014-2-13 9:41:49. 260034000</evalChgDt>
<ssn>001623791</ssn>
<evalRptIndivCd>D</evalRptIndivCd>
<rankAb>GEN</rankAb>
<indTypCd>A</indTypCd>
<civPayPlanCd>AB</civPayPlanCd>
<performanceTypCd>130</performanceTypCd>
<performanceCd>1160</performanceCd>
<redactPerfCd/>
<civPayGrLvlNr>AB</civPayGrLvlNr>
</model.ProfilingSync>
</list>', p_recordset => :RC);
print :rc;
在这一点上,我得到以下错误:
Error starting at line 3 in command:
EXECUTE CU_SEPS_PROFILING_IMPORT ('<list>
Error report:
ORA-06550: line 1, column 33:
PLS-00103: Encountered the symbol "<list>; END;" when expecting one of the following:
() - + case mod new not null <an identifier>
<a double-quoted delimited-identifier> <a bind variable>
table continue avg count current exists max min prior sql
stddev sum variance execute multiset the both leading
trailing forall merge year month day hour minute second
timezone_hour timezone_minute timezone_region timezone_abbr
time timestamp interval date
<a string literal with character set spe
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
预先感谢帮助!
嗯,所以,看来,当我删除所有空格在xml字符串它运行良好。奇怪... – saipanman