XML/SQL Utility and stored procedure

Hi there,
Is it possible to use the XML/SQL Utility passing a stored
procedure call, which returns a result set (ref cursor), instead
of a SELECT statement? If yes, how should I call the
OracleXMLQuery constructor?
Thanks,
Flavio.
null

Here's a sample. The next code drop of the XSQL Servlet will make the easy-to-do from within XSQL Pages:
package package1;
import org.w3c.dom.*;
import java.sql.*;
import oracle.jdbc.driver.*;
import oracle.xml.sql.query.OracleXMLQuery;
public class Class1 extends Object {
public static void main( String[] arg ) throws Exception {
Connection conn = getConnection();
CallableStatement ocs = conn.prepareCall("begin ? := App.HotItems('PAUL'); end;");
ocs.registerOutParameter(1,OracleTypes.CURSOR);
ocs.execute();
ResultSet rs = ((OracleCallableStatement)ocs).getCursor(1);
OracleXMLQuery oxq = new OracleXMLQuery(conn,rs);
System.out.println(oxq.getXMLString());
oxq.close();
rs.close();
ocs.close();
conn.close();
public static Connection getConnection() throws Exception {
String username = "scott";
String password = "tiger";
String dburl = "jdbc:oracle:thin:@localhost:1521:xml";
String driverClass = "oracle.jdbc.driver.OracleDriver";
Driver d = (Driver)Class.forName(driverClass).newInstance();
return DriverManager.getConnection(dburl,username,password);
null

Similar Messages

  • Help Needed -- Oracle XML/SQL utility and PL/SQL parser

    Let's say we have an xml file
    <?xml version="1.0" standalone="no"?>
    <abc>
    <def>
    <ghi>test</ghi>
    </def>
    <jkl>
    <mno>testing</mno>
    </jkl>
    </abc>
    We can store the <def> tag in one table say def and <jkl> tag in another table say jkl.
    Is there a way to combine def and jkl and insert in one table so that there in one row with two columns test and testing??
    null

    Hi,
    Are u sure that it is a java enabled database? The most common
    case of failure with the xmlgen package is because the loadjava
    command did not succeed.
    Please make sure that oraclexmlsqlload.bat file loaded all the
    java procedures successfully. If not then u would have to java-
    enable your database by running the initjvm script. (please see
    the docs).
    Thx
    Murali
    Iveta Vojtko (guest) wrote:
    : Hi,
    : I have downloaded XML SQL Utility for Java against Oracle
    8.0.5
    : on WindowsNT. The xmlgen package was created successfully but
    : its body is invalid and my PL/SQL test has failed because of
    : following error: PLS-00103: Encountered the symbol "NAME"
    : when expecting one of the following: := . ( @ % ; not null
    range
    : renames default character. The symbol ":= was inserted abefore
    : "NAME" to continue.
    : Is it because I am not using Oracle8i? I just want to use the
    : server side of XML SQL. Please, reply asap. Thank you.
    Oracle Technology Network
    http://technet.oracle.com
    null

  • XML SQL Utility and Oracle 8.0.5

    Hi,
    I have downloaded XML SQL Utility for Java against Oracle 8.0.5
    on WindowsNT. The xmlgen package was created successfully but
    its body is invalid and my PL/SQL test has failed because of
    following error: PLS-00103: Encountered the symbol "NAME"
    when expecting one of the following: := . ( @ % ; not null range
    renames default character. The symbol ":= was inserted abefore
    "NAME" to continue.
    Is it because I am not using Oracle8i? I just want to use the
    server side of XML SQL. Please, reply asap. Thank you.
    null

    Hi,
    Are u sure that it is a java enabled database? The most common
    case of failure with the xmlgen package is because the loadjava
    command did not succeed.
    Please make sure that oraclexmlsqlload.bat file loaded all the
    java procedures successfully. If not then u would have to java-
    enable your database by running the initjvm script. (please see
    the docs).
    Thx
    Murali
    Iveta Vojtko (guest) wrote:
    : Hi,
    : I have downloaded XML SQL Utility for Java against Oracle
    8.0.5
    : on WindowsNT. The xmlgen package was created successfully but
    : its body is invalid and my PL/SQL test has failed because of
    : following error: PLS-00103: Encountered the symbol "NAME"
    : when expecting one of the following: := . ( @ % ; not null
    range
    : renames default character. The symbol ":= was inserted abefore
    : "NAME" to continue.
    : Is it because I am not using Oracle8i? I just want to use the
    : server side of XML SQL. Please, reply asap. Thank you.
    Oracle Technology Network
    http://technet.oracle.com
    null

  • Can we join SQL Command and Stored procedure in CR ?

    Hi friends,
    i have one already developed reports.
    now based on some requirments changes, i need to add YTD sales in reports.
    i have already built Command for this reports.
    Command also used one of tables which contain each month sales data.
    Now, i need to add YTD calculation in reports.
    so how can i handle this YTD in existing Command or do i need to develoed anohter stored procedure ?
    Thanks.

    You can try editing the existing command and add the new columns that you want. If you are unable to see the new columns added then try to use verify database option under database menu option. After clicking on verify database you can see the new fields added in the report.
    regards,
    Raghavendra.G

  • How to use my own DTD and table using the XML SQL utility.

    Hey,
    Here is my question. I have succesfully installed Oracle XML SQL utility and I had played around on that. Now I have my own DTD that too from Rosettanet(PIP). Tell me how can I use my own table, and my dtd using the existing utility. What are all the changes do I need to do. I am strugling it from past 4 days. I couldn't. Please help me!

    Hi chris,
    Yes, the SQL can be changed only by using Discoverer Administrator.
    Open the report/workbook that is based on the custom SQL that you want to change in Discoverer Plus. Look at the Folder that is being used to select the columns of the report.
    Open up the Discoverer Administrator with the id that has access to the tables referenced in the report. And the custom folder with the same name as in Disc Plus would be listed down in the Business Area (Which Business Area the custom folder belongs to can be determined with the help of disc plus).
    Just open up that folder, and change the SQL in it. You can pasted your new sql in there and click on Validate SQL to validate it for errors. If no errors, then the custom folder is successfully changed.
    In order to have it reflected, close your existing disc plus session and reopen it, and you can go about using the custom folder.
    Hope this helps!
    Thanks.

  • XML SQL utility - Error

    Hi,
    I am trying to retrieve data from a DB table and generate an XML file. I am using Oracle8i and IIS 4.0.
    I have downloaded XML SQL utility and I followed the installation instructions. I executed oraclexmlsqlload.bat file. It got executed and then I got the following error
    ORA-12203: TNS:unable to connect to destination.
    Let me know whether I should have JDK1.1x and JDBC 1.x compliant drivers installed in my machine. can any one help me ??
    vik

    Use xmlgen.setDateFormat('yyyy-MM-dd hh:mm:ss') and try it out
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Mark Hansen:
    I am having trouble with the xmlgen package within the XML SQL utility software version 1.1.1. I wrote a package that gets an XML file and loads it into a temporary CLOB and then using xmlgen.insertXML it inserts the XML into table. Everything works fine except for a date column in the table. I get an error when it tries to parse the date. Using the procedure xmlgen.setDateFormat, I tried to set the default date format, but I still get an error. Below you will find the text of the error message that I am getting:
    ORA-29532: Java call terminated by uncaught Java exception:
    oracle.xml.sql.OracleXMLSQLException: Exception
    'java.text.ParseException:Unparseable date: "2000-08-24 08:34:24"' encountered
    during processing ROW element 0All prior XML row changes were rolled back. in
    the XML document.
    ORA-06512: at "SITESTEPPER.SS_LOG", line 30
    ORA-06512: at line 1
    I've tried a number of diferent date formats including the database default date format. I have a work around to this but it involves the use of a temporary table. Please Help!
    <HR></BLOCKQUOTE>
    null

  • XML SQL utility

    Hi,
    When I try to execute this query using XML SQL utility
    I am getting the following error. I had declared 'XMLGEN &
    GETXML' as CLOB and tried but got the same error. Advice me. I
    am struggling to find the solution using XSQL Servlet..but
    couldn't get..I spend one week on that..no results...this is the
    second trial. Is there any online help or service to do that.
    xmlString := xmlgen.getXML('select * from scott.emp');
    ERROR at line 9:
    ORA-06550: line 9, column 16:
    PLS-00201: identifier 'XMLGEN.GETXML' must be declared
    ORA-06550: line 9, column 3:
    PL/SQL: Statement ignored
    I have Oracle XML parser for Java 2, and XML SQL utility and
    oracle 8i database....
    This is the query.........(Your example)
    declare
    xmlString CLOB;
    amount integer:= 4000;
    position integer := 1;
    charString varchar2(4000);
    i binary_integer := 0;
    inclDTD number := 0;
    begin
    xmlString := xmlgen.getXML('select * from scott.emp');
    dbms_lob.open(xmlString,DBMS_LOB.LOB_READONLY);
    loop
    dbms_lob.read(xmlString,amount,position,charString);
    dbms_output.put_line(charString);
    position := position + amount;
    end loop;
    exception
    when no_data_found then
    dbms_lob.close(xmlString);
    dbms_lob.freetemporary(xmlString);
    end;
    null

    Have you loaded the xmlgenpkg.sql in the schema in which you
    are trying to execute your PL/SQL block?
    Chan (guest) wrote:
    : Hi,
    : When I try to execute this query using XML SQL utility
    : I am getting the following error. I had declared 'XMLGEN &
    : GETXML' as CLOB and tried but got the same error. Advice me. I
    : am struggling to find the solution using XSQL Servlet..but
    : couldn't get..I spend one week on that..no results...this is
    the
    : second trial. Is there any online help or service to do that.
    : xmlString := xmlgen.getXML('select * from scott.emp');
    : ERROR at line 9:
    : ORA-06550: line 9, column 16:
    : PLS-00201: identifier 'XMLGEN.GETXML' must be declared
    : ORA-06550: line 9, column 3:
    : PL/SQL: Statement ignored
    : I have Oracle XML parser for Java 2, and XML SQL utility and
    : oracle 8i database....
    : This is the query.........(Your example)
    : declare
    : xmlString CLOB;
    : amount integer:= 4000;
    : position integer := 1;
    : charString varchar2(4000);
    : i binary_integer := 0;
    : inclDTD number := 0;
    : begin
    : xmlString := xmlgen.getXML('select * from scott.emp');
    : dbms_lob.open(xmlString,DBMS_LOB.LOB_READONLY);
    : loop
    : dbms_lob.read(xmlString,amount,position,charString);
    : dbms_output.put_line(charString);
    : position := position + amount;
    : end loop;
    : exception
    : when no_data_found then
    : dbms_lob.close(xmlString);
    : dbms_lob.freetemporary(xmlString);
    : end;
    Oracle Technology Network
    http://technet.oracle.com
    null

  • XML SQL Utility or XSQL Servlet ?

    Hi,
    I am trying to generate a well formed XML file by querring from oracle8i database and also include different XSL files to render different output styles.
    Should I use XML SQL Utility or XSQL Servlets ??
    From the documentation I see that both XML SQL utility and XSQL servlets will do the job(am I right ?). But I am sure which one I should be using.
    Can any one advice me on this ?
    Thanks.
    Kane

    "HI u have to use XML SQl utility to run ur SQL and ur sqlservelet to process and get the output in the browser"
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Kane:
    Hi,
    I am trying to generate a well formed XML file by querring from oracle8i database and also include different XSL files to render different output styles.
    Should I use XML SQL Utility or XSQL Servlets ??
    From the documentation I see that both XML SQL utility and XSQL servlets will do the job(am I right ?). But I am sure which one I should be using.
    Can any one advice me on this ?
    Thanks.
    Kane<HR></BLOCKQUOTE>
    null

  • Database updation using XML and stored Procedure?

    Hello,
    I want to perform updation in multiple tables using XML files.Please suggest can I do updation using xml and stored procedure.
    If yes then which is more efficient and takes less time.
    1.Updation using xml files only
    2.Updation using xml files with stored procedure.
    3.Stored procedure alone.
    If direct xml and stored procedure communication is possible.then please write how.
    Thanks in advance for any help.

    Here's a sample. The next code drop of the XSQL Servlet will make the easy-to-do from within XSQL Pages:
    package package1;
    import org.w3c.dom.*;
    import java.sql.*;
    import oracle.jdbc.driver.*;
    import oracle.xml.sql.query.OracleXMLQuery;
    public class Class1 extends Object {
    public static void main( String[] arg ) throws Exception {
    Connection conn = getConnection();
    CallableStatement ocs = conn.prepareCall("begin ? := App.HotItems('PAUL'); end;");
    ocs.registerOutParameter(1,OracleTypes.CURSOR);
    ocs.execute();
    ResultSet rs = ((OracleCallableStatement)ocs).getCursor(1);
    OracleXMLQuery oxq = new OracleXMLQuery(conn,rs);
    System.out.println(oxq.getXMLString());
    oxq.close();
    rs.close();
    ocs.close();
    conn.close();
    public static Connection getConnection() throws Exception {
    String username = "scott";
    String password = "tiger";
    String dburl = "jdbc:oracle:thin:@localhost:1521:xml";
    String driverClass = "oracle.jdbc.driver.OracleDriver";
    Driver d = (Driver)Class.forName(driverClass).newInstance();
    return DriverManager.getConnection(dburl,username,password);
    null

  • Oracle 8i Lite and XML SQL Utility

    Can I use XML SQL Utility with Oracle 8i Lite
    using the Oracle 8i Lite Driver
    null

    There will be an version of the XML SQL Utility appearing here shortly. In the meantime you can download the current version of the XSQL Servlet which has the new v2 compatible oraclexmlsql.jar.
    Oracle XML Team

  • Xml SQL Utility for java and Dr.Watson for WIN-NT

    hello everybody.
    when i am running the sample code in xml Sql utility for java documentation,
    Dr. watson for windows NT error occures.
    what may be the problem? please suggest a solution
    thanks
    dev

    Set JDK_HOME to the directory where you install your JDK (Java Development Kit).
    So instance, I've install JDK1.1.8 on my
    C drive so
    set JDK_HOME=c:\jdk1.1.8;c:\jdk1.1.8\bin

  • Errors when loading XML SQL Utility

    I'm working on a Unix machine, attempting
    to load the Oracle XML SQL Utility classes
    into my database so that I can use them in
    stored procedures.
    My problem is occuring when I try to use
    loadjava to install the classes. I haved
    altered both env.csh and oraclrxmlsqlload.csh to match my shell and desired settings, but I get a core dump when loadjava executes in the script:
    SIGSEGV received. Processing terminated
    full version ""
    Full thread dump:
    "Async Garbage Collector" (TID:0x3002bd00, sys_thread_t:0x2006b7d8)
    Native Thread State: ThreadID: 00000203 Reuse: 1 DAEMON MONITOR WAIT
    Native Stack Data : base: 201133a0 pointer 20113018 used(904) free(257144)
    ----- Monitors held -----
    ----- Native stack -----
    ------ Java stack ------ () prio=1
    "Finalizer thread" (TID:0x3002bd38, sys_thread_t:0x2006b588)
    Native Thread State: ThreadID: 00000102 Reuse: 1 DAEMON MONITOR WAIT
    Native Stack Data : base: 200ca230 pointer 200c9f68 used(712) free(257336)
    ----- Monitors held -----
    ----- Native stack -----
    ------ Java stack ------ () prio=1
    "main" (TID:0x3002bd70, sys_thread_t:0x20007278)
    Native Thread State: ThreadID: 00000001 Reuse: 1 USER PRIMORDIAL RUNNING
    Native Stack Data : base: 2ff22004 pointer 2ff1f658 used(10668) free(247380)
    ----- Monitors held -----
    java.lang.Class java/sql/DriverManager@30025318
    oracle.jdbc.oci8.OCIDBAccess@300304e8
    ----- Native stack -----
    eoj_memcpy(d15779b8)
    eoj_memcpy(d1574d08)
    eoj_memcpy(d1574484)
    inflate_copyright(2c203a6e)
    inflate_copyright(2c203a6e)
    [sigsegv]...
    ------ Java stack ------ () prio=5 current thread
    Anyone have any ideas what might be the problem?

    Sorry...missed your first question there.
    I'm running AIX 4.3.2 on an IBM RS/6000 Server. I've got Java 1.1.6 installed.

  • XMLSQL and stored procedures

    I looked in the archives and found an entry dated November 9, 1999 that asked the question of wheter the XMLSQL utility could be used in conjunction with a stored procedure. That answer was essentially 'not yet'. I just wanted to get an update on whether the XMLSQL utility supported stored procedures and if not, when?

    Well, I tried it and you're correct; the designer doesn't like package procedures.
    And the designer doesn't like ref cursors, either. I was able to use them, however, by writing my own method. I added the method to my dataset (patial class) and it works great. I probably could have (and should have) put the method in the table adapter class (again, in separate partial class file so that it doesn't get discarded by the designer) but I didn't know that I could do that at the time. Now that I know, I may move it.
    Somewhat related, I found that I could handle events of the OracleDataAdapter in a partial TableAdapter class. Why is this interesting? Because after TableAdapter updates, I think that I can select the updated rows back in to the DataTable. This will be handy (if possible) if the data that I update is modified by a trigger or something. Let me know if you've tried this. By the way, SQL Server makes this easy! Follow your update SQL with a select statement; it all happens in the same command!
    Namespace DGPPDbDataSetTableAdapters
         Partial Public Class MilestoneDatesTableAdapter
              Private Sub adapterRowUpdated(ByVal sender As Object, ByVal e As System.Data.OracleClient.OracleRowUpdatedEventArgs) Handles _adapter.RowUpdated
                   'TODO: Re-Select the updated rows back in to the DataTable
              End Sub
         End Class
    End Namespace

  • XML SQL Utility, 8i, NT4, test code

    I have been unable to get the sample code to run successfully
    after installing the XML SQL Utility on Oracle 8.1.5.0.0 on
    Windows NT4 Service Pack 4.
    To make sure I was doing nothing wrong, I reinstalled Oracle 8i
    and loaded all the java into scott/tiger. Also the PLXMLPARSER
    codes does appear to run correctly. At least the samples seem to
    work.
    I tried to use the oraclexmlsqlload.bat script, but the script
    stopped after after loading oraclexmlsql.jar. So I ran each of
    the loadjava scripts on the command line. They exited without
    errors. Even the xmlgen package installed without errors. But
    when I ran oraclexmlsqltest.sql, I got a message that said the
    procedure completed successfully, but there was not output.
    I put a dbms_output.put_line(SQLCODE) with each of the two
    exceptions and got the following error. The procedure actually
    failed on "when others" with error -29531. According to the
    Error Manual this is
    ORA-29531 no method string in class string
    Cause: An attempt was made to execute a non-existent method in a
    Java class.
    Action: Adjust the call or create the specified method.
    At this point I am not sure what to do.
    null

    Hi Frank,
    Frank, make sure that the two "select xmlgen....." are
    returning a valid XML document. If these aren't working let me
    know, otherwise add a:
    set serveroutput on
    after the commit.
    Also, before you do this, restore oraclexmlsqltest.sql to its
    original state ... the exception section was masking exceptions
    which we are aware we generate. If you look closely you will see
    that we do a very rough job outputing the lob containing the XML
    document (we print out past the length of the LOB, which raises
    an exception).
    Let me know what happens.
    Frank Hubeny (guest) wrote:
    : I have been unable to get the sample code to run successfully
    : after installing the XML SQL Utility on Oracle 8.1.5.0.0 on
    : Windows NT4 Service Pack 4.
    : To make sure I was doing nothing wrong, I reinstalled Oracle 8i
    : and loaded all the java into scott/tiger. Also the PLXMLPARSER
    : codes does appear to run correctly. At least the samples seem
    to
    : work.
    : I tried to use the oraclexmlsqlload.bat script, but the script
    : stopped after after loading oraclexmlsql.jar. So I ran each of
    : the loadjava scripts on the command line. They exited without
    : errors. Even the xmlgen package installed without errors. But
    : when I ran oraclexmlsqltest.sql, I got a message that said the
    : procedure completed successfully, but there was not output.
    : I put a dbms_output.put_line(SQLCODE) with each of the two
    : exceptions and got the following error. The procedure actually
    : failed on "when others" with error -29531. According to the
    : Error Manual this is
    : ORA-29531 no method string in class string
    : Cause: An attempt was made to execute a non-existent method in
    a
    : Java class.
    : Action: Adjust the call or create the specified method.
    : At this point I am not sure what to do.
    Oracle Technology Network
    http://technet.oracle.com
    null

  • Unable to load Oracle XML SQL utility

    The following error appears for each java
    class, when we attempt to load Oracle XML sql
    utility into Oracle using the oraclexmlsqlload
    script:
    E.g.
    Error while resolving class OracleXMLStore
    ORA-00904: invalid column name
    Does anyone know why we would receive this error?
    Platform: Hp-UX 11.0
    Oracle Version: 8.1.5.0
    Background information:
    The database was original created with the
    compatible=8.0.5 set in the init.ora file, and
    the creatation of java classes failed due to this,
    so switched compatible to 8.1.0. Now after we
    we adjusted the compatible setting and restarted
    database, we started to receive the errors as
    described above.
    null

    Murali,
    Thank you, after I initialized Oracle's javavm
    the errors disappeared.
    The scripts were located under the javavm/install
    directory.
    Thanks again.
    Murali K (guest) wrote:
    : Hi Steven,
    : Is the JavaVM loaded. i.e. are all the classes necessary for
    : running Java in the server are loaded into the server? The
    most
    : common answer to your problem is that the javavm has not been
    : initialized correctly or the database does not have all the
    java
    : library files necessary to load java programs.
    : Please read chapter 4 in the Oracle8i java developers guide
    : which talks about initializing a java-enabled database by
    : running the initjvm script.
    : If this still occurs then maybe it is a bug and we will have
    to
    : look at it.
    : Thx
    : Murali
    : Steven Wegner (guest) wrote:
    : : The following error appears for each java
    : : class, when we attempt to load Oracle XML sql
    : : utility into Oracle using the oraclexmlsqlload
    : : script:
    : : E.g.
    : : Error while resolving class OracleXMLStore
    : : ORA-00904: invalid column name
    : : Does anyone know why we would receive this error?
    : : Platform: Hp-UX 11.0
    : : Oracle Version: 8.1.5.0
    : : Background information:
    : : The database was original created with the
    : : compatible=8.0.5 set in the init.ora file, and
    : : the creatation of java classes failed due to this,
    : : so switched compatible to 8.1.0. Now after we
    : : we adjusted the compatible setting and restarted
    : : database, we started to receive the errors as
    : : described above.
    null

Maybe you are looking for

  • 17" MBP Display - TN or IPS? - Light Bleed?

    I've had a 15-inch Unibody MBP since December and am not thrilled with the display. It apparently uses twisted neumatic (TN) technology, as it has a very narrow viewing angle. And as has been described in other posts, many individual displays have a

  • IPAQ hx2495b Program issues

    I have an iPAQ hx 2495b hand held PC..Two programs on it don't work and give me errors. Is there anyway I can delete the programs and download the programs from Internet to make them work? Also when I connect the handheld PC to my desk top via USB po

  • Where do you go when you have questionreguarding itune charges?

    What site do yo go to when you are disputing a itunes charge?

  • How to create a  Stock ticker application

    Hi, We are currently using EP 7.0 and want to create a stockticker application. I have no idea how to achieve this, please advice with the steps required for creating the application at the earliest. Your help will be rewarded Thanks, Swetha

  • Question: best path to sync iPhone with MacBook (Entourage or Mail)

    OK- Have been putting this off for some time. I have an iPhone that I used to sync with my WinXP laptop. I replaced the laptop with a new MacBook Pro and need to do (2) things: 1.) Migrate my contacts over to the MacBook 2.) Determine my long-term co