Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: XML Question
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-lReceived on Tue Sep 20 2005 - 09:27:40 CDT
![]() |
![]() |