【发布时间】:2015-06-20 09:56:18
【问题描述】:
我是甲骨文的新手, 我正在尝试的是, 我有一个 xml,我尝试在 oracle 数据库表中插入相同的内容,当我尝试插入它时,我已经形成了一个查询。我收到一些错误,例如
错误报告 - ORA-06550:第 35 行,第 84 列: PL/SQL: ORA-00933: SQL 命令未正确结束 ORA-06550:第 5 行,第 2 列: PL/SQL:忽略 SQL 语句 06550. 00000 - “第 %s 行,第 %s 列:\n%s” *原因:通常是 PL/SQL 编译错误。 *行动:
我无法弄清楚我错过了什么,建议我如何更改查询,
这是我正在尝试工作的 XML 和查询。
- <call>
- <callSummary>
<indId>100</indId>
<notificationNo>notification</notificationNo>
<orderNo>orderno</orderNo>
</callSummary>
- <callList>
- <callDetails>
<maintenancetype>1</maintenancetype>
<serialNo>1</serialNo>
<unitType>unit type</unitType>
</callDetails>
- <callDetails>
<maintenancetype>1</maintenancetype>
<serialNo>2</serialNo>
<unitType>unit type</unitType>
</callDetails>
- <callDetails>
<maintenancetype>2</maintenancetype>
<serialNo>1</serialNo>
<unitType>unit type</unitType>
</callDetails>
- <callDetails>
<maintenancetype>2</maintenancetype>
<serialNo>2</serialNo>
<unitType>unit type</unitType>
</callDetails>
</callList>
</call>
我的查询是
DECLARE
call_xml XMLTYPE := xmltype('<call><callSummary><indId>100</indId><notificationNo>notification</notificationNo><orderNo>orderno</orderNo><</callSummary><callList><callDetails><maintenancetype>1</maintenancetype><serialNo>1</serialNo><unitType>unit type</unitType></callDetails><callDetails><maintenancetype>1</maintenancetype><serialNo>2</serialNo><unitType>unit type</unitType></callDetails><callDetails><maintenancetype>2</maintenancetype><serialNo>1</serialNo><unitType>unit type</unitType></callDetails><callDetails><maintenancetype>2</maintenancetype><serialNo>2</serialNo><unitType>unit type</unitType></callDetails></callList></call>');
BEGIN
INSERT INTO ORDER_DETAILS (
IND_ID,NOTIFICATION_NO,ORDER_NO,MAINT_TYPE,SERIAL_NO,UNIT_TYPE)
SELECT
call_xml.value('call/callSummary/indId[1]','CLNT(3)'),
call_xml.value('call/callSummary/notificationNo[1]','CHAR(12)'),
call_xml.value('call/callSummary/orderNo[1]','CHAR(12)'),
call_xml.value('call/callSummary/callList/callDetails/maintenancetype[1]','CHAR(1)'),
call_xml.value('call/callSummary/callList/callDetails/serialNo[1]','CHAR(1)'),
call_xml.value('call/callSummary/callList/callDetails/unitType[1]','CHAR(20)') from call_xml.nodes('call');
END;
我希望你能提前理解我的问题,谢谢。
【问题讨论】:
-
插入语句应包含
INTO。尝试调整,看看错误是否解决。 -
@Parfait 是的,我包含并尝试过..它再次显示相同的错误
标签: sql database oracle11g oracle10g procedures