After you generate a table in xml format, how can I save the result in an XML table?

Hi all
I used this feature to create a table in the XML schema:
example:
SELECT xmlelement ("State", xmlattributes (http://www.opengis.net/gml as "xmlns:gml"),)
XMLFOREST (name as "Name", "Population" of the population)) of the State;
result:
< Statexmlns:gml = "http://www.opengis.net/gml" >
< name > Wilkopolska < / name >
the population of 35000 <>< / Population >
< / state >
Now I need to insert the result in an XML table, because I need to save the result to use the latter, I hope someone can help, and if there is other way to do this, it would be great.
Thanks an ot and best regards,
Lama.

Just insert in a table...

insert into t
SELECT xmlelement("State", xmlattributes( 'http://www.opengis.net/gml' as "xmlns:gml"),
xmlforest(name as "Name", population as "Population")) from state; 

and a complete example:

SQL> create table t (test xmltype)
  2  /

Table created.

SQL>
SQL> create table state
  2  (name varchar2(10)
  3  ,population number
  4  )
  5  /

Table created.

SQL>
SQL> insert into state values ('WI', 35000)
  2  /

1 row created.

SQL>
SQL> SELECT xmlelement("State", xmlattributes( 'http://www.opengis.net/gml' as "xmlns:gml"),
  2  xmlforest(name as "Name", population as "Population")) from state; 

XMLELEMENT("STATE",XMLATTRIBUTES('HTTP://WWW.OPENGIS.NET/GML'AS"XMLNS:GML"),XMLFOREST(NAMEAS"NAME",P
----------------------------------------------------------------------------------------------------
WI35000
SQL>
SQL> insert into t
  2  SELECT xmlelement("State", xmlattributes( 'http://www.opengis.net/gml' as "xmlns:gml"),
  3  xmlforest(name as "Name", population as "Population")) from state; 

1 row created.

SQL> select *
  2    from t
  3  /

TEST
----------------------------------------------------------------------------------------------------
WI35000

Tags: Database

Similar Questions

Maybe you are looking for