Home » Developer & Programmer » JDeveloper, Java & XML » XML Output for from Oracle
XML Output for from Oracle [message #358313] Mon, 10 November 2008 12:06 Go to next message
vikram1780
Messages: 222
Registered: January 2007
Location: Bangalore
Senior Member


Hi,

I need an equivalent sql server 2005 equivalent output from oracle.

Tried with DBMS_XMLGEN.getxml, xforest etc. But I am not able to get desired output.

Could anyone help me in giving a hint to do so.


Here below i am pasting sql server 2005 query and output, oracle query and output.

SELECT top 5
P.process_id AS Ppid,
P.name AS Pn,
P.group_id AS Pg,
P.locked AS Pl,
P.build AS Pb,
100 AS qcount,
200 AS ocount,
PI.question_id AS PIqid,
PI.process_id AS PIpid,
PI.posx AS PIpx,
PI.posy AS PIpy,
PI.innertext AS PItext,
PI.itemtype AS PItype,
PI.linkfrom AS PIfrom,
PI.linkto AS PIto,
PI.associated AS PIas,
PI.content_id AS PIc,
PI.exitpoint1_id AS PIe1,
PI.exitpoint2_id AS PIe2,
PI.exitpoint3_id AS PIe3,
PI.resolveidentifier AS PIri,
PI.libquestion_idfk AS PIlqid,
PI.followoncall AS PIfoc,
PI.userinput AS PIui,
PI.isLocked AS PIstls,
PI.PreviousAnswer as PIPAns,
PI.VisibleToAgent as PIVAgent,
PI.RetryAttempt as PIRetry,
PI.Tags as PITag,
PO.option_id AS POoid,
PO.question_id AS POqid,
PO.process_id AS popid,
PO.posx AS POpx,
PO.posy AS POpy,
PO.opt_innertext AS POtext,
PO.opt_linkfrom AS POfrom,
PO.opt_linkto AS POto,
PO.libquestion_idfk AS POlqid,
PO.liboption_idfk AS POloid
FROM
dbo.processes_ec AS P WITH (nolock) INNER JOIN
dbo.vw_ProcessesQuestions_Simulator_v6 AS PI WITH (nolock)
ON P.process_id = PI.process_id LEFT OUTER JOIN
dbo.vw_ProcessesOptions_Simulator_v6 AS PO WITH (nolock)
ON PI.question_id = PO.question_id AND PI.process_id = PO.process_id

ORDER BY Ppid, PIqid, POoid ASC
FOR XML AUTO, ELEMENTS

O/P

<P>
<Ppid>450</Ppid>
<Pn>CBB1015 - Router Firewall Settinngs Process</Pn>
<Pg>9</Pg>
<Pl>0</Pl>
<Pb>5</Pb>
<qcount>100</qcount>
<ocount>200</ocount>
<PI>
<PIqid>1</PIqid>
<PIpid>450</PIpid>
<PIpx>366</PIpx>
<PIpy>-516</PIpy>
<PItext>CBB1015 - Router Firewall Settinngs Process</PItext>
<PItype>Title</PItype>
<PIto>2</PIto>
<PO />
</PI>
<PI>
<PIqid>2</PIqid>
<PIpid>450</PIpid>
<PIpx>366</PIpx>
<PIpy>-437</PIpy>
<PItext>Is the customers PC Firewall turned off?</PItext>
<PItype>Question</PItype>
<PIfrom>1</PIfrom>
<PIto>2.2,2.1</PIto>
<PO>
<POoid>1</POoid>
<POqid>2</POqid>
<popid>450</popid>
<POpx>-50</POpx>
<POpy>70</POpy>
<POtext>Yes</POtext>
<POto>5</POto>
</PO>
<PO>
<POoid>2</POoid>
<POqid>2</POqid>
<popid>450</popid>
<POpx>50</POpx>
<POpy>70</POpy>
<POtext>No</POtext>
<POto>3</POto>
</PO>
</PI>
<PI>
<PIqid>3</PIqid>
<PIpid>450</PIpid>
<PIpx>468</PIpx>
<PIpy>-344</PIpy>
<PItext>Advise the customer to turn off the PC Firewall in order to continue. Has this been done?</PItext>
<PItype>Question</PItype>
<PIfrom>2.2</PIfrom>
<PIto>3.2,3.1</PIto>
<PIc>278</PIc>
<PO>
<POoid>1</POoid>
<POqid>3</POqid>
<popid>450</popid>
<POpx>-50</POpx>
<POpy>70</POpy>
<POtext>Yes</POtext>
<POto>5</POto>
</PO>
<PO>
<POoid>2</POoid>
<POqid>3</POqid>
<popid>450</popid>
<POpx>50</POpx>
<POpy>70</POpy>
<POtext>No</POtext>
<POto>4</POto>
</PO>
</PI>
</P>




Oracle query and output


select DBMS_XMLGEN.getxml('select * from (SELECT
P.process_id AS Ppid,
P.name AS Pn,
P.group_id AS Pg,
P.locked AS Pl,
P.build AS Pb,
100 AS qcount,
200 AS ocount,
PI.question_id AS PIqid,
PI.process_id AS PIpid,
PI.posx AS PIpx,
PI.posy AS PIpy,
PI.innertext AS PItext,
PI.itemtype AS PItype,
PI.linkfrom AS PIfrom,
PI.linkto AS PIto,
PI.associated AS PIas,
PI.content_id AS PIc,
PI.exitpoint1_id AS PIe1,
PI.exitpoint2_id AS PIe2,
PI.exitpoint3_id AS PIe3,
PI.resolveidentifier AS PIri,
PI.libquestion_idfk AS PIlqid,
PI.followoncall AS PIfoc,
PI.userinput AS PIui,
PI.isLocked AS PIstls,
PI.PreviousAnswer as PIPAns,
PI.VisibleToAgent as PIVAgent,
PI.RetryAttempt as PIRetry,
PI.Tags as PITag,
PO.option_id AS POoid,
PO.question_id AS POqid,
PO.process_id AS popid,
PO.posx AS POpx,
PO.posy AS POpy,
PO.opt_innertext AS POtext,
PO.opt_linkfrom AS POfrom,
PO.opt_linkto AS POto,
PO.libquestion_idfk AS POlqid,
PO.liboption_idfk AS POloid
FROM
processes_ec P INNER JOIN
vw_ProcessesQuestions_Sim_v6 PI
ON P.process_id = PI.process_id LEFT OUTER JOIN
vw_ProcessesOptions_Sim_v6 PO
ON PI.question_id = PO.question_id AND PI.process_id = PO.process_id
ORDER BY Ppid, PIqid, POoid ASC) where rownum<=5') from dual

O/P



<?xml version="1.0"?>
<ROWSET>
<ROW>
<PPID>450</PPID>
<PN>CBB1015 - Router Firewall Settinngs Process</PN>
<PG>9</PG>
<PL>0</PL>
<PB>5</PB>
<QCOUNT>100</QCOUNT>
<OCOUNT>200</OCOUNT>
<PIQID>1</PIQID>
<PIPID>450</PIPID>
<PIPX>366</PIPX>
<PIPY>-516</PIPY>
<PITEXT>CBB1015 - Router Firewall Settinngs Process</PITEXT>
<PITYPE>Title</PITYPE>
<PITO>2</PITO>
</ROW>
<ROW>
<PPID>450</PPID>
<PN>CBB1015 - Router Firewall Settinngs Process</PN>
<PG>9</PG>
<PL>0</PL>
<PB>5</PB>
<QCOUNT>100</QCOUNT>
<OCOUNT>200</OCOUNT>
<PIQID>2</PIQID>
<PIPID>450</PIPID>
<PIPX>366</PIPX>
<PIPY>-437</PIPY>
<PITEXT>Is the customers PC Firewall turned off?</PITEXT>
<PITYPE>Question</PITYPE>
<PIFROM>1</PIFROM>
<PITO>2.2,2.1</PITO>
<POOID>1</POOID>
<POQID>2</POQID>
<POPID>450</POPID>
<POPX>-50</POPX>
<POPY>70</POPY>
<POTEXT>Yes</POTEXT>
<POTO>5</POTO>
</ROW>
<ROW>
<PPID>450</PPID>
<PN>CBB1015 - Router Firewall Settinngs Process</PN>
<PG>9</PG>
<PL>0</PL>
<PB>5</PB>
<QCOUNT>100</QCOUNT>
<OCOUNT>200</OCOUNT>
<PIQID>2</PIQID>
<PIPID>450</PIPID>
<PIPX>366</PIPX>
<PIPY>-437</PIPY>
<PITEXT>Is the customers PC Firewall turned off?</PITEXT>
<PITYPE>Question</PITYPE>
<PIFROM>1</PIFROM>
<PITO>2.2,2.1</PITO>
<POOID>2</POOID>
<POQID>2</POQID>
<POPID>450</POPID>
<POPX>50</POPX>
<POPY>70</POPY>
<POTEXT>No</POTEXT>
<POTO>3</POTO>
</ROW>
<ROW>
<PPID>450</PPID>
<PN>CBB1015 - Router Firewall Settinngs Process</PN>
<PG>9</PG>
<PL>0</PL>
<PB>5</PB>
<QCOUNT>100</QCOUNT>
<OCOUNT>200</OCOUNT>
<PIQID>3</PIQID>
<PIPID>450</PIPID>
<PIPX>468</PIPX>
<PIPY>-344</PIPY>
<PITEXT>Advise the customer to turn off the PC Firewall in order to continue. Has this been done?</PITEXT>
<PITYPE>Question</PITYPE>
<PIFROM>2.2</PIFROM>
<PITO>3.2,3.1</PITO>
<PIC>278</PIC>
<POOID>1</POOID>
<POQID>3</POQID>
<POPID>450</POPID>
<POPX>-50</POPX>
<POPY>70</POPY>
<POTEXT>Yes</POTEXT>
<POTO>5</POTO>
</ROW>
<ROW>
<PPID>450</PPID>
<PN>CBB1015 - Router Firewall Settinngs Process</PN>
<PG>9</PG>
<PL>0</PL>
<PB>5</PB>
<QCOUNT>100</QCOUNT>
<OCOUNT>200</OCOUNT>
<PIQID>3</PIQID>
<PIPID>450</PIPID>
<PIPX>468</PIPX>
<PIPY>-344</PIPY>
<PITEXT>Advise the customer to turn off the PC Firewall in order to continue. Has this been done?</PITEXT>
<PITYPE>Question</PITYPE>
<PIFROM>2.2</PIFROM>
<PITO>3.2,3.1</PITO>
<PIC>278</PIC>
<POOID>2</POOID>
<POQID>3</POQID>
<POPID>450</POPID>
<POPX>50</POPX>
<POPY>70</POPY>
<POTEXT>No</POTEXT>
<POTO>4</POTO>
</ROW>
</ROWSET>


Any help really appreciated.

Thanks in advance
Re: XML Output for from Oracle [message #358316 is a reply to message #358313] Mon, 10 November 2008 12:13 Go to previous messageGo to next message
Michel Cadot
Messages: 68641
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Indent the code and explain in what the output is different and does not agree you.

Regards
Michel
Re: XML Output for from Oracle [message #358317 is a reply to message #358316] Mon, 10 November 2008 12:21 Go to previous messageGo to next message
vikram1780
Messages: 222
Registered: January 2007
Location: Bangalore
Senior Member


Hi,

Above I pasted the two queries which produce same result set in oracle and sql server database.

When I generated XML output from same query through sql server 2005 its different from oracle XML output.

Actually my requirement is to get the XML output from oracle which is similar to SQL SERVER XML output.

Above I pasted sql query and output in sql server 2005 and oracle.


Thanks
Re: XML Output for from Oracle [message #358327 is a reply to message #358317] Mon, 10 November 2008 12:51 Go to previous messageGo to next message
Michel Cadot
Messages: 68641
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
What are the differences?

Regards
Michel
Re: XML Output for from Oracle [message #358364 is a reply to message #358327] Mon, 10 November 2008 21:37 Go to previous messageGo to next message
vikram1780
Messages: 222
Registered: January 2007
Location: Bangalore
Senior Member


Hi Michel,

Just check the pasted outputs in my previous post from both queries.

Actually my requirement is to get the XML output from oracle which is similar to SQL SERVER XML output.


Thanks
Re: XML Output for from Oracle [message #358389 is a reply to message #358364] Tue, 11 November 2008 01:36 Go to previous message
Michel Cadot
Messages: 68641
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
Just check the pasted outputs in my previous post from both queries.

I could but I prefer you list them, these are part of the answers.

Regards
Michel
Previous Topic: XMLType use in WebSphere
Next Topic: namespace prefix problem
Goto Forum:
  


Current Time: Thu Apr 18 14:15:18 CDT 2024