Stored proc. returning TABLE ??

Hi,
If a ORACLE stored procedure is returning a "TABLE" type, how to get it in JDBC ?
Can someone please put some code snippet ?
thanks,
-raj

Hi,
You can try this :
Connection conn = ...
CallableStatement callStmt = conn.prepareCall("call yourProcedure(param1, param2, ...)");
callStmt.execute();
ResultSet rs = callStmt.getResultSet();
callStmt.close();
conn.close();Aurelien

Similar Messages

  • Advice Please: Adding Few Static Values to Stored Proc Returned Result Set

    Hello -
    The Stored Proc below returns about 1000 rows of result set when a date is passed to the query. In addition to that, there are about 5 rows of data (which is in my excel file) needs to be added to the result set. What is the best possible way?
    What I have done is I created a new table which has that 5 static rows. It has just the addresses and amount and customer number. There is no invoice date in that table. I tried UNION and the query did not like the fact that I had something like that in
    the first table:
    SELECT
    '0' as 'TYPE'
    ,'TBCCA' as 'Acc ID'
    ,'12882' as 'BEID'
    , '' as ' # OF UNITS'
    , Circuit_Total as 'AMT'
    ,'D' as 'D or C'
    , '' as ' FDOC yyyymmdd'
    , '' as ' LDOC yyyymmdd'
    , Address as 'Brief Comment'
    , city as 'Tax City'
    , State as 'Tax State'
    , Zip_Code as 'Tax Zip Code'
    , INV_DATE as 'Invoice Date'
    FROM [dbo].[TBC_MonthlyCircuitDetail]
    WHERE INV_DATE = '2014-07-01'
    AND [Circuit_Total] >0
    UNION
    SELECT 0
    '0' as 'TYPE' --DID NOT LIKE THIS <<
    ,'TBCCA' as 'Acc ID'
    ,'12882' as 'BEID'
    , '' as ' # OF UNITS'
    , Circuit_Total as 'AMT'
    ,'D' as 'D or C'
    , '' as ' FDOC yyyymmdd'
    , '' as ' LDOC yyyymmdd'
    , Address as 'Brief Comment'
    , city as 'Tax City'
    , State as 'Tax State'
    , Zip_Code as 'Tax Zip Code'
    , '' INV_DATE as 'Invoice Date'
    FROM [dbo].[TBC_MonthlyCircuitDetailStaticValues]
    WHERE INV_DATE = '2014-07-01'
    AND [Circuit_Total] >0
    Stored Proc below:
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE [dbo].[SP_TBC_ORBIT Process Form]
    -- Add the parameters for the stored procedure here
    @INVOICE_DATE varchar(20)
    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
    '0' as 'TYPE'
    ,'TBCCA' as 'Acc ID'
    ,'12882' as 'BEID'
    , '' as ' # OF UNITS'
    , Circuit_Total as 'AMT'
    ,'D' as 'D or C'
    , '' as ' FDOC yyyymmdd'
    , '' as ' LDOC yyyymmdd'
    , Address as 'Brief Comment'
    , city as 'Tax City'
    , State as 'Tax State'
    , Zip_Code as 'Tax Zip Code'
    , INV_DATE as 'Invoice Date'
    FROM [dbo].[TBC_MonthlyCircuitDetail]
    WHERE INV_DATE IN (@INVOICE_DATE)
    AND [Circuit_Total] >0
    END
    GO
    So, what do you suggest? As you can tell, I am quite a novice but I am learning by researching, asking questions and doing it. Thanks in advance!
    Sanjeev Jha

    Your second Select statement is as below:
    SELECT 0
      '0' as 'TYPE'
    --DID NOT LIKE THIS <<
    ,'TBCCA' as
    'Acc ID'
    ,'12882' as
    'BEID'
    , '' as
    ' # OF UNITS'
    , Circuit_Total as
    'AMT'
    ,'D' as 'D or C'
    , '' as
    ' FDOC yyyymmdd'
    , '' as
    ' LDOC yyyymmdd'
    , Address as
    'Brief Comment'
    , city as 'Tax City'
    , State as
    'Tax State'
    , Zip_Code as
    'Tax Zip Code'
    , ''INV_DATE
    as 'Invoice Date'  -- CHANGE HERE
    FROM [dbo].[TBC_MonthlyCircuitDetailStaticValues]
    WHERE INV_DATE = '2014-07-01'
    AND [Circuit_Total] >0
    You are receiving Invoice date from INV_DATE column from table or you want to set it as blank?
    Change it to either - ( '' as
    'Invoice Date' ) or  (INV_DATE as
    'Invoice Date'  )
    -Vaibhav Chaudhari

  • 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.

  • How to hide stored proc and tables schema

    hi,(sqlserver 2005 and sqlserer 2008 r2 express)
                I have to give my database to some body he has his own server, i do not want him to see my stored porcs code and/or name , and tables schema.
               I have used encryption to that,
    but i think , there is some code available on internet , which can be used to get the code from stored procs,
    please tel me how i can i accomplish the task.
    yours sincerely

    However, this works perfectly if the user is the owner of the database. Look
    that …
    • Create a new SQL login "login1"
    • Create a user named “login1” in master database
    • Grant CREATE DATABASE to login1
    • While impersonating login1, create a database called “dbteste”
    • Revoke CREATE DATABASE permission from login1
    • Revoke VIEW ANY DATABASE permission from PUBLIC
    • Register this server as login1
    • From the “login1” session, expand database tree. Now, you should see
    master, tempdb, dbteste
    • Grant VIEW ANY DATABASE to PUBLIC
    • From the “login1” session, you should see all the databases
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Java stored proc: returning array?

    Hi,
    I have had to implement a Java stored procedure that accepts a nested table as an argument from aPL/SQL package. The class must manipulate the data and then create an object or an array that can be returned to the package for subsequent interpretation and use.
    I'd assuemd that I could reverse the process when the argument was accepted; i.e. assemble the data as an oracle.sql.ARRAY type and return that. The Javadoc I have advises that the constructors for this class are for 'internal' use only. Also, it requires a connection and I don'treally want to have to open another connection to the schema.
    Another alternative was to return an array of BigDecimal but this would require an equivalent VARRAY on the PL/SQL side. As I don't know the side of the array until run-time I cannot safely declare a VARRAY of an arbitrary size.
    As you acn probalby tell, I'm a bit of a novice so any help would be greatly appreciated.
    Thanks

    Thanks for the reply Avi.
    That's fine: it's a valid question! I started to explain the original problem but it became too long. Basically I needed the ability to define an array that could be dynamically sized depending on the rowcount resulting from a BULK COLLECT during runtime. As admitted, I'm a novice and believed this couldn't be done in PL/SQL, and, to cut a very long-winded story short after seeking more experienced advice, used the dynamic allocation techniques in Java which is more familiar terriory to me.
    I nearly have the Java solution working, thanks to Oracle documentation and a couple of hints towards the end of this thread. I'd also been perusing those links you recommended.
    I have since realised I can simulate a dynamic array with a nested table and using EXTEND. If thre are other techniques available, I'd be grateful or some pointers! All in all the whole process has been beneficial if a little time consuming.
    Thanks again
    The original problem is as follows: I have a nested table, each row of which contains one column for each month of the year recording payments. Some of these months can contain 0 and therefore, a 5,000 foot view shows that result set is fragmented. Basically the payments have to be rearranged as though they were contiguous monthly payments prior to subsequent processing. Because of the way the rows needed to be grouped for processing, the algorithms for defragmentation were becoming really complex. Admitting my PL/SQL limitations I slunk off to ask further advice and

  • Java Stored Proc Return Types

    Hi,
    I am new to writting java stored procedures. I have some custom network functionality that I have previously implemented in java and I want to make this functionality available to the database.
    In particular my java gets a list of files. What is the best way to return this list of files to PL/SQL. It is a basic list of just the file name, that within PL/SQL i want to itterate through and perform actions based on the names.
    At the moment in Java the method returns a simple array of strings.
    Please advise.
    Thanks
    Ben

    Ben,
    In my opinion, returning an array of strings (as you say you are already doing) is the best way. Are you having trouble with this? If I remember correctly, you will need to convert your java array into a data structure that can be passed to a PL/SQL routine (as a parameter). Is this where you are having difficulty? I recall some sample code on Oracle's OTN Web site that demonstrates how to do this. Have you seen it?
    http://www.oracle.com/technology/tech/java/sqlj_jdbc/index.html
    Good Luck,
    Avi.

  • Retriving data through stored procedure returning Table of object type

    I am trying to retrieve the data returned as a table(secret_tab_type) of object type(secret_type). Now we can get the secret_tab_type table through
    rset = (ResultSet) cstmt.getObject(1); but how to map the SQL object type to Java object type ??
    FUNCTION Fetchthat(
    secretinfo      out      SECRET_TAB_TYPE,
    message     OUT varchar2
    ) return number;
    These are the declaration of secret_type object and secret_tab_type(table returned by fetchthat procedure)
    create or replace type secret_type as object
    (secret_id number(3),
    secret_question varchar2(100),
    valid_flag char);
    create or replace type secret_tab_type as table of secret_type;

    Amit,
    Your question has been previously asked (and answered) on this forum. I suggest searching this forum's archives for the terms STRUCT and ARRAY.
    For your benefit, here are the results of my search:
    http://tinyurl.com/auvl8
    Good Luck,
    Avi.

  • Calling Stored Proc returning count of records(int value) using hibernate

    Hi ,
    I am a newbie in hibernate. i have a store proc that returns the count of amtchin records, i want to call the store proc using hibernat.Can anyone help me out in this.
    Thanks ,
    Dilip

    http://asktom.oracle.com/pls/ask/f?p=4950:8:6003223320663969737::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:246014735810,

  • 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.

  • Item Type Based on PL/SQL stored proc causing errors

    I am getting the following error when I add this item type based on a pl/sql stored proc that generates html based on the stored proc... the stored proc returns find but the other porlets get Error Message in there headers and in the porlet content I get:
    Error: The listener returned the following Message: 503 Service Unavailable....
    I also get the same error if I click on a link that is generated from my stored proc for the entire page I get the error:
    Error: The listener returned the following Message: 503 Service Unavailable
    and get nothing else returned...

    Greetings
    I suggest you take a look at the following page and have a look on how to create portlets. Since the PL/SQL PDK allows you to create your own portlets inside the Oracle Database there should be no problem for creating the content inside a portlet the way you want it.
    http://www.oracle.com/technology/products/ias/portal/pdk.html
    Best regards
    Johan

  • Best approach to return Large data ( 4K) from Stored Proc

    We have a stored proc (Oracle 8i) that:
    1) receives some parameters.
    2)performs computations which create a large block of data
    3) return this data to caller.
    compatible with both ASP (using MSDAORA.Oracle), and ColdFusion (using Oracle ODBC driver). This procedure is critical in terms of performance.
    I have written this procedure as having an OUT param which is a REF CURSOR to a record containing a LONG. In order to make this work, at the end of the procedure I have to store the working buffer (an internal LONG variable) into a temp table, and then open the cursor as a SELECT from the temp table.
    I have tried to open the cursor as a SELECT of the working buffer (from dual) but I get the error "ORA-01460: unimplemented or unreasonable conversion requested"
    I suspect this is taking too much time; any tips about the best approach here? is there a resource with REAL examples on returning large data?
    If I switch to CLOB, will it speed the process, be compatible with callers, etc ? all references to CLOB I saw use trivial examples.
    Thanks for any help,
    Yoram Ayalon

    We have a stored proc (Oracle 8i) that:
    1) receives some parameters.
    2)performs computations which create a large block of data
    3) return this data to caller.
    compatible with both ASP (using MSDAORA.Oracle), and ColdFusion (using Oracle ODBC driver). This procedure is critical in terms of performance.
    I have written this procedure as having an OUT param which is a REF CURSOR to a record containing a LONG. In order to make this work, at the end of the procedure I have to store the working buffer (an internal LONG variable) into a temp table, and then open the cursor as a SELECT from the temp table.
    I have tried to open the cursor as a SELECT of the working buffer (from dual) but I get the error "ORA-01460: unimplemented or unreasonable conversion requested"
    I suspect this is taking too much time; any tips about the best approach here? is there a resource with REAL examples on returning large data?
    If I switch to CLOB, will it speed the process, be compatible with callers, etc ? all references to CLOB I saw use trivial examples.
    Thanks for any help,
    Yoram Ayalon

  • Calling stored proc from java to return ref cursor

    Hi All,
    We have a requirement to display all the records from a table on a JAVA screen. Due to some constraints, we have to write the query in the stored proc. We are trying to return a result set from the stored proc to the java code by using a ref cursor. Please refer to the code below.
    Following is the PL/SQL proc ?
    procedure sp_user_course2(v1 OUT ref_cursor, persid in varchar2) as
    begin
    open v1 for
    SELECT lrn_exp_id, crs_name FROM emp_crs
    WHERE personid = persid;
    end;
    Here ref_cursor is of TYPE REF CURSOR declared in the package specification.
    The java code is ?
    Callable stmt = conn.prepareCall("call sp_user_course2(?,?)");
    stmt.registerOutParameter(1,OracleTypes.CURSOR);
    stmt.setString(2,emplId);
    stmt.execute();
    OracleCallableStatement tstmt = (OracleCallableStatement) stmt;
    ResultSet rs = tstmt.getCursor (1);
    When I run the program, I get the following error (at stmt.execute()):
    [Oracle][ODBC][Ora]ORA-06553: PLS-306: wrong number or types of arguments in call to 'SP_USER_COURSE2' 6553
    Can anyone tell me what could be the problem with this code? I have read somewhere that REF CURSOR feature is available from Oracle 9i onwards. If so, then, is there any workaround for mapping REF CURSOR to Resultsets in Oracle 8i?

    These may help
    http://www.google.co.uk/search?q=jdbc+OracleTypes.CURSOR+tutorial

  • No table names appear (only Stored Procs) when connected to SQLServer w/dbo

    Greetings,
    I'm using Crystal Reports 11, connecting to a databse on SQL Server 2005.
    I am on Windows 7. I also have the problem on Windows Server 2003
    Starting from a blank database, I create my connection through ODBC, and when I expand my database, all I get is a list of stored procedures, no tables.
    I have isolated this to whether I have dbo authority on this particular database or not.
    i.e. I have a user with dbo authority, and they see nothing but stored procedure names, I take dbo authority away, and they see tables, views, stored procs, all as would be expected.
    I have several other SQL Server databases that do not share this issue. Users with dbo authority can see tables as expected.
    I have compared the settings on the databases, and nothing appears to be different (the database with the issue is considerably larger, but I can't see where that would be an issue)
    I will probably also open this issue with Microsoft, to see what they say from their end
    If anyone has seen this before, or would have any suggestions they would be greatly appreciated. Seems very strange that giving MORE authority would be affecting what the user can see.

    Don
    Below are the results from the SQLCON program you suggested. It is returning Table info... (truncated most of it, as I assume it's not all that pertinent)
    SQLConnect Successful
    [Microsoft][ODBC SQL Server Driver][SQL Server]Changed database context to 'eas'.
    [Microsoft][ODBC SQL Server Driver][SQL Server]Changed language setting to us_english.
    ODBC Version is : 03
    SQL Driver Name is : SQLSRV32
    SQL Driver Version is : 06.01.7600
    SQL Driver Supported ODBC Version is : 03
    SQL DBMS Name is : Microsoft SQL Server
    SQL DBMS Version is : 09.00.4035
    SQLTables Successful
    [Row, Database, Owner, Name, Type]
    1  eas,  dbo,  ABC_ACCOUNT,  TABLE,
    2  eas,  dbo,  ABC_BUSINESS_UNIT,  TABLE,
    3  eas,  dbo,  ABC_COMPANY,  TABLE,
    Here is the listing from the TS server (also seeing the issue):
    SQLConnect Successful
    [Microsoft][ODBC SQL Server Driver][SQL Server]Changed database context to 'eas'.
    [Microsoft][ODBC SQL Server Driver][SQL Server]Changed language setting to us_english.
    ODBC Version is : 03
    SQL Driver Name is : SQLSRV32
    SQL Driver Version is : 03.86.3959
    SQL Driver Supported ODBC Version is : 03
    SQL DBMS Name is : Microsoft SQL Server
    SQL DBMS Version is : 09.00.4035
    SQLTables Successful
    [Row, Database, Owner, Name, Type]
    1  eas,  dbo,  ABC_ACCOUNT,  TABLE,
    2  eas,  dbo,  ABC_BUSINESS_UNIT,  TABLE,
    3  eas,  dbo,  ABC_COMPANY,  TABLE,
    I apologize for not answering your previous question, I think the SQL Driver Name will answer that? If not, let me know and I'll get you the information you're looking for. Thank you again for your time on this.

  • BPC5.1 - Data manager package to Stored proc with custom return codes

    Hi all,
    Does anyone have experience passing the return codes from a stored procedure back into the eData "view status" package progress or event log details?
    When my stored procedure throws errors, the offending SQL code shows up in the pacakge details, which is helpful. But what I'd really like is to structure my stored proc with return codes
    0 = everything's wonderful
    1 = invalid category / time combination
    2 = unauthorized
    3 = no data to process
    And then handle these codes as either "completed" "warning" or "error" in the package progress.
    And ideally, I'd like to put some meaningful message about the warnings & errors, directly into the log details, so the user can fix the problem themselves rather than ask the IT guy to trouble-shoot.
    Any tips? I've started playing with using the on-complete, on-success, on-failure routing of different tasks within the DTSX package (SQL 2005), but I'm just working on a trial-and-error basis right now. (With # of errors = # of trials.)
    Thanks,
    Tim

    In case anyone's interested, I've solved this by tracking my return codes as a package variable.
    Within the package, I have conditional logic moving from task to task, evaluating the return code to check for various conditions, and selecting which tasks to perform accordingly.
    In the last task, I run a final stored procedure which posts some data (completion time & status) to a custom transaction log table, and then if the return code is not zero, I script and execute some SQL which I know will throw a "fake" error. The SQL statement itself includes the key information I want the end user to see. For example
    Select InvalidEntitySelection [USEast1],TransactionID [12340]  from ThisTableDoesntExist
    Select UnauthorizedUser [Tim], TransactionID [12345] from ThisTableDoesntExist
    Select WorkStatusIsLocked [USEast1 Actual 2008], TransactionID [12345] from ThisTableDoesntExist
    It's not exactly elegant, but it gets the message across, which is all that I need. In this way, the end user sees that the package failed with an error, and when they look at the package details, they can see the problem. They can pass on the transaction ID to an administrator to look into the details, if they can't figure it out on their own.
    Sorin, I never managed to figure out how to use a VB task to send the information back to the user, plus force the package to end in an error. I'm sure there's a way to do so, but this seems to work for my requirement.
    I'm not entirely happy with the "fake error" approach, but I don't know if BPC has any support for "intentional" programming of errors in the DTS scripting toolset.
    Thanks,
    Tim

  • Error when executing statement for table/stored proc

    Hi All,
          I am getting this error when executing IDOC to JDBC (Stored Procedure) Scenario.
         In my stored procedure I have three insert statements to insert rows in to 3 tables.
        This stored procedure is working fine for two insert statements i.e, 
             For this I have created data type for stored procedure with 10 elements and executed the scenario and was successfully running.
        when I added 3rd insert statement to stored procedure ie., when i added 5 more elements to the datatype (totally 15 elements) it starts giving the bellow error in Message Monitoring.
    <i><b>Exception caught by adapter framework: Error processing request in sax parser: Error when executing statement for table/stored proc. 'COGRP_TMP_PROC_1' (structure 'Statements'): java.sql.SQLException: General error</b></i>
    <i><b>Delivery of the message to the application using connection JDBC_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'COGRP_TMP_PROC_1' (structure 'Statements'): java.sql.SQLException: General error</b></i>
       Note:- I have run the stored procedure  with three insert statements in Sql Server, and also by calling an external program also, and was working fine.
    <i><b> Note : Is there any structure needs to be follow when working with IDOC to Stored procedure.</b></i>
    I am struck up with the error, can any body resolve this issue.
    Thanks in Advance,
    Murthy

    Hi narasimha,
                      This seems to be any error due to incorrect query formation.In your receiver jdbc channel set the parameter logSQLstatement = true.you can find this parameter in the advanced mode. Using this parameter you will be able to see the sql query which is generated at runtime in the audit log in RWB.
    Regards,
    Pragati

Maybe you are looking for