hi
i have created this java program that converts a sql querry to xml but now i need to convert all the tables data into xml for a particular schema
i am not aware of the sql to do so can anyone help
my java code is as below
package oracle.xml.sample;
import java.sql.Connection;
import java.sql.DriverManager;
import oracle.xml.sql.query.OracleXMLQuery;
import oracle.xml.parser.v2.XMLSAXSerializer;
import java.io.OutputStream;
import java.io.FileOutputStream;
public class XSUSAXPrint
{
static public void main(String[] args)
{
Connection conn;
String username = "partition";
String password = "welcome1";
String thinConn = "jdbc

racle:thin:@localhost:1521:anidb";
try
{
//Open a File
OutputStream out = new FileOutputStream("out.xml");
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn= DriverManager.getConnection(thinConn,username,password);
XMLSAXSerializer sample = new XMLSAXSerializer(out);
// init the OracleXMLQuery
OracleXMLQuery qry =
new OracleXMLQuery(conn,"select * from inventory");
qry.getXMLSAX(sample);
sample.flush();
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
}
is there anyother way to do this i have also tried to create a cursor to do this but it doesnot give out a result set so as to convert it into xml.
plz help
the code for the sql procedure is as follows
DECLARE
CURSOR tnameCursor IS
SELECT table_name
FROM user_tables
ORDER BY table_name;
myTableName VARCHAR2(30);
aSQLcmd VARCHAR2(222);
BEGIN
FOR aRecord IN tnameCursor LOOP
myTableName := aRecord.table_name;
aSQLcmd := select * from'||myTableName;
EXECUTE IMMEDIATE aSQLcmd;
END LOOP;
END;