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

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

Re: XML Question

From: BP <brian.peasey_at_gmail.com>
Date: Tue, 20 Sep 2005 09:23:37 -0500
Message-ID: <ff2080f40509200723da26a92@mail.gmail.com>


Hi David,

I think the function is part of an 'emerging standard' called SQL/XML (http://www.sqlx.org/) and may not behave the like native Oracle functions where we can interchange literals with variables.

Best Regards,
Brian Peasey
Winnipeg, MB Canada
http://oracle-exam-study-groups.com

On 9/20/05, Davey, Alan <ddavey_at_harris.com> wrote:
>
>
> 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:27:40 CDT

Original text of this message

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