|
|
Re: PROBLEM WHILE USING XMLTYPE AS INPUT PARAMETER [message #345049 is a reply to message #344996] |
Tue, 02 September 2008 03:49 |
manickam
Messages: 9 Registered: June 2005 Location: chennai
|
Junior Member |
|
|
Procedure ExportMilestones works fine while converting clob into xmltype as the value is assigned inside the procedure.
create or replace procedure ExportMilestones(XML_IN clob := null,
out_output out sys_refcursor) is
X xmltype;
XML_IN1 clob;
begin
XML_IN1 := '<ArrayOfMilestoneBO><MilestoneBO MilestoneID="26981"
ResponsibilityMilestone="1219" IsExported="false" XMLNodeCount="0" />
<MilestoneBO MilestoneID="26982"
ResponsibilityMilestone="1219" IsExported="false" XMLNodeCount="0" /></ArrayOfMilestoneBO>';
--Assigning values inside the procedure
X := XMLTYPE(XML_IN1);
open out_output for
SELECT EXTRACTVALUE(VALUE(t), '/MilestoneBO/@MilestoneID') dim_id,
EXTRACTVALUE(VALUE(t), '/MilestoneBO/@ResponsibilityMilestone') dim_id1
FROM TABLE(XMLSEQUENCE(EXTRACT(x, '/ArrayOfMilestoneBO/MilestoneBO'))) t,
TABLE(XMLSEQUENCE(EXTRACT(VALUE(t),
'/ArrayOfMilestoneBO/MilestoneBO')))(+) tx;
end ExportMilestones;
Procedure ExportMilestones1 doesnot works , conversion fails while converting clob into xmltype as the value is assigned through the input parameter.
create or replace procedure ExportMilestones1(XML_IN clob :=null,
out_output out sys_refcursor) is
X xmltype;
XML_IN1 clob;
begin
/*
XML_IN1 := '<ArrayOfMilestoneBO><MilestoneBO MilestoneID="26981" PlannedDate="0001-01-01T00:00:00"
CompleteDate="0001-01-01T00:00:00" ResponsibilityMilestone="1219" IsExported="false" XMLNodeCount="0" />
<MilestoneBO MilestoneID="26982" PlannedDate="0001-01-01T00:00:00" CompleteDate="0001-01-01T00:00:00"
ResponsibilityMilestone="1219" IsExported="false" XMLNodeCount="0" /></ArrayOfMilestoneBO>';
*/
--ASSINGNING VALUES TO X FROM IN PARAMETER XML_IN
X := XMLTYPE(XML_IN);
open out_output for
SELECT EXTRACTVALUE(VALUE(t), '/MilestoneBO/@MilestoneID') dim_id,
EXTRACTVALUE(VALUE(t), '/MilestoneBO/@ResponsibilityMilestone') dim_id1
FROM TABLE(XMLSEQUENCE(EXTRACT(x, '/ArrayOfMilestoneBO/MilestoneBO'))) t,
TABLE(XMLSEQUENCE(EXTRACT(VALUE(t),
'/ArrayOfMilestoneBO/MilestoneBO')))(+) tx;
end ExportMilestones1;
[Edit MC: Add code tags, please do it yourself next time]
[Updated on: Tue, 02 September 2008 04:09] by Moderator Report message to a moderator
|
|
|
Re: PROBLEM WHILE USING XMLTYPE AS INPUT PARAMETER [message #345064 is a reply to message #345049] |
Tue, 02 September 2008 04:12 |
|
Michel Cadot
Messages: 68728 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Quote: | Procedure ExportMilestones1 doesnot works , conversion fails while converting clob into xmltype as the value is assigned through the input parameter
|
Works for me:
SQL> create or replace procedure ExportMilestones1(XML_IN clob :=null,
2 out_output out sys_refcursor) is
3 X xmltype;
4 XML_IN1 clob;
5 begin
6 /*
7 XML_IN1 := '<ArrayOfMilestoneBO><MilestoneBO MilestoneID="26981" PlannedDate="0001-01-01T00:00:00"
8 CompleteDate="0001-01-01T00:00:00" ResponsibilityMilestone="1219" IsExported="false" XMLNodeCount="0" />
9 <MilestoneBO MilestoneID="26982" PlannedDate="0001-01-01T00:00:00" CompleteDate="0001-01-01T00:00:00"
10 ResponsibilityMilestone="1219" IsExported="false" XMLNodeCount="0" /></ArrayOfMilestoneBO>';
11 */
12 --ASSINGNING VALUES TO X FROM IN PARAMETER XML_IN
13 X := XMLTYPE(XML_IN);
14 open out_output for
15
16 SELECT EXTRACTVALUE(VALUE(t), '/MilestoneBO/@MilestoneID') dim_id,
17 EXTRACTVALUE(VALUE(t), '/MilestoneBO/@ResponsibilityMilestone') dim_id1
18
19 FROM TABLE(XMLSEQUENCE(EXTRACT(x, '/ArrayOfMilestoneBO/MilestoneBO'))) t,
20 TABLE(XMLSEQUENCE(EXTRACT(VALUE(t),
21 '/ArrayOfMilestoneBO/MilestoneBO')))(+) tx;
22
23 end ExportMilestones1;
24 /
Procedure created.
SQL> declare
2 XML_IN1 clob := '<ArrayOfMilestoneBO><MilestoneBO MilestoneID="26981"
3 ResponsibilityMilestone="1219" IsExported="false" XMLNodeCount="0" />
4 <MilestoneBO MilestoneID="26982"
5 ResponsibilityMilestone="1219" IsExported="false" XMLNodeCount="0" /></ArrayOfMilestoneBO>';
6 out sys_refcursor;
7 begin
8 ExportMilestones1(xml_in1, out);
9 end;
10 /
PL/SQL procedure successfully completed.
Regards
Michel
|
|
|
|
|
|