Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> XML Question

XML Question

From: Davey, Alan <ddavey_at_harris.com>
Date: Tue, 20 Sep 2005 09:59:17 -0400
Message-ID: <A223847B255BF54FBE6AFEEF58F0C16FF50F44@mlbe2k6.cs.myharris.net>


Hi,

I have a pl/sql routine that is generating XML data. When calling function xmlelement(), I want to supply a variable as the first parameter. However, Oracle (v10.1.0.4 on windows) takes the parameter name (not its value) and uses it as the element name as the following example shows:

Wrote file afiedt.buf

  1 declare
  2 cName constant varchar2(4) := 'Name';   3 l_xml xmltype;
  4 begin
  5 select xmlelement(cName,'Larry')
  6 into l_xml
  7 from dual;
  8 dbms_output.put_line(l_xml.getCLOBVal());   9* end;
adavey_at_EASDEV> /
<CNAME>Larry</CNAME>

PL/SQL procedure successfully completed.

If you replace cName with xyz (no quotes), Oracle runs the pl/sql and uses <xyz> as the element tag name. Every example that I see in the FM is using a literal string for the element name. Is it possible to use a variable name for this parameter? If not, is this just an oversight on the part of Oracle?

Thanks,



Alan Davey
Senior Programmer/Analyst, Advertising Solutions Oracle 9i OCA; 3/4 OCP
Harris Corporation
w) 212-295-3458
--
http://www.freelists.org/webpage/oracle-l
Received on Tue Sep 20 2005 - 09:06:09 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US