Home » SQL & PL/SQL » SQL & PL/SQL » string inside the dbms_xmlgen.getxml function (9i)
string inside the dbms_xmlgen.getxml function [message #403030] Wed, 13 May 2009 09:26 Go to next message
mohannksr
Messages: 28
Registered: January 2009
Junior Member
hi,

my query

select dbms_xmlgen.getxml('select field1,field2 from table_company')
from dual;

is working fine.

But when i have a default string inside the
query

select dbms_xmlgen.getxml('select field1,field2,'vpf' as company
from table_company')
from dual;

it is giving an error..

any one can help me how to use default string values
inside query...?
Re: string inside the dbms_xmlgen.getxml function [message #403033 is a reply to message #403030] Wed, 13 May 2009 09:28 Go to previous messageGo to next message
BlackSwan
Messages: 25036
Registered: January 2009
Location: SoCal
Senior Member
>it is giving an error..
ERROR? What Error? I do not see any error.

You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
Go to the URL above click the link "Posting Guidelines"
Go to the section labeled "Practice" & do as directed.
Re: string inside the dbms_xmlgen.getxml function [message #403037 is a reply to message #403030] Wed, 13 May 2009 09:37 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
The Query that you pass to DBMS_XMLGEN is a string.
If you want to have single quotes in your string, you need to replace them with ''

It would have helped if you'd posted the error message you got.
Re: string inside the dbms_xmlgen.getxml function [message #403040 is a reply to message #403037] Wed, 13 May 2009 09:42 Go to previous messageGo to next message
mohannksr
Messages: 28
Registered: January 2009
Junior Member
This is the error i got when i try thr query

select dbms_xmlgen.getxml('select field1,field2,'vpf' as company
from table_company')
from dual;


Error report:
SQL Error: ORA-00907: missing right parenthesis
00907. 00000 - "missing right parenthesis"
*Cause:
*Action:
Re: string inside the dbms_xmlgen.getxml function [message #403041 is a reply to message #403040] Wed, 13 May 2009 09:44 Go to previous messageGo to next message
vamsi kasina
Messages: 2107
Registered: October 2003
Location: Riyadh, Saudi Arabia
Senior Member
select dbms_xmlgen.getxml('select dummy,''Y'' as company from dual') 
from dual;

(CLOB) <?xml version="1.0"?>
<ROWSET>
 <ROW>
  <COMPANY>X</COMPANY>
 </ROW>
</ROWSET>
select dbms_xmlgen.getxml('select dummy,'Y' as company from dual') 
from dual;

Error starting at line 1 in command:
select dbms_xmlgen.getxml('select dummy,'Y' as company from dual') from dual
Error at Command Line:1 Column:41
Error report:
SQL Error: ORA-00907: missing right parenthesis
00907. 00000 -  "missing right parenthesis"
*Cause:    
*Action:
select dbms_xmlgen.getxml('select dummy,''Y'' as company from dual') 
from dual;

(CLOB) <?xml version="1.0"?>
<ROWSET>
 <ROW>
  <DUMMY>X</DUMMY>
  <COMPANY>Y</COMPANY>
 </ROW>
</ROWSET>
By
Vamsi
Re: string inside the dbms_xmlgen.getxml function [message #403199 is a reply to message #403041] Thu, 14 May 2009 03:03 Go to previous message
mohannksr
Messages: 28
Registered: January 2009
Junior Member
hi vamsi,

thanks for helping me...

its working now....
Previous Topic: Updating a BLOB object via PLSQL
Next Topic: Running procedure in background on button click
Goto Forum:
  


Current Time: Sun Dec 04 18:49:19 CST 2016

Total time taken to generate the page: 0.07172 seconds