The statement did not return a result set in ireport

Hi,
    I am Building a Report in iReport(Jasper Reports). I called a stored procedure from iReport by passing a parameter in Query Editor. I am getting an exception saying "The statement did not return a result set". When
i use Temp Tables in stored procedure i am getting the exception.
If there is no temptable in Stored procedure there wont be any exception.
This is my Stored procedure
Create PROCEDURE [XUSP_REPORT_SOPRINT] @BNUM VARCHAR(20) AS
BEGIN
DECLARE @FQTY BIGINT
DECLARE @ITNAME VARCHAR(100)
DECLARE @COUNT INT=0
DECLARE @COUNT1 INT=0
CREATE TABLE #BILL_PRINT(
    [BNUM] [varchar](20) NOT NULL,
    [CNAME] [varchar](30) NOT NULL,
    [CNUM] [int] NOT NULL,
    [ITNAME] [varchar](100) NOT NULL,
    [ITEM#] [int] NOT NULL,
    [QTY] [int] NOT NULL DEFAULT 0,
    [UNIT] [varchar](5) NOT NULL,
    [PRICE] [float] NOT NULL DEFAULT 0,
    [BASIC] [float] NOT NULL DEFAULT 0,
    [DISCOUNT] [float] NOT NULL DEFAULT 0,
    [FRQTY] [int] NOT NULL DEFAULT 0,
    [BADDR] [varchar](300) NULL,
    [CADDR] [varchar](300) NOT NULL,
    [BDATE] [datetime] NULL DEFAULT (sysdatetime()),
    [BILLBY] [varchar](50) NOT NULL,
    [ROUTE] [varchar](200) NULL,
    [AMT] [float] NOT NULL DEFAULT 0,
    [VAT] [float] NOT NULL DEFAULT 0,
    [VAT AMT] [float] NOT NULL DEFAULT 0,
    [AMT_AF_DISC] [float] NOT NULL DEFAULT 0,
    [AMT_AF_VAT] [float] NOT NULL DEFAULT 0,
    [TOT_DISC] [float] NOT NULL DEFAULT 0,
    [ROUND_OFF] [float] NOT NULL DEFAULT 0,
    [TOT_VAT] [float] NOT NULL DEFAULT 0,
    [AMT_UNDER_VAT] [float] NOT NULL DEFAULT 0,
    [NETT] [float] NOT NULL DEFAULT 0,
    [TOS] [varchar](30) NULL DEFAULT 0,
    [CDISC] [float] NOT NULL DEFAULT 0,
    [SDISC] [float] NOT NULL DEFAULT 0
insert into #BILL_PRINT SELECT [BNUM]
      ,[CNAME]
      ,[CNUM]
      ,[ITNAME]
      ,[ITEM#]
      ,[QTY]
      ,[UNIT]
      ,[PRICE]
      ,[BASIC]
      ,[DISCOUNT]
      ,[FRQTY]
      ,[BADDR]
      ,[CADDR]
      ,[BDATE]
      ,[BILLBY]
      ,[ROUTE]
      ,[AMT]
      ,[VAT]
      ,[VAT AMT]
      ,[AMT_AF_DISC]
      ,[AMT_AF_VAT]
      ,[TOT_DISC]
      ,[ROUND_OFF]
      ,[TOT_VAT]
      ,[AMT_UNDER_VAT]
      ,[NETT]
      ,[TOS]
      ,[CDISC]
      ,[SDISC]
  FROM [SALES_DETAILS] WHERE BNUM=@BNUM
CREATE TABLE #ITNAME_0
ITEM VARCHAR(100) NOT NULL,
FREE BIGINT NOT NULL
INSERT INTO #ITNAME_0 SELECT ITNAME,FRQTY FROM SALES_DETAILS WHERE FRQTY<>0 AND BNUM=@BNUM
--SELECT * FROM #ITNAME_0
SET @COUNT=(SELECT COUNT(*) FROM #ITNAME_0)
WHILE @COUNT!=0
BEGIN
SET @FQTY=(SELECT TOP(1) FREE FROM #ITNAME_0)
SET @ITNAME=(SELECT TOP(1) ITEM FROM #ITNAME_0)
SET @COUNT1=(SELECT COUNT(*) FROM #BILL_PRINT WHERE ITNAME=@ITNAME AND BNUM=@BNUM)
IF @COUNT1=2
BEGIN
    UPDATE #BILL_PRINT
    SET FRQTY+=@FQTY
    WHERE ITNAME=@ITNAME AND QTY<>0
    DELETE FROM #ITNAME_0 WHERE ITEM=@ITNAME AND FREE=@FQTY
    DELETE FROM #BILL_PRINT WHERE  ITNAME=@ITNAME AND QTY=0
END
SET @COUNT=@COUNT-1
END
--SELECT *FROM sales_details
SELECT *FROM #BILL_PRINT where bnum=@bnum
DROP TABLE #BILL_PRINT
DROP TABLE #ITNAME_0
END
Please help me out in this.
Thanks,
Shreyas M

This is a forum for Reporting Services (SSRS). If you're using Jasper reports then you should be posting in relevenat forums. I'm not sure there would be enough people with Jasper report experience here to help you out!
Anyways in SSRS when  we use Temp tables in procedure it will throw exception in editor but when you save and run it will still work fine. Did you try saving it and executing report? Did the error still persisted?
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page

Similar Messages

  • Avoid JDBC sender error: Execute statement did not return a result set

    Hi!
    My JDBC sender adapter towards MS SQL server works fine, with an Execute statement calling a stored procedure that returns the source data needed. The stored procedure itself updates the status of database table records, so that only the unread records are returned each time the stored procedure is called.
    However, the communication channel monitoring sets a red flag for the JDBC sender adapter, when there are no values to fetch from the database table (using the stored procedure). Message says: "Database-level error reported by JDBC driver while executing statement 'EXECUTE FetchMessage 1, 9000'. The JDBC driver returned the following error message: 'com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.'. For details, contact your database server vendor."
    This is not an error situation, as I do not expect there to be any values to fetch from the database at all times.
    I do not see how to change the stored procedure to avoid this error.
    Is there a parameter to be set on the JDBC adapter that I can use, so the red flag is avoided?
    Thanks for any input!
    Regards,
    Oeystein Emhjellen

    Hi Oeystein Emhjellen.
    The problem is Store Procedure that has to generate always a ResultSet (or cursor). If it doesn't have a output, you have to generate an Empty ResultSet.
    Like a SELECT Statement:
    If there are data, SELECT get an output result but if it get nothing the SELECT Statement get a empty ResultSet.
    Ask to your database team.
    I hope it helps you.
    Bruno.

  • The operation is not allowed for result set type FORWARD_ONLY

    Hi,
    I am trying to use scroll insensitive resultset in following manner-
    Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
    ResultSet rs = stmt.executeQuery("some sql here");
    rs.last();
    but the rs.last() throws this exception-
    com.sap.dbtech.jdbc.exceptions.SQLExceptionSapDB: The operation is not allowed for result set type FORWARD_ONLY.
         at com.sap.dbtech.jdbc.ResultSetSapDB.assertNotForwardOnly(ResultSetSapDB.java:2725)
         at com.sap.dbtech.jdbc.ResultSetSapDB.last(ResultSetSapDB.java:557)
    Database version: Kernel    7.5.0    Build 019-121-082-363
    Driver Version: MaxDB JDBC Driver, MySQL MaxDB, 7.6.0    Build 030-000-005-567
    This used to work with 7.5 version driver. Why this is failing with 7.6 driver, any clues?
    Thanks,
    Vinod

    Hi Vinod,
    due to performance improvement when using forward only cursor we changed the default for the resultset type from TYPE_SCROLL_SENSITIVE to TYPE_FORWARD_ONLY starting with JDBC driver version 7.6. So I guess the exception comes from a statement where you didn't set the resultset type while creating it. Please check if all of the statements that you want to be scrollable have set the correct resultset type.
    Regards,
    Marco

  • Replenishment - Msg WT134: Store order processing did not return any result

    During the Replenishment run using TCODE: WRP1 following error is being encountered
    <b>Msg WT134: Store order processing did not return any result</b>
    The error is reported when more than 9 articles are being used.

    impelemented the oss note: 979935

  • The provider did not return a ProviderManifest instance. Metadata is invali

    I am using VS2010 SP1
    Latest version of ODP.net downloaded for 32 bilt.
    I am getting the following error message when I try to build my project
    Error 168: The provider did not return a ProviderManifest instance. FSDEVTL.GET_SUPPLIERS.RefCursorMetaData.SUPPLIER_NAME.Column.0 Metadata is invalid
    My app.config entry looks as follows:
    *<oracle.dataaccess.client>*
    *<settings>*
    *<add name="FSDEVTL.GET_SUPPLIERS.RefCursor.SUPP_LIST" value="implicitRefCursor bindinfo='mode=Output'" />*
    *<add name="FSDEVTL.GET_SUPPLIERS.RefCursorMetaData.SUPPLIER_NAME.Column.1" value="implicitRefCursor metadata='ColumnName=SUPPLIER_NAME;BaseColumnName=SUPPLIER_NAME;BaseSchemaName=FSDEVTL;BaseTableName=A_SUPPLIER;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />*
    *</settings>*
    *</oracle.dataaccess.client>*
    My stoerd procedure looks as follows:
    PROCEDURE "GET_SUPPLIERS" (
    "SUPP_LIST" OUT SYS_REFCURSOR) IS
    BEGIN
         OPEN SUPP_LIST FOR
         SELECT
              SUPPLIER_NAME
         FROM
              A_SUPPLIER ;
    END;
    Please assist me.
    Thanks
    Edited by: 923484 on Mar 26, 2012 2:06 PM

    Also it should start from Column.0. But you put:
    <add name="FSDEVTL.GET_SUPPLIERS.RefCursorMetaData.SUPPLIER_NAME.Column.1" value="implicitRefCursor
    *With the following in your config file, do you still have the issue?*
    <add name="FSDEVTL.GET_SUPPLIERS.RefCursor.SUPP_LIST" value="implicitRefCursor bindinfo='mode=Output'" />
    <add name="FSDEVTL.GET_SUPPLIERS.RefCursorMetaData.*SUPP_LIST*.Column.*0*" value="implicitRefCursor metadata='ColumnName=SUPPLIER_NAME;BaseColumnName=SUPPLIER_NAME;BaseSchemaName=FSDEVTL;BaseTableName=A_SUPPLIER;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    Edited by: shsu on Oct 10, 2012 3:30 PM

  • SUM(CASE WHEN statement is not returning proper result.

    Hi Folks,
    I'm an end-user on OBIEE 11g creating a custom analysis. I'm trying to SUM a particular case statement: SUM(CASE WHEN "MyMeasureColumn.Here" LIKE '%~25~%' OR "MyMeasureColumn.Here" LIKE '%~26~%' OR "MyMeasureColumn.Here" LIKE '%~27~%' OR "MyMeasureColumn.Here" LIKE '%~28~%' THEN 1 ELSE 0 END)
    The result should be about 6,700 however I am getting only 1,900. Any ideas?

    >
    Ive done a manual validation of the statement (in excel) and know its near 6700. I think it has something to do with the type of data it is?
    >
    Well there are only three possibilities that I can think of.
    1. The data in Excel is different than the data in Oracle
    2. The 'manual validation' is different than what the query that you are using does
    3. Both #1 and #2
    You are the only one with access to the data.
    You are the only one that has any idea what your 'manual validation' was.
    If necessary you will need to use the brute force 'divide and conquer' method.
    Use a small amount of data and compare your 'manual validation to your query results. If they are not the same figure out why.
    If they are the same then repeat the process with another set of the data.

  • I embedded a pdf in an Outlook appointment.  The appointment synced with my iPad calendar, but the pdf did not come through.  Am I missing a setting?

    I embedded a pdf in an Outlook appointment on my desktop.  The appointment synced with my iPad calendar correctly but the pdf did not come through.  Did I miss a setting on my iPad?
    Thank you

    Then your family members will probably have bought their ipads with a data plan from some phone company like AT&T in the States. Maybe they even got it "sponsored", because they bought a data plan with it.
    If you bought your "iPad only" from a hardware seller, you will have to get a data plan from some phone company. Seems like you only bougth the hardware! You can still use your ipad, however, and if you have an iPhone, you do not even need a sim card in your iPad, because it can use your iPhone's data plan.
    That is what I did. I save the extra money for the 3G version, because with an iPhone 4 there is no need for an own sim Card in an iPad.
    But that is another topic.

  • I-bot not emailing when report returns large result set..

    Hi,
    I am trying to set up an i-bot to run daily and email the results to the user. Assuming the report in question is Report_A.
    Report_A returns around 60000 rows of data without any filter condition. When I tried to set up thei-bot for Report_A (No filter conditions on the report) the ibot is publishing results to dashboard but is not delivering via email. When I introduce a filter in Report_A to reduce the data returned then everything works fine and email is being sent out successfully.
    So
    1) Is there a size limit for i-bots to deliver by email?
    2) Is there a way to increase the limits if any so the report can be emailed even when returning large result sets?
    Please let me know.

    Sorry for late reply
    Below is the log file for one of the i-bots. Now I am getting an error message "***kmsgPortalGoRequestHasBeenCancelled: message text not found ***" and the i-bot alert message shows as "Cancelled".
    +++ ThreadID: f3c6cb90 : 2010-12-17 23:55:04.551
    [nQSError: 77006] Oracle BI Presentation Server Error: A fatal error occurred while processing the request. The server responded with: ***kmsgPortalGoRequestHasBeenCancelled: message text not found ***
    Error Codes: YLKKAV7S
    Error Codes: AGEGTYVF
    +++ ThreadID: f3c6cb90 : 2010-12-17 23:55:04.553
    iBotID: /shared/_ibots/common/TM/Claims Report
    ...Trying iBot Get Response Content loop again.
    +++ ThreadID: f3c6cb90 : 2010-12-17 23:55:04.554
    ... Sleeping for 8 seconds.
    +++ ThreadID: f3c6cb90 : 2010-12-17 23:55:12.642
    [nQSError: 77006] Oracle BI Presentation Server Error: A fatal error occurred while processing the request. The server responded with: ***kmsgPortalGoRequestHasBeenCancelled: message text not found ***
    Error Codes: YLKKAV7S
    Error Codes: AGEGTYVF
    +++ ThreadID: f3c6cb90 : 2010-12-17 23:55:12.644
    iBotID: /shared/_ibots/common/TM/Claims Report
    ...Trying iBot Get Response Content loop again.
    +++ ThreadID: f3c6cb90 : 2010-12-17 23:55:12.644
    ... Sleeping for 6 seconds.
    +++ ThreadID: f3c6cb90 : 2010-12-17 23:55:18.730
    [nQSError: 77006] Oracle BI Presentation Server Error: A fatal error occurred while processing the request. The server responded with: ***kmsgPortalGoRequestHasBeenCancelled: message text not found ***
    Error Codes: YLKKAV7S
    Error Codes: AGEGTYVF
    +++ ThreadID: f3c6cb90 : 2010-12-17 23:55:18.734
    iBotID: /shared/_ibots/common/TM/Claims Report
    Exceeded number of request retries.

  • SQL 2012 - SSIS Error -The step did not generate any output. The return value was unknown. The process exit code was -1073741819. The step failed.

    Hi guys 
     Trying to run this package on SQL 2012 agent  and getting below error . No more details I could find so far.
    The step did not generate any output.  The return value was unknown.  The process exit code was -1073741819.  The step failed.
    About Package - Its connecting to different version (2000,2005,2008,2008R2,2012) servers and putting Jobs information into one Database table.  
    Any workaround or fix ?
    Thanks
    Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach

    New package or one that used to work? Connecting how? How does it poll?
    On the surface it is an error from a memory space of the binary/non-managed code, so nothing can be really concluded based on what you decided to share with us.
    Arthur My Blog
    So Same package is working fine from my local machine which has SQL 2008 R2 and SQL 2012 installed. I am trying to push the package on server which has sql server 2012 Installed . 
    I don't see any error .
    I ran package manually from server using SQL Data tools and ran successfully...
    Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach

  • Hi i need some help im having problems the ipod can not be turned , in fact it was working fine but suddenly switched off and did not return to light n because it reconnected and if I had drums

    hi i need some help im having problems , the ipod can not be turned , in fact it was working fine but suddenly switched off and did not return to light n because it reconnected and if I had drums  . what can i do to turned on .
    its an ipod touch 64gb

    That symptom is covered here:
    iPod touch: Hardware troubleshooting

  • Table-Valued Function not returning any results

    ALTER FUNCTION [dbo].[fGetVendorInfo]
    @VendorAddr char(30),
    @RemitAddr char(100),
    @PmntAddr char(100)
    RETURNS
    @VendorInfo TABLE
    vengroup char(25),
    vendnum char(9),
    remit char(10),
    payment char(10)
    AS
    BEGIN
    insert into @VendorInfo (vengroup,vendnum)
    select ks183, ks178
    from hsi.keysetdata115
    where ks184 like ltrim(@VendorAddr) + '%'
    update @VendorInfo
    set remit = r.remit
    from
    @VendorInfo ven
    INNER JOIN
    (Select ksd.ks188 as remit, ksd.ks183 as vengroup, ksd.ks178 as vendnum
    from hsi.keysetdata117 ksd
    inner join @VendorInfo ven
    on ven.vengroup = ksd.ks183 and ven.vendnum = ksd.ks178
    where ksd.ks192 like ltrim(@RemitAddr) + '%'
    and ks189 = 'R') r
    on ven.vengroup = r.vengroup and ven.vendnum = r.vendnum
    update @VendorInfo
    set payment = p.payment
    from
    @VendorInfo ven
    INNER JOIN
    (Select ksd.ks188 as payment, ksd.ks183 as vengroup, ksd.ks178 as vendnum
    from hsi.keysetdata117 ksd
    inner join @VendorInfo ven
    on ven.vengroup = ksd.ks183 and ven.vendnum = ksd.ks178
    where ksd.ks192 like ltrim(@PmntAddr) + '%'
    and ks189 = 'P') p
    on ven.vengroup = p.vengroup and ven.vendnum = p.vendnum
    RETURN
    END
    GO
    Hi all,
    I'm having an issue where my Table-Valued Function is not returning any results.
    When I break it out into a select statement (creating a table, and replacing the passed in parameters with the actual values) it works fine, but with passing in the same exact values (copy and pasted them) it just retuns an empty table.
    The odd thing is I could have SWORN this worked on Friday, but not 100% sure.
    The attached code is my function.
    Here is how I'm calling it:
    SELECT * from dbo.fGetVendorInfo('AUDIO DIGEST', '123 SESAME ST', 'TOP OF OAK MOUNTAIN')
    I tried removing the "+ '%'" and passing it in, but it doesn't work.
    Like I said if I break it out and run it as T-SQL, it works just fine.
    Any assistance would be appreciated.

    Why did you use a proprietary user function instead of a VIEW?  I know the answer is that your mindset does not use sets. You want procedural code. In fact, I see you use an “f-” prefix to mimic the old FORTRAN II convention for in-line functions! 
    Did you know that the old Sybase UPDATE.. FROM.. syntax does not work? It gives the wrong answers! Google it. 
    Your data element names make no sense. What is “KSD.ks188”?? Well, it is a “payment_<something>”, “KSD.ks183” is “vendor_group” and “KSD.ks178” is “vendor_nbr” in your magical world where names mean different things from table to table! 
    An SQL programmer might have a VIEW with the information, something like:
    CREATE VIEW Vendor_Addresses
    AS
    SELECT vendor_group, vendor_nbr, vendor_addr, remit_addr, pmnt_addr
      FROM ..
     WHERE ..;
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • OLE DB provider 'OraOLEDB.Oracle' reported an error The provider did not gi

    Hi, I've setup oracle client tools on a windows server that runs sql server 7
    tnsping works as well as the client tool test feature on my sid.
    However, I can't seem to use it from SQL Server. I've installed and uninstalled the client tools many times, I'm beginning to think perhaps I installed the wrong package. Weird thing is there is no Listener listed in Windows Services, yet the listener I setup is working.
    I enabled the allow in process property of both the MSADAORA and Oracle OLE drivers from SQL Server, help!!
    SELECT * FROM OPENQUERY(ORACLE_MIRROR, 'select count(1) from dual')
    RESULTS IN:
    Server: Msg 7399, Level 16, State 1, Line 1
    OLE DB provider 'MSDAORA' reported an error.
    [OLE/DB provider returned message: Oracle client and networking components were not found. These components are supplied by Oracle Corporation and are part of the Oracle Version 7.3.3 or later client software installation.
    Provider is unable to function until these components are installed.]
    OLE DB error trace [OLE/DB Provider 'MSDAORA' IDBInitialize::Initialize returned 0x80004005:   ].
    THIS IS AFTER I HAVE INSTALLED THE ORACLE 10.2 CLIENT TOOLS AND SETUP A LISTENER AND TESTED SIDS OK.
    UTILIZING THE ORACLE OLE DRIVER IN THE LINKED SERVER I GET THIS ERROR:
    Server: Msg 7399, Level 16, State 1, Line 1
    OLE DB provider 'OraOLEDB.Oracle' reported an error. The provider did not give any information about the error.
    OLE DB error trace [OLE/DB Provider 'OraOLEDB.Oracle' IDBInitialize::Initialize returned 0x80004005:  The provider did not give any information about the e                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    The MS OLEDB for Oracle was built some time ago and requires an older SQL*Net version:
    OLE/DB provider returned message: Oracle client and networking components were not found. These components are supplied by Oracle Corporation and are part of the Oracle Version 7.3.3 or later client software installation.
    => see Oracle Version V7.3.3 ... but you have installed V10; so the OLEDB driver from MS tries to locate old SQL*Net client library files which are not available in your installation anymore.
    So best would be to use the Oracle OLEDB driver coming with the SQL*Net client you have installed.
    As you mentioned this causes a different error:
    Server: Msg 7399, Level 16, State 1, Line 1
    OLE DB provider 'OraOLEDB.Oracle' reported an error. The provider did not give any information about the error.
    OLE DB error trace [OLE/DB Provider 'OraOLEDB.Oracle' IDBInitialize::Initialize returned 0x80004005: The provider did not give any information about the e
    This error is related to the OLEDB process running by default in "out-of-process" mode which doesn't work with Oracle OLEDB driver. By setting a key in the registry under SQL Server this can be changed to run in-process (the default) the provider will work:
         HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Providers\ORAOLEDB.ORACLE
    Change the value of the key "AllowInProcess" under the "OraOLEDB.Oracle" folder
    to a hexadeciaml value of 1.
    If the key does not exist create it as a new DWORD value.
    See also:
    Article-ID:         Note 260775.1
    Title:              ORA-12560 Attempting to Query the Oracle Database from
                        Microsoft SQL Server's SQL Query Analyzer Using the Oracle
                        Provider for OLE DB                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to get the number of columns in a result set???

    hi everyone..
    i am trying to establish a servlet applet communication....
    my applet send the sql query to the servlet as serialised string and then the servlet executes the query...
    Since i need to pass the result back to the applet, i thaught of passing the whole reult set to the applet..but that seems to be not possible..
    so i thaught of storing my result set data in a vector and then pass the vector,but the first problem that i came across is that how to get the number of colums in a result set....
    so is there a way to get the number of columns in a result set...???
    and also i would like to know if it possible to send my whole result set to the applet bye serialization or by any method...???
    thanx in advance

    You shouldn't do. It expenses resources (you should always close the ResultSet and the Statement as fast as possible). Simply gently process it into a Collection or Map of DTO's. Those are serializable.

  • Problem in SQL with CURSOR( ) ,Why the CURSOR did not work?

    hi All:
    I have a problem in SQL with CURSOR.
    The data is as the attachments.
    Here is the SQL statement as follow:
    SELECT A.WADCTO,A.WADOCO,B.IGCOST,CURSOR (SELECT X.IGLITM
    FROM F3102 X
    WHERE X.IGDOCO=A.WADOCO
    AND X.IGCOST IN ('B1','D1','C3')) AS DETAIL
    FROM F4801 A INNER JOIN F3102 B ON A.WADOCO=B.IGDOCO AND A.WADCTO=B.IGDCTO AND B.IGCOST>' '
    WHERE A.WADOCO='10004'
    The statement above returns records as follow:
    WADC WADOCO IGCOST DETAIL
    WO 10004 A1 CURSOR STATEMENT : 4
    CURSOR STATEMENT : 4
    IGLITM
    1KV90CPG2
    1KV90CPG2
    1KV90CPG2
    But, after I add one statement in the subquery, there is no record returned from CURSOR.
    Here is the SQL statement:
    SELECT A.WADCTO,A.WADOCO,B.IGCOST,CURSOR (SELECT X.IGLITM
    FROM F3102 X
    WHERE X.IGDOCO=A.WADOCO
    AND X.IGCOST=B.IGCOST
    AND X.IGCOST IN ('B1','D1','C3')) AS DETAIL
    FROM F4801 A INNER JOIN F3102 B ON A.WADOCO=B.IGDOCO AND A.WADCTO=B.IGDCTO AND B.IGCOST>' '
    WHERE A.WADOCO='10004'
    The statement above returns records as follow:
    WADC WADOCO IGCOST DETAIL
    WO 10004 A1 CURSOR STATEMENT : 4
    CURSOR STATEMENT : 4
    no rows selected
    Why the CURSOR did not work?
    The database version is Oracle Database 10g Release 10.2.0.4.0 - 64bit Production.
    F3102 DATA:
    IGDOCO     IGDCTO     IGLITM     IGCOST
    10004     WO     1KV90CPG2      A1
    10004     WO     1KV90CPG2      B1
    10004     WO     1KV90CPG2      C3
    10004     WO     1KV90CPG2      D1
    F4801 DATA:
    WADCTO     WADOCO
    WO     10004
    Edited by: user2319139 on 2010/3/2 上午 1:17
    Edited by: user2319139 on 2010/3/2 上午 1:20

    Why this structure and not a join?
    The cursor() function returns a cursor handle that needs to be processed - in other words, the client needs to fetch data from it. The Oracle® Database SQL Reference+ (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/expressions005.htm#i1035107) describes it as being equivalent to a ref cursor handle.
    Thus why are you creating ref cursor handles as a column in a SQL projection - where each row will have a "+nested+" ref cursor handle to process. What problem are you attempting to hack solve this way?

  • Returning a result set/record from a dynamic query

    There seems to be plenty of examples for using Native Dynamic Sql to formulate and execute a dynamic query, however there are no examples of returning a result set or records which contain the rows of data that are retrieved by executing the query. Could someone give us an example?

    Welcome to the Oracle forum....
    CREATE OR REPLACE PACKAGE curspkg_join AS
    TYPE t_cursor IS REF CURSOR ;
    Procedure open_join_cursor1 (n_EMPNO IN NUMBER, io_cursor IN OUT t_cursor);
    END curspkg_join;
    Create the following Oracle package body on the Oracle server:
    CREATE OR REPLACE PACKAGE BODY curspkg_join AS
    Procedure open_join_cursor1 (n_EMPNO IN NUMBER, io_cursor IN OUT t_cursor)
    IS
    v_cursor t_cursor;
    BEGIN
    IF n_EMPNO <> 0
    THEN
    OPEN v_cursor FOR
    SELECT EMP.EMPNO, EMP.ENAME, DEPT.DEPTNO, DEPT.DNAME
    FROM EMP, DEPT
    WHERE EMP.DEPTNO = DEPT.DEPTNO
    AND EMP.EMPNO = n_EMPNO;
    ELSE
    OPEN v_cursor FOR
    SELECT EMP.EMPNO, EMP.ENAME, DEPT.DEPTNO, DEPT.DNAME
    FROM EMP, DEPT
    WHERE EMP.DEPTNO = DEPT.DEPTNO;
    END IF;
    io_cursor := v_cursor;
    END open_join_cursor1;
    END curspkg_join;
    Dim Oraclecon As New OracleConnection("Password=pwd;" & _
    "User ID=uid;Data Source=MyOracle;")
    Oraclecon.Open()
    Dim myCMD As New OracleCommand()
    myCMD.Connection = Oraclecon
    myCMD.CommandText = "curspkg_join.open_join_cursor1"
    myCMD.CommandType = CommandType.StoredProcedure
    myCMD.Parameters.Add(New OracleParameter("io_cursor", OracleType.Cursor)).Direction = ParameterDirection.Output
    myCMD.Parameters.Add("n_Empno", OracleType.Number, 4).Value = 123
    Dim myReader As OracleDataReader
    Try
    myCMD.ExecuteNonQuery()
    Catch myex As Exception
    MsgBox(myex.Message)
    End Try
    myReader = myCMD.Parameters("io_cursor").Value
    Dim x, count As Integer
    count = 0
    Do While myReader.Read()
    For x = 0 To myReader.FieldCount - 1
    Console.Write(myReader(x) & " ")
    Next
    Console.WriteLine()
    count += 1
    Loop
    MsgBox(count & " Rows Returned.")
    myReader.Close()
    Oraclecon.Close()
    The above code is working in one of our application; which is using ref cursor as result set and get from procedure. I hope you can found more code by google and/or search in this forum as well; if above code is not useful to you.
    HTH
    Girish Sharma

Maybe you are looking for

  • Can't find the icon Macintosh HD on my desktop, how do I get it back?

    I just noticed that the Macintosh HD icon is missing from my desktop...have looked all over for it. Search just gives (path/) no path. Finder is working well, but in trying to resolve the situation I clicked on the arrow beside the list of hard drive

  • Layout in different page dimensions?

    I wonder how I could make a layout in a different format, for example a square page or a horizontal page for a book. Is there a way to do that? Thanks I'm using pages 2.0.2

  • Passing Mulitiple Parameters in a Drill Down Report

    Hi, I can pass single parameter in a Drill Down Report.. But i cant passes more then one parameter at same time,, Example. First I tried Dates passes to another Report its work srw.run_report('report=D:\REPORTS\LIST_OF_DISBRUSTMENTS destype=screen pa

  • Ink smearing with HP PhotoSmart A826

    My A826 suddenly began printing very wet ink and smearing. I've aligned and cleaned to no avail. The problem started with an old cartridge after printing 4 photos perfectly. I changed to a new HP 110 cartridge and the problem continued. Can anyone he

  • Calling Windows XP FTP Command in java

    Hi there! Need help in calling Windows XP FTP command in java: executing the FTP command in DOS works well, but when I tried calling it in java using Process and Runtime objects, it successfully transferred the files from remote to my local pc... but