Multiple result sets from stored procedure into CachedRowSet

How can you obtain multiple sets of data from a stored procedure that returns multiple result sets, when you'd like to use CachedRowSet rather than ResultSet?
My database's stored procedures return multiple result sets, but I'm not sure how to manipulate that using CallableStatements and CachedRowSets... I read the RowSet tutorial from java.sun.com but that didn't cover the case of multiple result sets and CallablStatements.
How might I do this? Thanks a lot.

SELECT columns..
FROM table
FOR XML PATH('NodeName'),('Rootname')
Thank you for replying.
I dont have to generate XML from a query. I have to generate from a SP and that too without modifying it.
Thanks,
Tauhid
thats ok you can do like this
1. Create a table with structure same as SP resultset
2. Populate table with SP result as per below
INSERT table
EXEC SPName param1value,...
3. Add a query like below
SELECT columns..
FROM tablename
FOR XML PATH('NodeName'),('RootName')
see
http://visakhm.blogspot.com/2014/05/t-sql-tips-fun-with-for-xml-path.html
4. Use sp_send_dbmail to sent it through mail
http://msdn.microsoft.com/en-IN/library/ms190307.aspx
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Similar Messages

  • Performance to fetch result set from stored procedure.

    I read some of related threads, but couldn't find any good suggestions about the performance issue to fetch the result set from a stored procedure.
    Here is my case:
    I have a stored procedure which will return 2,030,000 rows. When I run the select part only in the dbartisan, it takes about 3 minutes, so I know it's not query problem. But when I call the stored procedure in DBArtisan in following way:
    declare cr SYS_REFCURSOR;
    firstname char(20);
    lastname char(20);
    street char(40);
    city char(20);
    STATE varchar2(2);
    begin DISPLAY_ADDRESS(cr);
    DBMS_OUTPUT.ENABLE(null);
    LOOP
    FETCH cr INTO firstname,lastname,street, city, state;
    EXIT WHEN cr%NOTFOUND;
    DBMS_OUTPUT.PUT_LINE( firstname||','|| lastname||','|| street||',' ||city||',' ||STATE);
    END LOOP;
    CLOSE cr;
    end;
    It will take about 100 minutes. When I used DBI fetchrow_array in perl code, it took about same amount of time. However, same stored procedure in sybase without using cursor, and same perl code, it only takes 12 minutes to display all results. We assume oracle has better performance. So what could be the problem here?
    The perl code:
    my $dbh = DBI->connect($databaseserver, $dbuser, $dbpassword,
    { 'AutoCommit' => 0,'RaiseError' => 1, 'PrintError' => 0 })
    or die "couldn't connect to database: " . DBI->errstr;
    open OUTPUTFILE, ">$temp_output_path";
    my $rc;
    my $sql="BEGIN DISPLAY_ADDRESS(:rc); END;";
    my $sth = $dbh->prepare($sql) or die "Couldn't prepare statement: " . $dbh->errstr;
    $sth->bind_param_inout(':rc', \$rc, 0, { ora_type=> ORA_RSET });
    $sth->execute() or die "Couldn't execute statement: " . $sth->errstr;
    while($address_info=$rc->fetchrow_arrayref()){
    my ($firstname, $lastname, $street, $city, $STATE) = @$address_info;
    print OUTPUTFILE $firstname."|".$lastname."|".$street."|".$city."|".$STATE;
    $dbh->commit();
    $dbh->disconnect();
    close OUTPUTFILE;
    Thanks!
    rulin

    Thanks for you reply!
    1) The stored procedure has head
    CREATE OR REPLACE PROCEDURE X_OWNER.DISPLAY_ADDRESS
    cv_1 IN OUT SYS_REFCURSOR
    AS
    err_msg VARCHAR2(100);
    BEGIN
    --Adaptive Server has expanded all '*' elements in the following statement
    OPEN cv_1 FOR
    Select ...
    commit;
    EXCEPTION
    WHEN OTHERS THEN
    err_msg := SQLERRM;
    dbms_output.put_line (err_msg);
    ROLLBACK;
    END;
    If I only run select .. in DBArtisan, it display all 2030,000 rows in 3:44 minutes
    2) But when call stored procedure, it will take 80-100 minutes .
    3) The stored procedure is translated from sybase using migration tools, it's very simple, in sybase it just
    CREATE PROCEDURE X_OWNER.DISPLAY_ADDRESS
    AS
    BEGIN
    select ..
    The select part is exact same.
    4) The perl code is almost exact same, except the query sql:
    sybase verson: my $sql ="exec DISPLAY_ADDRESS";
    and no need bind the cursor parameter.
    This is batch job, we create a file with all information, and ftp to clients everynight.
    Thanks!
    Rulin

  • Getting result set from stored procedures in database controls in weblogic

    I am calling a stored procedure from database control which actually returns a result set
    when i call the stored procedure like
    * @jc:sql statement="call PROC4()"
    ResultSet sampleProc() throws SQLException;
    it gives me exception saying
    "weblogic.jws.control.ControlException: Method sampleProc is DML but does not return void or int"
    I would appreciate any help
    Thanks,
    Uma

    Thanks for you reply!
    1) The stored procedure has head
    CREATE OR REPLACE PROCEDURE X_OWNER.DISPLAY_ADDRESS
    cv_1 IN OUT SYS_REFCURSOR
    AS
    err_msg VARCHAR2(100);
    BEGIN
    --Adaptive Server has expanded all '*' elements in the following statement
    OPEN cv_1 FOR
    Select ...
    commit;
    EXCEPTION
    WHEN OTHERS THEN
    err_msg := SQLERRM;
    dbms_output.put_line (err_msg);
    ROLLBACK;
    END;
    If I only run select .. in DBArtisan, it display all 2030,000 rows in 3:44 minutes
    2) But when call stored procedure, it will take 80-100 minutes .
    3) The stored procedure is translated from sybase using migration tools, it's very simple, in sybase it just
    CREATE PROCEDURE X_OWNER.DISPLAY_ADDRESS
    AS
    BEGIN
    select ..
    The select part is exact same.
    4) The perl code is almost exact same, except the query sql:
    sybase verson: my $sql ="exec DISPLAY_ADDRESS";
    and no need bind the cursor parameter.
    This is batch job, we create a file with all information, and ftp to clients everynight.
    Thanks!
    Rulin

  • Displaying data from stored procedure into textbox fields based on user input.

    I have a stored procedure that is selecting data from a table called "Vendor" in my database.  The data that is being returned are vendor names, vendor addresses, vendor Id's, etc...In my stored proc, I have one parameter that allows
    the user to enter a vendor name and then return all the data for that specific vendor.  The report that I'm building is going to look like a basic form with a bunch of textboxes on the screen labeled Vendor Address, Vendor Id, Vendor City, Vendor State,
    etc...In the report I'm trying to build, the user will enter in a vendor name and then it will return all of the vendor's data based on what the user searches for.  However, the report will only return ONE vendor's data at a time. 
    The problem is that some of the data in the database has very similiar vendor names, but different vendor addresses, vendor Id's, etc...In some instances the vendor name is actually
    exactly the same, but the vendor address, vendor city, vendor Id, is all different.  So what I did was added another parameter in my report that shows a drop down list of vendor names based on the wildcard search the user just did and
    allows the user to select the exact vendor name that he/she is looking for based on what they searched.  The problem I'm having is that I don't know what expression I need to put in each one of my textboxes to retrieve the correct data from
    the vendor table that the user selects from the drop down list.  So what I want to do is return the exact data from the vendor table based on the selection that the user makes from that drop down list.  It's like I somehow have to compare the
    drop down list parameter directly to the dataset but I don't know what expression needs to go in the textbox.  I've tried...=First(Fields!VendorName.Value, "DataSet1").EqualsParameters!DropDownList.Value(0) but I keep getting an error message.
    --Here is an example of the kind of thing the user might search for...when the user searches the word "sprint" it returns three different vendor names to the drop down list.
    1. sprint
    2. sprint
    3. sprint co
    Each one of those three vendor names has a different vendor address, vendor city, vendor ID, etc...but the vendor names are extremely similar and in some cases
    exactly the same. In my report now I can't get the textboxes to return the correct data based on what the user selects.  Any advice at all is greatly appreciated.
    P.S. I didn't even know what SQL Server was a month ago and had zero knowledge of SSRS at all.  I've learned a lot recently, but if you could explain a solution in the easiest way possible I would appreciate it. Thanks!

    Hi Jrcowles,
    If I understand you correctly, you wnat to list all the Vendor Name which like the user typed Vendor Name on a drop-down list, right? If in this case, we can use a cascading parameters to achieve your requirement. I have tested it on my local environment,
    the steps below are for you reference.
    Create an other stored procedure using the query below.
    CREATE PROCEDURE GetVendorName
    @VendorName NVARCHAR(50)
    AS BEGIN
    exec( 'SELECT * FROM Vendor WHERE VendorName LIKE ''%'+@VendorName+'%''')
    END
    Create another dataset DataSet2 and using the new created procedure.
    Create another parameter VendorName2 and check "Allow Multiple Values" for this parameter.
    On the Available Values tab, check "Get values from a query". Select corresponding dataset and field.
    On the Default Values tab, check "Get values from a query". Select corresponding dataset and field.
    The screenshots below are for you reference.
    Reference
    http://technet.microsoft.com/en-us/library/aa337169(v=sql.100).aspx
    http://www.msbiguide.com/2012/02/adding-cascading-parameters-to-ssrs-reports/
    Regards,
    Charlie Liao
    TechNet Community Support

  • Result Sets and Stored Procedure

    In advance one question in general - since I never know: What actually is a result set???
    Is it a cursor with a direct connection to the server-side database-data ? Or is it just a copy of the results once "loaded" by the query and delivered by the Server to the client ???
    Second: I have a Stored Procedure on a MS SQL Server 2000
    I try to call the stored procedure via jdbc. The last query in the Stored Proc is a query relying on local temporary tables. If I execute the stored procedure by my java-class, i get a
    java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]No ResultSet set was produced.
    The usual "Select, Update and Insert-stuff" works fine with JDBC.
    Stored Procedures WITHOUT resultset work fine too.
    But this one just refuses to give me the results.
    Executing the same stored procedure in 'MS SQL-QUERYANALYZER' gives me my expected results.
    Any ideas?
    Sven

    In advance one question in general - since I never
    know: What actually is a result set???
    Is it a cursor with a direct connection to the
    server-side database-data ? Or is it just a copy of
    the results once "loaded" by the query and delivered
    by the Server to the client ???The first one, more or less. It relies on the connection to retrieve the results, .. if the connection is lost, so is the data in the ResultSet.
    Second: I have a Stored Procedure on a *MS SQL Server
    2000*
    I try to call the stored procedure via jdbc. The last
    query in the Stored Proc is a query relying on local
    temporary tables. If I execute the stored procedure by
    my java-class, i get a
    java.sql.SQLException: [Microsoft][SQLServer JDBC
    Driver]No ResultSet set was produced.Have you tried a basic stored procedure that should return a ResultSet?.. maybe one that doesn't rely on the temporary tables? You may want to also check with the support for the driver you're using since that's really where the ability to use stored procedures resides.

  • Ora-06550 returning data from Stored Procedure and Entity Data Model

    Hi.
    I'm creating an application that uses a WCF Service to return data. I also created a proyect with the EDMX design and mapped most of my DBModel to a classes context. I have added some of the procedures as well. One of them receive some parameters and return a Sys_RefCursor, that is populated according to the parameters.
    I have declared the "<add >" tags in the Web.Config and imported the function of the Procedure. When I call the Asyncronous function I get different exceptions:
    1. If I call the function, with all of the parameters i get:
    Oracle.DataAccess.Client.OracleException: ORA-06550: línea 1, columna 8:
    PLS-00306: número o tipos de argumentos erróneos al llamar a
    'SP_HECHOSJURITER'
    ORA-06550: línea 1, columna 8:
    (wrong number or types of arguments in call to 'SP_HECHOSJURITER')
    2. If i just set 1 parameter in the SP, returning the same type of data, I get:
    Error al recibir la respuesta HTTP a
    http://localhost/Procalculo.CGFM.SIGOC.DatosServices/ServiceDatos.svc.
    (failed to receive http response. error 12152)
    3. If I don't set any parameters in the procedure, it works fine, and return correct data.
    It exclusively happen with one entity.
    Any clue?
    I appreciate any help.

    When you return result sets from stored procedures to Entity Framework, you are very likely using implicit result sets. Implicit result sets don't need to be declared as a parameter in code, only in the <add> tags to define the metadata in the .NET config file.
    For example, in the EF Oracle By Example, you'll see that the stored procedure in the function import has three parameters, but only two are declared in the code. The third one was defined in the config file.
    http://download.oracle.com/oll/obe/EntityFrameworkOBE/EntityFrameworkOBE.htm

  • Transfer data from Result Set (Execute SQL Task) into Flat File

    Hi to all,
    My problem is this:
     -) I have a stored procedure which use a temporary table in join with another "real" table in select statement. In particular the stored procedure look like this:
    create table #tmp
    col1 varchar(20),
    col2 varchar(50)
    --PUT SOME VALUE IN #TMP
    insert into #tmp
    values ('abc','xyz')
    --SELECT SOME VALUE
    select rt.*
    from realTable rt, #tmp
    where rt.col1 = #tmp.col1
    -) I cannot modify the stored procedure because I'm not admin of database.
    -) I HAVE THE REQUIREMENT OF TRANSFER DATA OF SELECT STATEMENT OF SOTRED PROCEDURE INTO FLAT FILE
    -) THE PROBLEM is that if I use an OLEDB source Task within a Data Flow Task I'm not be able of mapping column from OLEDB source to flat file destination. The reason for this, is that in the "Column page" of OLEDB source task, SSIS do not retrieves
    any column when we using a temporary table. The reason for this, is that SSIS is not be able to retrieve metadata related to temporary table. 
    -) One possible solution to this problem is to use an Execute SQL Task to invoke the stored procedure, store the result returned from stored procedure in a Result Set through a Object type user variable.
    -) The problem now is: How to transfer data from result set to flat file?
    -) Reading here on this forum the solution look be like to use a Script task to transfer data from result set to flat file.
    QUESTIONS: How to transfer data from result set to flat file using a script task?? (I'm not an expert of vb .net) Is it really possible?? P.S.: The number of row returned of stored procedure is very high!
    thanks in advance.

    Hi  Visakh16<abbr
    class="affil"></abbr>
    thanks for the response.
    Your is a good Idea, but I do not have permission to use DDL statement on the database in production environment.

  • Writing from Stored Procedure directly into a file...

    Hi guys,
    I would like to write the results of a stored procedure into a file. Indeed, I am calling a Stored Procedure from a script and I would like to write the result of that procedure to a file and not a table.
    Thanks guys,
    Pipoca

    Hi,
    The UTL would be nice, but since I am calling the procedure from a unix script and *I wanted to keep the file in the unix machine* I don't believe this is the solution.UTL_FILE - will refers to a directory - which resides on Server - I Hope your DB is placed on Unix and you script is exeucted from their only. Then obviously your resulted file and source exits on unix machine only.
    HTH
    - Pavan Kumar N
    OCP- Oracle 9i/10g
    http://oracleinternals.blogspot.com

  • Importing function with multiple ref cursors in Stored Procedure of Oracle 12c database Using EF6

    Hi Good day!
    I can able to import function for stored procedure of oracle db and able to add the complex type and get the output but i tried to import the procedure which having two ref cursors and unable to retrieve the column information. Only able to retrieve the
    columns of first ref cursor.  Please help me to get the result of two ref cursors which acting as out parameters.

    Having to ref cursors return mutiple recordsets in an Oracle package is like haveng two resultsets return from a MS SQL Server sparc.
    The link may point you in the right direction.
    http://www.codeproject.com/Articles/675933/Returning-Multiple-Result-Sets-from-an-Entity-Fram

  • Stored Procedure With Multiple Result Sets As Report Source : Crosspost

    Hello Everyone,
    I have an issue where i have created a stored procedure that returns multiple result sets
    /* Input param = @SalesOrderID */
    SELECT * FROM Orders TB1
      INNER JOIN OrderDetails TB2 ON  TB1.ID = TB2.ID
    WHERE TB1.OrderID = @SalesOrderID
    SELECT * FROM Addresses
      WHERE Addresses.OrderID = @SalesOrderID AND Addresses.AddressType = 'Shipping'
    SELECT * FROM Addresses
      WHERE Addresses.OrderID = @SalesOrderID AND Addresses.AddressType = 'Billing'
    This is just a quick sample, the actual procedure is a lot more complex but this illustrates the theory.
    When I set the report source in Crystal X to the stored procedure it is only allowing me to add rows from the first result set.
    Is there any way to get around this issue?
    The reason that I would prefer to use a stored procedure to get all the data is simply performance. Without using one big stored procedure I would have to run at least 6 sub reports which is not acceptable because the number of sub reports could grow exponentially depending on the number of items for a particular sales order.
    Any ideas or input would be greatly appreciated.
    TIA
        - Adam
    P.S
    Sorry for the cross post, I originally posted this question [here|/community [original link is broken];
    but was informed that it might be the wrong forum
    Edited by: Adam Harris on Jul 30, 2008 9:44 PM

    Adam, apologies for the redirect, but it is better to have .NET posts in one place. That way anyone can search the forum for answers. (and I do not have the rights to move posts).
    Anyhow, as long as the report is created, you should be able to pass the datasets as:
    crReportDocument.Database.Tables(0).SetDataSource(dataSet.Tables("NAME_OF_TABLE"))
    Of course alternatively, (not sure if this is possible in your environment) you could create a multi-table ADO .NET dataset and pass that to the report.
    Ludek

  • How do I return two values from a stored procedure into an "Execute SQL Task" within SQL Server 2008 R2

    Hi,
    How do I return two values from a
    stored procedure into an "Execute SQL Task" please? Each of these two values need to be populated into an SSIS variable for later processing, e.g. StartDate and EndDate.
    Thinking about stored procedure output parameters for example. Is there anything special I need to bear in mind to ensure that the SSIS variables are populated with the updated stored procedure output parameter values?
    Something like ?
    CREATE PROCEDURE [etl].[ConvertPeriodToStartAndEndDate]
    @intPeriod INT,
    @strPeriod_Length NVARCHAR(1),
    @dtStart NVARCHAR(8) OUTPUT,
    @dtEnd NVARCHAR(8) OUTPUT
    AS
    then within the SSIS component; -
    Kind Regards,
    Kieran. 
    Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/

    Below execute statement should work along the parameter mapping which you have provided. Also try specifying the parameter size property as default.
    Exec [etl].[ConvertPeriodToStartAndEndDate] ?,?,? output, ? output
    Add a script task to check ssis variables values using,
    Msgbox(Dts.Variables("User::strExtractStartDate").Value)
    Do not forget to add the property "readOnlyVariables" as strExtractStartDate variable to check for only one variable.
    Regards, RSingh

  • Can we pass temporary result set to the  procedure?

    Hi,
    The result set is stored in a temporary storage. Can we pass that resultset to the procedure?
    Thanks and regards
    Gowtham Sen.

    I'm still unclear just what this result set is... Is is a table or a cursor or something else?
    If you imply the physical result set of a SQL query, there is no such thing in Oracle. Oracle does not create and store a result set in memory containing the rows of the SQL SELECT. Creating such sets in memory does not scale. A single SELECT on such a database can kill the performance of the entire database by exhasuting all memory with a single large physical result set.
    Oracle "results" live in the database cache (residing in the SGA). Rows (as data blocks) are paged into and out of this case as demand dictates. When PL/SQL code, for example, fetches a row, the SQL engine grabs the row from the db cache (SGA) and copies it to the PGA (the private memory area of the PL/SQL process). The row also may not yet exist in the db cache - in which case it needs a physical read from disk to get the data block containing that row into the db cache (after which it is copied to the PGA).
    A PL/SQL process can do a bulk fetch - e.g. fetch a 100 rows from the SQL query/cursor at a time. In that case, a 100 rows are copied from the SGA db cache to the PGA.
    At no time is there are single large unique and dedicated memory struct in the SGA that contains the complete "result set" of a SQL query.
    Once you have fetched that row, that is it. Deal is done. You cannot reverse the cursor and fetch the row again. After you have fetched the last row in that cursor, you cannot pass that cursor to another process - the cursor is now empty. That other process cannot rewind the cursor and start fetching from the 1st row again. You will need to pass the SQL to that process in order for it to create its own cursor - also keeping in mind that in between the rows can have changed and that this other process could now see different results with its cursor.
    If you want to create such a physical temporary result set that is consistent and re-usable, you can use a temporary table - and insert the results of the SELECT into this temp table for further processing. This temp table is session specific and is auto destroyed when the session terminates.
    A comment though - it sounds like you're approaching the date warehouse processing (scrubbing, transformation and loading of data) as a row-by-row process.
    That is a flawed approach. Row-by-row processing does not scale. One should deal with data sets. Especially when the volumes are large. One should also attempt to perform minimal passes through a data set. Processing a bunch of rows, then passing that rows to another process to do some processing on the same rows.. this means multiple passes through the same data. That is very inefficient performance and resource wise.

  • Unable to create object from stored procedure universe

    Dear All Experts,
    I am facing a problem on unable to create object dimensions on a Stored procedure universe. Fyi, I have successfully insert a stored procedure ('SP_Sales') with input parameter (@date) into universe (Universe_1). But I unable create any object based on the the stored procedured ('SP_Sales') due to it show nothing from the Edit Select Statement of 'Object1', empty for Tables nd columns windows.
    Thefore, i unable to drag data in WEBI when i select univese as "Universe_1", it will not sure any object. Please advise.
    I am using XI4.0, MSSQL2008.

    Hi ,
    You wont be able to edit the object definitions.
    u2022 Designer generates one table per selected stored procedure (or many
    tables if multiple result sets) and one object per column returned by a
    stored procedure.
    u2022 The result set structure is determined when you describe the function.
    Please refer chapter 7(Page 451) of below document for more details.
    [Universe Designer Guide|http://help.sap.com/businessobject/product_guides/boexir31/en/xi3-1_designer_en.pdf]
    Hope this helps.
    Bilahari M

  • How to get return values from stored procedure to ssis packge?

    Hi,
    I need returnn values from my stored procedure to ssis package -
    My procedure look like  and ssis package .Kindly help me to oget returnn value to my ssis package
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    -- =============================================
    -- Author: <Author,,Name>
    -- Create date: <Create Date,,>
    -- Description: <Description,,>
    -- =============================================
    ALTER PROCEDURE [TSC]
    -- Add the parameters for the stored procedure here
    @P_STAGE VARCHAR(2000)
    AS
    BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;
    -- Insert statements for procedure here
    --SELECT <@Param1, sysname, @p1>, <@Param2, sysname, @p2>
    truncate table [INPUTS];
    INSERT
    INTO
    [INPUTS_BASE]
    SELECT
    [COLUMN]
    FROM [INPUTS];
    RETURN
    END
    and i am trying to get the return value from execute sql task and shown below
    and i am taking my returnn value to result set variable

    You need to have either OUTPUT parameters or use RETURN statement to return a value in stored procedures. RETURN can only return integer values whereas OUTPUT parameters can be of any type
    First modify your procedure to define return value or OUTPUT parameter based on requirement
    for details see
    http://www.sqlteam.com/article/stored-procedures-returning-data
    Once that is done in SSIS call sp from Execute SQL Task and in parameter mapping tabe shown above add required parameters and map them to variables created in SSIS and select Direction as Output or Return Value based on what option you used in your
    procedure.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Callable Statatement returning multiple Result Sets

    Hello all,
    I've got a stored procedure that will be returning multiple result sets and i was wondering if someone could show me how to pull the multiple result sets out of the CallableStatement object. Any help would be greatly appreciated.

    Here is a sample that does what you want. You will have to substitute the call to DBConn.getConnection() with your own DB connection. Also remove the import of com.ovotron.util.*.import com.ovotron.util.*;
    import java.sql.*;
    public class MultiSQL {
        private static Connection conn = null;
        public static void main(String[] args) {
            // Just gets a connection to the DB.
            conn = DBConn.getConnection();
            getResults(conn);
        * Cycles through multiple result sets returned from a stored procedure.
        * Only the first column is output.
        * <p>
        private static void getResults(Connection conn) {
            // Not sure which DBMS you are using. This is the syntax for
            // SQLServer V7.0.
            String            sql     = "{call getMultiResults}";
            CallableStatement stmt    = null;
            ResultSet         rs      = null;
            int               setNo   = 0;
            try {
                stmt = conn.prepareCall(sql);
                boolean found = stmt.execute();
                while (found) {
                    setNo++;
                    rs = stmt.getResultSet();
                    while (rs.next()) {
                        System.out.println("Result set " + setNo +
                                           ": value: " + rs.getString(1));
                        System.out.flush();
                    rs.close();
                    found = stmt.getMoreResults();
            catch (SQLException e) {
                e.printStackTrace();
            finally {
                try {
                    if (rs   != null) rs.close();
                    if (stmt != null) stmt.close();
                catch (SQLException e) {
                    // Tried already to clean up.
    }The procedure I used is:CREATE PROCEDURE [getMultiResults] AS
    select  col1 from tab1;
    select col2 from tab1;
    select col3 from tab1;Of course you will need to create and populate tab1.

Maybe you are looking for

  • "save as" work differently in menue and batch

    If I save in Illustrator CS4 a EPS File from the menue with "save as" and then I place the file in InDesign CS4 and adjust it proportionally to the frame it works fine. The object is shortly to the frame. The same file with the batch option (New Acti

  • Electronic Signature Check Printing Products

    Hello. Does anyone know of any viable third-party electronic signature check printing products/companies that can be used alongside E-Business Suite (or as a stand-a-lone system)? Our Payables checks right now are manually stamped with 2 signatures a

  • Form editor

    HI! Can anyone explain to me as to how to create a line layout and assign that to FORM window (W1).As shown below ID          long text **10         overtime PTyp          CTy 01              Y CV         Rule          Splits Would really appreciate

  • Changing Process Version adds +/- icon

    Something I found really annoying when upgrading to LR3. I asked LR 3 to update the process version to 2010 for all pictures. It worked. However, all my pictures are now being considered has having being modified, thus having the little +/- icon on t

  • Question about decode

    hi all i have a table called employee_report PRCNT_DOWN number(5,2) i want to show the precent with the sign % lets say that the values are PRCNT_DOWN 0 0 5 3 so i did like this select decode(0,0,(to_char(PRCNT_DOWN,'999.99')||'%')) as aa from employ