Report on results of multiple stored procs

Post Author: RobotSlave
CA Forum: Data Connectivity and SQL
I'm creating a report where I have data coming from three different slightly related stored procs,  when I try to get sub totals from the result sets my data is all wacky. How to I get the totals right, here is a typical set of the recordsets:
set 1:
AMERICAN SECURITY PLUS 2 221 AUBURN/HERITAGE FORD Active 1 203.4100 Before Used Greater OtherAMERICAN SECURITY PLUS 2 221 AUBURN/HERITAGE FORD Active 1 146.1800 Before New Greater PreferredAMERICAN SECURITY PLUS 2 221 AUBURN/HERITAGE FORD Active 1 691.7800 Before Used Greater PreferredAMERICAN SECURITY PLUS 2 221 AUBURN/HERITAGE FORD Active 21 9718.3800 Since New Greater OtherAMERICAN SECURITY PLUS 2 221 AUBURN/HERITAGE FORD Active 1 196.5000 Since New Less OtherAMERICAN SECURITY PLUS 2 221 AUBURN/HERITAGE FORD Active 4 820.9000 Since Used Greater OtherAMERICAN SECURITY PLUS 2 221 AUBURN/HERITAGE FORD Active 22 7410.0500 Since New Greater PreferredAMERICAN SECURITY PLUS 2 221 AUBURN/HERITAGE FORD Active 6 2683.0500 Since New Less PreferredAMERICAN SECURITY PLUS 2 221 AUBURN/HERITAGE FORD Active 3 1533.6900 Since Used Greater Preferred
set 2:
AMERICAN SECURITY PLUS AUBURN/HERITAGE FORD 2 221 114 51 1998-08-03 13:13:00.000 Active New GreaterAMERICAN SECURITY PLUS AUBURN/HERITAGE FORD 2 221 114 5 1998-08-03 13:13:00.000 Active New LessAMERICAN SECURITY PLUS AUBURN/HERITAGE FORD 2 221 114 17 1998-08-03 13:13:00.000 Active Used Greater
set 3:
AMERICAN SECURITY PLUS 2 AUBURN/HERITAGE FORD 221 .0000 .0000 New GreaterAMERICAN SECURITY PLUS 2 AUBURN/HERITAGE FORD 221 .0000 .0000 New LessAMERICAN SECURITY PLUS 2 AUBURN/HERITAGE FORD 221 .0000 .0000 Used Greater

Post Author: RobotSlave
CA Forum: Data Connectivity and SQL
I think I will just consolidate this data into one set in a stored proc.

Similar Messages

  • Problem Obtaining multiple results from MySql Stored Proc via JDBC

    I've spent alot of time on this and I'd be really grateful for anyones help please!
    I have written a java class to execute a MySQL stored procedure that does an UPDATE and then a SELECT. I want to handle the resultset from the SELECT AND get a count of the number of rows updated by the UPDATE. Even though several rows get updated by the stored proc, getUpdateCount() returns zero.
    It's like following the UPDATE with a SELECT causes the updatecount info to be lost. I tried it in reverse: SELECT first and UPDATE last and it works properly. I can get the resultset and the updatecount.
    My Stored Procedure:
    delimiter $$ CREATE PROCEDURE multiRS( IN drugId int, IN drugPrice decimal(8,2) ) BEGIN UPDATE drugs SET DRUG_PRICE = drugPrice WHERE DRUG_ID > drugId; SELECT DRUG_ID, DRUG_NAME, DRUG_PRICE FROM Drugs where DRUG_ID > 7 ORDER BY DRUG_ID ASC; END $$
    In my program (below) callablestatement.execute() returns TRUE even though the first thing I do in my stored proc is an UPDATE not a SELECT. Is this at odds with the JDBC 2 API? Shouldn't it return false since the first "result" returned is NOT a resultset but an updatecount? Does JDBC return any resultsets first by default, even if INSERTS, UPDATES happened in the stored proc before the SELECTs??
    Excerpt of my Java Class:
    // Create CallableStatement CallableStatement cs = con.prepareCall("CALL multiRS(?,?)"); // Register input parameters ........ // Execute the Stored Proc boolean getResultSetNow = cs.execute(); int updateCount = -1; System.out.println("getResultSetNow: " +getResultSetNow); while (true) { if (getResultSetNow) { ResultSet rs = cs.getResultSet(); while (rs.next()) { // fully process result set before calling getMoreResults() again! System.out.println(rs.getInt("DRUG_ID") +", "+rs.getString("DRUG_NAME") +", "+rs.getBigDecimal("DRUG_PRICE")); } rs.close(); } else { updateCount = cs.getUpdateCount(); if (updateCount != -1) { // it's a valid update count System.out.println("Reporting an update count of " +updateCount); } } if ((!getResultSetNow) && (updateCount == -1)) break; // done with loop, finished all the returns getResultSetNow = cs.getMoreResults(); }
    The output of running the program at command line:
    getResultSetNow: true 28, Apple, 127.00 35, Orange, 127.00 36, Bananna, 127.00 37, Berry, 127.00 Reporting an update count of 0
    During my testing I have noticed:
    1. According to the Java documentation execute() returns true if the first result is a ResultSet object; false if the first result is an update count or there is no result. In my java class callablestatement.execute() will return TRUE if in the stored proc the UPDATE is done first and then the SELECT last or vica versa.
    2. My java class (above) is coded to loop through all results returned from the stored proc in succession. Running this class shows that any resultsets are returned first and then update counts last regardless of the order in which they appear in the stored proc. Maybe there is nothing unusual here, it may be that Java is designed to return any Resultsets first by default even if they didn't happen first in the stored procedure?
    3. In my stored procedure, if the UPDATE happens last then callablestatement.getUpdateCount() will return the correct number of updated rows.
    4. If the UPDATE is followed by a SELECT (see above) then callablestatement.getUpdateCount() will return ZERO even though rows were updated.
    5. I tested it with the stored proc doing SELECT - UPDATE - SELECT and again getUpdateCount() returns ZERO.
    6. I tested it with the stored proc doing SELECT - UPDATE - SELECT - UPDATE and this time getUpdateCount() returns the number rows updated by the last UPDATE and not the first.
    My Setup:
    Mac OS X 10.3.9
    Java 1.4.2
    mysql database 5.0.19
    mysql-connector 5.1.10 (connector/J)
    Maybe I have exposed a bug in JDBC?
    Thanks for your help.

    plica10 wrote:
    Jschell thank you for your response.
    I certainly don't mean to be rude but I often get taken that way. I like to state facts as I see them. I'd love to be proved wrong because then I would understand why my code doesn't work!
    Doesn't matter to me if you are rude or not. Rudeness actually makes it more entertaining for me so that is a plus. Nothing I have seen suggests rudeness.
    In response to your post:
    When a MySql stored procedure has multiple sql statements such as SELECT and UPDATE these statements each produce what the Java API documentation refers to as 'results'. A Java class can cycle through these 'results' using callableStatement dot getMoreResults(), getResultSet() and getUpdateCount() to retrieve the resultset object produced by Select queries and updateCount produced by Inserts, Deletes and Updates.
    As I read your question it seems to me that you have already proven that it does not in fact do that?
    You don't have to read this but in case you think I'm mistaken, there is more detail in the following website under the heading 'Using the Method execute':
    http://docsrv.sco.com/JDK_guide/jdbc/getstart/statement.doc.html#1000107
    Sounds reasonable. But does not your example code prove that this is not what happens for the database and driver that you are using?
    Myself I dont trust update counts at all since, in my experience some databases do not return them. And per other reports sometimes they don't return the correct value either.
    So there are two possibilities - your code is wrong or the driver/database does not do it. For me I would also question whether in the future the driver/database would continue to behave the same if you did find some special way to write your SQL so it does do it. And of course you would also need to insure that every proc that needed this would be written in this special way. Hopefully not too many of those.
    So this functionality is built into java but is not in common use amongst programmers. My java class did successfully execute a stored proc which Selected from and then finally Updated a table. My code displayed the contents of the Select query and told me how many rows were affected by the update.
    It isn't "built into java". It isn't built into jdbc either. If it works at all then the driver and by proxy the database are responsible for it. I suspect that you would be hard pressed to find anything in the JDBC spec that requires what that particular link claims. I believe it is difficult to find anything that suggests that update counts in any form are required.
    So you are left with hoping that a particular driver does do it.
    I suppose it is rare that you would want to do things this way. Returning rowcounts in OUT parameters would be easier but I want my code to be modular enough to cover the situation where a statement may return more than one ResultSet object, more than one update count, or a combination of ResultSet objects and update counts. The sql may need to be generated dynamically, its statements may be unknown at compile time. For instance a user might have a form that allows them to build their own queries...
    Any time I see statements like that it usually makes me a bit uncomfortable. If I am creating data layers I either use an existing framework or I generate the code. For the latter there is no generalization of the usage. Every single operation is laid out in its own code.
    And I have in fact created generalized frameworks in the past before. I won't do it again. Benefits of the other idioms during maintenance are too obvious.

  • How to generate a report in pdf from a stored proc

    Hi, i need guidance on how to generate a report in pdf from an oracle stored proc.
    The environment is oracle 10gas + 10gdb.
    On a specific event, a PL/SQL stored procedure is called to do some processing and at the end of the processing to generate report which has to be sent to the printer (and optionally previewed by the user).
    Can anyone assist me with this?

    Hi ,
    One 'simple' way is by using the DBMS_SCHEDULER db package and the procedure CREATE_JOB(....) using as job_type the value 'EXECUTABLE'...
    Read for further info in 'PL/SQL Packages and Types Reference'.
    If you have access to OEM ... you can configure this there using wizard.....
    Other way is to use the External Procedure call capabiblity of Oracle DB Server...:
    http://www.oracle.com/pls/db102/ranked?word=external+procedure+call&remark=federated_search
    My greetings,
    Sim

  • How to trigger a report based on a event/stored proc or sql dts completion

    Post Author: Crystaldev
    CA Forum: Publishing
    I want to run/trigger a crystal report based on file existence or based on a stored proc/sql dts/a value present in a sql table. The way I want to do is schedule a crystal report in crystal enterprise and then run the report based on a event like file existence or based on a sql dts completion or a value existence in a sql table. We are using crystal reports v10.
    I am not sure how we can do this, any help is appreciated. Thanks.

    Hi
    When you click on View Data, at bottom click on Edit button
    It will prompt a connection details tab wherein you can view and modify the connections
    Nik

  • JDBC receiver adapter with multiple stored procs error

    Hi all,
      I am doing a scenario IDOC-XI-JDBC. The destination system in MS SQL server 2000. I am passing variant config information to update the destination tables by triggering the same stored procedure multiple times with different parameters.
      Everything is correct, but JDBC adapter is giving me the following error
    Unable to execute statement for table or stored procedure. 'mk_EditAllowedLowerSpineImprintingOptions_proc' (Structure 'CallProc') due to java.lang.IllegalArgumentException
    My payload looks like this. This is just a partial payload, the blocks of CallProc continue till the CallsRemaining number reaches zero(0).
      <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:MT_UPDATEPERSONAVARIANTS xmlns:ns0="urn:sd:sales:sapvarianttablestopersona">
    - <CallProc>
    - <Update_Persona_Variants action="EXECUTE">
      <table>mk_EditAllowedLowerSpineImprintingOptions_proc</table>
      <AlbumType type="CHAR">7SPEC</AlbumType>
      <UpperSpineImprintingOption type="CHAR">UST</UpperSpineImprintingOption>
      <LowerSpineImprintingOption type="CHAR">NOL</LowerSpineImprintingOption>
      <EffectiveDate type="DATE">20040503</EffectiveDate>
      <CallsRemaining type="INTEGER">27</CallsRemaining>
      </Update_Persona_Variants>
      </CallProc>
    - <CallProc>
    - <Update_Persona_Variants action="EXECUTE">
      <table>mk_EditAllowedLowerSpineImprintingOptions_proc</table>
      <AlbumType type="CHAR">7SENT</AlbumType>
      <UpperSpineImprintingOption type="CHAR">UST</UpperSpineImprintingOption>
      <LowerSpineImprintingOption type="CHAR">LSP</LowerSpineImprintingOption>
      <EffectiveDate type="DATE">20040503</EffectiveDate>
      <CallsRemaining type="INTEGER">26</CallsRemaining>
      </Update_Persona_Variants>
      </CallProc>
    - <CallProc>
    - <Update_Persona_Variants action="EXECUTE">
      <table>mk_EditAllowedLowerSpineImprintingOptions_proc</table>
      <AlbumType type="CHAR">7SPEC</AlbumType>
      <UpperSpineImprintingOption type="CHAR">UST</UpperSpineImprintingOption>
      <LowerSpineImprintingOption type="CHAR">LSP</LowerSpineImprintingOption>
      <EffectiveDate type="DATE">20040503</EffectiveDate>
      <CallsRemaining type="INTEGER">25</CallsRemaining>
      </Update_Persona_Variants>
      </CallProc>
    ......CallProc blocks continue till CallRemaining reaches zero.
    I also tried making CallProc element appear just once in XML and repeating <Update_Persona_Variants> blocks like below
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:MT_UPDATEPERSONAVARIANTS xmlns:ns0="urn:sd:sales:sapvarianttablestopersona">
    - <CallProc>
    - <Update_Persona_Variants action="EXECUTE">
    </Update_Persona_Variants>
    <Update_Persona_Variants action="EXECUTE">
    </Update_Persona_Variants>
    </CallProc>
    </ns0:MT_UPDATEPERSONAVARIANTS >
    but still i get the same error.
    Can anyone guide me what is wrong.

    Well,
      The problem was with the way date was passed to the stored procedure, i just needed to format the date to yyyy-mm-dd and the error was solved. The error given by the JDBC adapter was not correct. I tried using logSQLStatement additional parameter, but for stored procedures it does not give out the actual SQL statement being fired. I was able to find the error in log files found on WAS server in transaction AL11.
       So i suggest to everyone having issues with JDBC adapter, please do not trust the error given in runtime workbench, always crosscheck in the logs in AL11 at the following location in your XI box
    DIR_INSTANCE\J2EE\CLUSTER\SERVER0\log. Here find date and time when you triggered your scenario and search for your table name or stored proc name, the java dump will give you a good information.
      I am giving points to everyone anyways.
    Thanks
    Pulin

  • Different ways to return results using a stored proc to calling application

    Hi, Can someone please suggest me different ways of returning results( set of rows and columns) from a stored procedure to calling application.
    Currently I am using sys_refcursor to return results to front end. Stored proc is executed fast, but cursor access and retrieval of results has some overhead.
    So can you suggest the ways which will be faster than this approach.
    Thanks.

    Currently the procedure executes quickly but the results from the ref cursor are returned slowly, this is because the query is slow, for whatever reason.
    Collecting in all the rows in the stored procedure first before returning them will
    a) Make the stored procedure slower taking the same amount of time to execute as current query takes to complete.
    b) Use more memory.
    c) Put more stress on the network as all rows will be transferred at once instead of using the arraysize/fetchsize to to fetch the rows in smaller packets.

  • Call Developer 2000 Reports/Forms from PL/SQL stored proc.

    Hello all,
    I am searching for a method for a stored procedure on Oracle 8.0 to call a Oracle Developer 2000 Report or Form.
    Any suggestions,
    Thanks,
    Julian

    No offense,
    Do you mean calling a trigger in a Form or Report to fire off another of the same? Or do you mean how do I fire Forms from a Database stored procedure?
    Please I don't mean any offense, it is just hard, sometimes to say simple concepts and not sound, well, bad.
    Otherwise think about it. A Stored procedure is run inside the database, it has no idea where you client is, and doesn't know which type of client you have (X-Windows, Microsuck), and doesn't know how to fire off an app on the client.
    One concept that is hard, sometimes, to get is where things are run. Forms runs on an Apps Server (Java screens), or a client, like on a PC. Stored procedures run, usually, on a whole different box, a database server. The database server is not that well connected that it can fire off a app on a client. Try to go to a Unix database server and run a command to fire off Internet Explorer on your client!? Not real easy to do.

  • Multiple Stored Procs in Receiver JDBC with transaction handling

    Hi All,
    We have a requirement to call  two Stored procedured in Receiver JDBC -- such that if any one of those procedure fails it should rollback the transaction/ or in other words commit only when both are successful.
    Is this handled in Receiver JDBC adapter?
    Thanks,
    Himadri

    Hello KK,
    Combining is not an option available for us.
    Our requirement is there are two SPs. --  SP1 and SP2. SP1 is mapped from the header segment and called only once. SP2 is from Item segment and called multiple times based on number of items. If anyone of those calls fails the transaction should be rolled back.
    Is it possible in the standard JDBC call in PI?
    Thanks and Regards,
    Himadri Chakraborty

  • Report fails on CE usin stored proc as data source and Native Client driver

    Iu2019m using Crystal Reports 10. I have a report with a stored procedure as data source. All my other reports using views as data source. Weu2019re upgrading db from SQL Server 2000 to 2008 and start using Native Client driver.
    Thereu2019s no problem to generate this report from .rpt on my local PC. But got the following error message when generate from Crystal Enterprise:
    Error Message: The table could not be found. File D:\Program Files\Crystal Decisions\Enterprise 10\Data\procSched\......reportjobserver\~tmp12c06c5641c4d50.rpt.
    It looks like sth related to Native Client driver. It works if I change to use old native driver in DSN on CE server.
    Any ideas/advises? Appreciated to your help!

    Hello,
    CR 10 does not support the MS SQL Native Driver, if you want to use OLE DB then use the MS OLE DB Provider for SQL Server up to SQL 2005. SQL 2008 does not support the MDAC version so you have to install the SQL 2008 Client tools to use the SQL Native 10 driver. CR 10 does not support that Native 10 Driver.
    See this MS Kbase: http://msdn.microsoft.com/en-us/library/ms131035.aspx
    Convert back to the old driver for 2005 and then use ODBC if using SQL 2008, it should work...
    Don

  • Multiple stored procs execution parallelly using single DBMS_SCHEDULER

    Hi All,
    I have to run 10 tasks - a few simultaneously, and a few periodically using DBMS_SCHEDULER.
    But instead of creating 10 different Schedulers, is there a way in Oracle to create a single scheduler and invoke the tasks base on respective times?
    I have been going thru SCHEDULERS documentation but i am unable to make much progress.
    Thanks,
    Chaitanya

    Hi,
    You can run the multiple process under the same scheduler to set the appropriate priority.
    DBMS_SCHEDULER.create_job (
    job_name => 'test_priority_job',
    job_type => 'PLSQL_BLOCK',
    job_action => 'BEGIN DBMS_LOCK.sleep(10); END;',
    start_date => SYSTIMESTAMP,
    repeat_interval => 'freq=minutely;',
    end_date => SYSTIMESTAMP + 1/48,
    enabled => FALSE,
    comments => 'Job used to test priorities.');
    DBMS_SCHEDULER.set_attribute (
    name => 'test_priority_job',
    attribute => 'job_priority',
    value => 1);
    DBMS_SCHEDULER.set_attribute (
    name => 'test_priority_job1',
    attribute => 'job_priority',
    value => 1);
    Like the above code.
    ~Kushal

  • Handling result form Stored Proc in java program

    Folks, I have a question on how to handle results from Stored Procedures with the java.sql API. I execute a stored proc from a java program using the statement:
    statement.execute();
    where 'statement' is of type Statement. Then I get the results:
    ResultSet rs = query.getResultSet();
    The above returns me a ResultSet object. Now, my stored proc is such that it will return an integer in case of errors (as error code), and, if no error,it'll return the result set. Because I wouldn't know if the stored proc is returning an integer or a result set, how do I get the result of the stored proc in the java program? 'query.getResultSet()' would get me only an object of type ResultSet. What if the stored proc is returning an integer (i.e. when an error occurs)?
    Thanks.

    GSP wrote:
    Thanks to all for your replies. I do not have access to modify the stored procedure. I can just use it in my java program. The stored proc first validates its input parameters. If it finds them invalid, then it returns an appropriate error code (which is an integer) depending on which input param is found invalid. If all the input parameters are found valid, then it fetches the rows from the DB tables & returns them as result set. Now my question is: say if I give a statement as this in my java program:
    ResultSet rs = query.getResultSet();
    what if the stored proc returns an error code (Since the above statement gets only ResultSet object, how will it handle if the stored proc returns an int)? Is there any alternative?
    Ok, so there is a piece of missing data.
    Store procs, conceptuatlly can return data in a variety of ways.
    So the first step is to determine how the data is being returned.
    Unless you know that there is no way to determine how to use it in java.

  • Crystal Report using Stored Proc in JSP problem

    Hello,
    I am running a simple report using a stored proc(oracle). It runs fine when I run the report through Crystal. But when I tried running it using JSP it gives me this exception -
    com.crystaldecisions.report.web.viewer.CrystalRepo rtViewer
    Error formatting page : Unexpected Query Engine error
    Can some one pls advise why I am not able to run this report through JSP?
    My other reports with simple sql runs fine in my JSP.
    Here is my stored proc --
    PACKAGE BODY MY_TEST
    AS
    PROCEDURE getrecordset
    p_cursor OUT cursor_type
    IS
    BEGIN
    OPEN p_cursor FOR
    SELECT
    FROM
    DSR_CLASS_SET;
    END;
    END MY_TEST;

    Thanks for your comments.
    If I run the same query, report runs fine. So I guess it should also able to run this stored proc.
    Here is the detailed error ---
    Category:     com.crystaldecisions.reports.reportengineinterface
    Message:          failed to process getPage request
    Location:     
    Thrown:
    com.crystaldecisions.reports.reportengineinterface.EngineException: Error formatting page : Unexpected Query Engine error
         at com.crystaldecisions.reports.reportengineinterface.Engine.getPage(Unknown Source)
         at com.crystaldecisions.reports.reportengineinterface.JPEReportSource.getPage(Unknown Source)
         at com.crystaldecisions.report.web.viewer.ReportAgent.a(Unknown Source)
         at com.crystaldecisions.report.web.viewer.CrystalReportViewer.goto(Unknown Source)
         at com.crystaldecisions.report.web.ServerControl.a(Unknown Source)
         at com.crystaldecisions.report.web.ServerControl.processHttpRequest(Unknown Source)
         at jsp_servlet._crystal.__test._jspService(__test.java:225)
         at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:446)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6350)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    Caused by: com.crystaldecisions.reports.formatter.formatter.c: Unexpected Query Engine error
         at com.crystaldecisions.reports.formatter.formatter.objectformatter.bf.<init>(Unknown Source)
         at com.crystaldecisions.reports.formatter.formatter.objectformatter.bf.a(Unknown Source)
         at com.crystaldecisions.reports.formatter.formatter.d.j.<init>(Unknown Source)
         at com.crystaldecisions.reports.formatter.formatter.d.j.if(Unknown Source)
         ... 19 more
    Caused by: com.crystaldecisions.reports.dataengine.k: Unexpected Query Engine error
         at com.crystaldecisions.reports.dataengine.ap.case(Unknown Source)
         at com.crystaldecisions.reports.dataengine.ap.jO(Unknown Source)
         at com.crystaldecisions.reports.dataengine.ap.aC(Unknown Source)
         at com.crystaldecisions.reports.dataengine.ap.aD(Unknown Source)
         at com.crystaldecisions.reports.dataengine.ap.case(Unknown Source)
         at com.crystaldecisions.reports.dataengine.au.a(Unknown Source)
         at com.crystaldecisions.reports.dataengine.a0.a(Unknown Source)
         at com.crystaldecisions.reports.dataengine.a0.aa(Unknown Source)
         at com.crystaldecisions.reports.dataengine.a0.<init>(Unknown Source)
         at com.crystaldecisions.reports.dataengine.a0.<init>(Unknown Source)
         at com.crystaldecisions.reports.dataengine.a0.a(Unknown Source)
         ... 23 more
    Caused by: com.crystaldecisions.reports.reportdefinition.datainterface.d: Unexpected Query Engine error
         at com.crystaldecisions.reports.reportdefinition.datainterface.b.a(Unknown Source)
         ... 34 more
    Caused by: com.crystaldecisions.reports.queryengine.al: Unexpected Query Engine error
         at com.crystaldecisions.reports.queryengine.driver.l.if(Unknown Source)
         at com.crystaldecisions.reports.queryengine.ao.dZ(Unknown Source)
         at com.crystaldecisions.reports.queryengine.ao.f(Unknown Source)
         at com.crystaldecisions.reports.queryengine.ao.dK(Unknown Source)
         at com.crystaldecisions.reports.queryengine.b0.dB(Unknown Source)
         at com.crystaldecisions.reports.queryengine.bz.a6(Unknown Source)
         ... 35 more
    Any guess why I get this?

  • Error creating Crystal Report using Stored Proc Universe

    Hi,
    I have created a stored procedure Universe, using the new feature available in XI R3.
    This connects to an Oracle database, executing a PL/SQL procedure returning ref cursor.
    I have created a WebI report using this Universe, which works fine and functions as expected.
    So there are no problems with either my Oracle stored proc or the Universe.
    However, I would like to create a Crystal report (2008) using the same Universe.
    I can create the report ok - using the SP Universe.
    When I attempt to refresh the data I get an error:
    Failed to retrieve data from the database.
    Details: ORA-06550: line 1, column 7:
    PLS-00103: Encountered the symbol "." when expecting one of the following:
    begin case declare etc etc
    .................................My Procedure ...................
    CREATE OR REPLACE PROCEDURE BIADM.Bo_Test_Report_R
    (Deposit_Cursor IN OUT SYS_REFCURSOR)
    IS
    BEGIN
    OPEN Deposit_Cursor FOR
    SELECT DISTINCT foracid "A/C"
    , acct_name "A/C Name", acct_opn_date "OP/Date", schm_code "SchmCode"
    FROM gam@finrpt
    WHERE acct_cls_flg ='N'
    AND foracid ='2252020145001';
    --AND cust_id ='CB2020145'
    END Bo_Test_Report_R;
    Please Give me solution as early as possible.
    Masud Iqubal

    Moved to Universe Design forum.

  • Stored proc returns zero result

    Hello, please help me. I am quite new to oracle stored
    procedures. I have a proc that returns data to cfm but it keeps
    giving zero results. But if i don't use stored proc, the same query
    gives me something. please help. my stored proc and cfm goes
    something like below:
    ************************************ stored procedures
    CREATE OR REPLACE PACKAGE PACK_REFCURSOR_NHM_TRANSACTION AS
    TYPE TRANS_TableRows IS REF CURSOR;
    PROCEDURE REFCUR_NHM_TRANSACTION (
    IN_sTMPACC IN varchar2,
    IN_sITEM_TYPES IN varchar2,
    OUT_TRANS OUT TRANS_TableRows);
    END PACK_REFCURSOR_NHM_TRANSACTION ;
    CREATE OR REPLACE PACKAGE BODY PACK_REFCURSOR_NHM_TRANSACTION
    AS
    PROCEDURE REFCUR_NHM_TRANSACTION (
    IN_sTMPACC IN varchar2,
    IN_sITEM_TYPES varchar2,
    OUT_TRANS OUT TRANS_TableRows)
    IS
    BEGIN
    OPEN OUT_TRANS FOR
    SELECT T.TRANSACTION_ID, T.TRANSACTION_TYPE,
    T.TRANSACTION_DATE, T.TRANSACTION_TIME,
    T.ITEM_CODE, 0 OE_DETAIL_ID,
    T.QUANTITY, T.LIST_PRICE, T.DISCOUNT, T.SALE_PRICE,
    T.GST_AMOUNT, 'I' INSURER_TYPE
    FROM NHM_TRANSACTION T
    WHERE DISPENSED_FLG = 'Y'
    AND T.ACCOUNT_ID = IN_sTMPACC
    AND T.TRANSACTION_TYPE IN ('01','02', '09')
    AND NVL(T.STATUS,'F') != 'C'
    AND T.BILLED_FLG = 'N'
    AND T.ITEM_TYPE IN (IN_sITEM_TYPES)
    AND T.BILL_ITEM_FLG = 'Y'
    UNION ALL
    SELECT T.OE_TRANSACTION_ID TRANSACTION_ID, TRANSACTION_TYPE,
    T.TRANSACTION_DATE,
    T.TRANSACTION_TIME, NVL(T.ITEM_CODE,T.PACKAGE_CODE)
    ITEM_CODE, T.OE_DETAIL_ID,
    T.QUANTITY, T.LIST_PRICE, T.DISCOUNT, T.SALE_PRICE,
    T.GST_AMOUNT, 'S' INSURER_TYPE
    FROM NHC_OE_TRANSACTION T, NHC_MASTER_ITEM M, NHM_PACKAGE P
    WHERE T.ACCOUNT_ID = IN_sTMPACC
    AND T.ITEM_CODE = M.ITEM_CODE(+)
    AND T.PACKAGE_CODE = P.PACKAGE_CODE(+)
    AND (DECODE(T.ITEM_CODE,NULL,P.BILL_OPTION,M.BILL_OPTION) in
    ('P','O','F'))
    AND NVL(T.STATUS,'F') != 'C'
    AND T.BILLED_FLG = 'N'
    AND ((T.TRANSACTION_TYPE = '09' AND STATUS IN ('P','R'))
    OR T.TRANSACTION_TYPE IN ('01','02','11','12', '10'))
    AND T.BILL_ITEM_FLG = 'Y'
    AND T.ITEM_TYPE IN (IN_sITEM_TYPES) ;
    END REFCUR_NHM_TRANSACTION ;
    END PACK_REFCURSOR_NHM_TRANSACTION ;
    *************** the cfm code (note: i am using coldfusion
    MX************
    <cfstoredproc datasource="#application.datasource#"
    procedure="NSCOCT.PACK_REFCURSOR_NHM_TRANSACTION.REFCUR_NHM_TRANSACTION">
    <cfprocparam type="IN" cfsqltype="CF_SQL_VARCHAR"
    value="#TMPACC#" dbvarname="IN_sTMPACC">
    <cfprocparam type="IN" cfsqltype="CF_SQL_VARCHAR"
    value="#QRYLOCITEM.ITEM_TYPE#" dbvarname="IN_sITEM_TYPES">
    <cfprocresult name="getPrescItems">
    </cfstoredproc>
    ***** i dumped getPrescItems and returns no data. it's
    suppose to return something . Any help is much appreciated. Thank
    you. *********

    just an update. i found out that it has something to do with
    the condition "IN". the values there is supposed to be a list (e.g.
    a,b,c,d,e,f,g). What I suspect is that when in stored proc, it
    interprets in the query as "IN('a,b,c,d,e,f,g')" instead of
    "IN('a','b','c','d','e','f','g')" which is what I actually want.
    I have also tried the quotedvaluelist in cfm but still no
    result, so i suspect again, using quotedvaluelist, that it
    interprets in the proc as "IN(''a','b','c','d','e','f','g'')".
    Can anybody help me whit this so i can have the proc
    interpret my IN condition as "IN('a','b','c','d','e','f','g')"?
    Thanks.

  • Best place in VOimpl java code to call a stored proc to populate results

    Hello all,
    Using JDev 11g, ADF BC and Trinidad.
    I am building an application that is primarily used for searching large amounts of data. We already have stored procedures on the database that perform the searches and dump the results into a holding table (together with a "search id"). I have easilly built a prototype of this application: my view object is simply "select a, b, c from results where search_id = :bv" - I have a service method in the AM that runs the stored procedure, obtains the search ID, binds it to the :bv in the VO and executes the VO's query - it's all working really nicely. Range paging is effective, the VO itself performs well, and I am able to control how long the stored proc runs via setting a timeout value.
    Now, I'd like to generalize this. My thinking is this:
    1). I'll add a custom property to my VO that is the SQL statement needed to call the stored procedure.
    2). I'll add some bind variables to the VO to represent all the query parameters that can be passed to the stored proc. I'll also use custom properties to indicate these are "fake" bvs, and not in the SQL query itself.
    3). The VO's SQL will remain simply "select a, b, c from results where search_id = :bv"
    4). I will (have already tested) override bindParametersForCollection so that the "fake" bind variables aren't bound into the SQL.
    Now, the question: I want to override some method in the VO's java code to call the stored procedure. The stored proc needs to be called before the actual query for the VO is run, and also before the method getQueryHitCount is called (so that the count is correct). What is the method that would be the "best" place to do this? My current thinking is that I would put the call in an over-ridden executeQueryForCollection call. As far as my analysis has gone, it seems to be always called before getQueryHitCount, but I have no way of knowing if this is completely safe.
    Any thoughts from the BC experts out there?
    Best regards,
    John

    John,
    from your description I understand that you essentially program the VO yourself. So I suggest that you read chapter 35.9 of the 'Fusion Developer’s Guide for Oracle Application Development Framework' (I guess you know where to find it). Since you still call the actual SQL not all of the chapter apply, but you get the idea how it works.
    And yes you analyzed the behavior correct. executeQueryForCollection() is allways called bevore getQueryHitCount().
    Timo

Maybe you are looking for