Cursor to another stored procedure return package

Hello
I am new to Oracle, and I have the following problem:

I have a slider in a package that is defined like this:
create or replace
PACKAGE 'TestPACKAGE' AS
DOWNLOAD_CURSOR cursor's select A.* from A Table1, Table2 B
END TestPACKAGE;
In reality, there is more than one package with different cursors. I want to use this DOWNLOAD_CURSOR in a stored procedure, function, or another package, to return to the client in a ref cursor
Something like this:
create or replace
procedure aa_test (retCURSOR to sys_refcursor) is
Start
retCURSOR: = TestPACKAGE.DOWNLOAD_CURSOR;
end;
or replace this procedure with another method to return data and use in a .NET application.

961449 wrote:
There are so any solution to access TestPACKAGE. DOWNLOAD_CURSOR to .NET web application. I found how to access a stored procedure that returns a ref cursor
And the package cannot be change, add a stored procedure that returns a ref cursor

In this case, it is not possible. Your .NET code cannot directly access the static cursor declaration, because at this point it's just a statement, not an open cursor.
Cursors declared that are opened using the PL/SQL code, using the OPEN cursor_name statement or variable IN the syntax of other cases.
.NET and other external applications require a ref Cursor, so the only way you can get this query in a Ref cursor is to open the ref cursor in the query itself.

Tags: Database

Similar Questions

  • How to query the DDL lock functions or stored procedures and packages?

    Hello!

    The subject says it all: how to display existing DDL locks on the functions or stored procedures and packages?

    While running a procedure, it cannot be deleted or replaced, so there must be a DDL lock on it. The information does not seem to be in V$ LOCK or V$ LOCKED_OBJECTS.

    Thank you!
    Marcus

    Published by: David on November 21, 2009 15:43

    Hello

    You have the DBA_DDL_LOCKS view.

    Best regards
    Jean Valentine

  • Error when the stored procedure returns a cursor in c pro


    Hello

    I tried to make things work, explained to the
    [2537153 m]

    He runs a stored procedure from pro c which returns a cursor.
    But when I compllie to c pro I get following error. My name of the procedure's TEST.
    If I change the output to an int value parameter. It compiles okay.



    PLS-S-00306, wrong number or types of arguments in the call to 'TEST '.
    Error on line 34, column 5 in file E:\C\Test\tt.pc
    TEST(:test_cursor);
    +.... 1 +.
    PLS-S-00000, ignored statement
    A semantic error on line 33, column 1, folder E:\C\Test\tt.pc:
    BEGIN
    + 1 +
    PCC-S-02346, PL/SQL found semantic errors

    Can make a point about what could be the error?
    I work from oracle 8i client. that connects to oracle 9.0.1.
    Operating system is win 2000 sp4

    Oh yes - differs from the code snippet I posted your with the declaration of the host cursor variable. A difference in the case. Is how important it?

    ( it's been almost 10 years since I've coded last in Pro * C, so be careful with these questions! ) ;-) )

  • stored procedure returns zero results

    Hello, please help me. I'm quite new to oracle stored procedures. I have a proc that returns data to the MTC, but he keeps giving no results. But if I don't use a stored procedure, the same query gives me something. Help, please. my stored proc and cfm goes something like below:

    ************************************ stored procedures **************************************
    CREATE OR REPLACE PACKAGE IN THE PACK_REFCURSOR_NHM_TRANSACTION
    TYPE TRANS_TableRows IS REF CURSOR;
    PROCEDURE REFCUR_NHM_TRANSACTION)
    IN_sTMPACC IN varchar2,
    IN_sITEM_TYPES IN varchar2,
    OUT_TRANS to 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 ON TRANS_TableRows)
    IS


    BEGIN

    OPEN FOR OUT_TRANS
    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
    OF NHM_TRANSACTION T
    WHERE DISPENSED_FLG = 'Y '.
    AND T.ACCOUNT_ID = IN_sTMPACC
    AND T.TRANSACTION_TYPE ('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 TRANSACTION_ID, TRANSACTION_TYPE, T.TRANSACTION_DATE, T.OE_TRANSACTION_ID
    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, THE OF ' INSURER_TYPE
    OF 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) ('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;


    cfm code (Note: I use coldfusion MX *)

    < datasource = "" #application.datasource # cfstoredproc "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">
    < name cfprocresult = "getPrescItems" >
    < / cfstoredproc >

    I getPrescItems of dumping and not return any data. It's supposed to return something. Any help is very appreciated. Thank you. *********

    I've already found the solution and it worked. I guess that's the Oracle. In any case, just in case you might need it some time, here is the link: ask Tom

  • relative to the parameter in a stored procedure returns

    I'm doing a sp sp / sql with select and update, the idea is to return the value assigned in the select, but when I test the procedure about adding the parameter to the method PPerformance does not, in fact I am new to oracle, I searched some tutorials but I have not managed to solve the problem


    my source its:
    create or replace
    PROCEDURE PA_CONSECUTIVO (TipoConsecutivo in  VARCHAR2, AUXI OUT int )
    
    AS
    aux2 int;
    BEGIN
    
     SELECT consecutivo + 1 into aux2 FROM  tbl_consecutivo
        WHERE UPPER(ltrim(rtrim(Tipo_Consecutivo))) = UPPER(ltrim(rtrim(TipoConsecutivo)));
        
        UPDATE tbl_Consecutivo SET consecutivo = aux2 
    WHERE upper(ltrim(rtrim(Tipo_Consecutivo))) = upper(ltrim(rtrim(TipoConsecutivo))) ;
    
     AUXI:=aux2;
        
    
    
    END PA_CONSECUTIVO;
    the table og the request her:
    TIPO_CONSECUTIVO     VARCHAR2(20 BYTE)
    CONSECUTIVO     NUMBER(38,0)
    FECHAULTIMO     DATE
    I appreciate the help.

    Published by: 1008490 on 29-may-2013 07:49

    Your stored procedure has 2 settings while you provide 1. Use something like:

    SET SERVEROUTPUT ON
    DECLARE
        V_AUXI NUMBER;
    BEGIN
        PA_CONSECUTIVO('ENTRADA',V_AUXI);
        DBMS_OUTPUT.PUT_LINE('AUXI = ' || V_AUXI);
    END;
    /
    

    SY.

  • How to create the cursor in a stored procedure

    How to create the slider in the stored procedure. I want a simple example
    procedure - cursor - open-fetch - insert - last slider farm
    any idea or examples... Please help friends

    Thanks in advance

    Hello

    Search for explicit cursors in this link

    http://download.Oracle.com/docs/CD/B28359_01/AppDev.111/b28370/static.htm#insertedID2

    Kind regards
    Prazy

  • call a packed stored procedure from within another stored procedure

    I have a stored procedure (STROKEQC) on a scheme that is not in a package. I want to be able to call a procedure stored that IS inside a package on the same scheme of STROKEQC. When I try the syntax below, I get an error "no function with name 'PARTICIPANTSPECIFICEDITS' exists in this area." That the procedure exists.
    /*Generate admin field data*/
        execute immediate QCPROCEDURES.PARTICIPANTSPECIFICEDITS('ALL');        
        execute immediate QCPROCEDURES.GENERATE_SURGYEAR_ERRFLAG;
    Is not the way to do inside a stored procedure?

    Thank you!
    Eva

    Hi, Eva,.

    You need not EXECUTE IMMEDIATE to call a stored procedure (including a procedure in a package) on the other. Just use the name and the arguments (if any):

    QCPROCEDURES.PARTICIPANTSPECIFICEDITS('ALL');
    QCPROCEDURES.GENERATE_SURGYEAR_ERRFLAG;
    

    I guess qcprocedures is the package name, and participantspecificedits and generate_surgyear_errflag are procedures in this package.

    In case you're wondering, the error was probably because you do not have a variable called participantspecificedits. If you had a dynamic code in a string called variable x, then "EXECUTE IMMEDIATE x"; would be the way to run it.

  • Double games of results returned on stored procedure call

    Hello

    I have a stored procedure created Java and called using the Spring JDBC using StoredProcedure class, stored procedure returns duplicate rows, is this a known problem?

    When I run the stored procedure even in DBVizualiser it not show correctly.

    The class below is used to execute the stored procedure:

    public class CustomerSearchProcedureRunner extends StoredProcedure {
     public CustomerSearchProcedureRunner(JdbcTemplate jdbcTemplate) {
      super();
      this.setJdbcTemplate(jdbcTemplate);
      this.declareParameter(new SqlReturnResultSet(RETURN_RESULTS, new CustomerRowMapper()));
      this.declareParameter(new SqlParameter(CUST_SP_IN_PARAM, Types.VARCHAR));
      this.setSql("{CALL INSURANCE.SEARCHCUSTOMER (?) ON ALL}");
      this.setSqlReadyForUse(true);
      this.compile();
     }
    }
    


    and Java Stored Procedure that runs SQLFire is given below:

    public class CustomerSearchProcedure {
     
     private static final String DOLLAR = "\\$";
     private static final String COLON = ":";
     private static final String CUST_NAME = "CUST_NAME";
     private static final String CUST_NO = "CUST_NO";
     private static final String GENDER = "GENDER";
     
     
     public static void searchCustomer (String customers, ResultSet[] outResults,
       ProcedureExecutionContext context) throws SQLException {
      StringBuilder sql = new StringBuilder();
      StringBuilder whereCondt = new StringBuilder();
      String[] tokens = new String[]{};
      
      if (customers != null && customers.trim().length() > 0) {
       tokens = customers.split(DOLLAR);
      }
      
      sql.append("<global>SELECT * FROM INSURANCE.CUSTOMERS ");
      whereCondt.append("WHERE CUST_PRIMARY IN ('Y', 'N') ");
      // Apply dynamic where condt
      for (int i=0; i < tokens.length; i++ ) {
       String token = tokens[i];
       if (token.startsWith(CUST_NO)) {
        if (whereCondt.length() > 0) {
         whereCondt.append(" AND ");
        }
        whereCondt.append("CUST_NO = " + token.substring(token.indexOf(COLON)+1));
       }
       if (token.startsWith(CUST_NAME))  {
        if (whereCondt.length() > 0) {
         whereCondt.append(" AND ");
        }
        whereCondt.append("CUST_NAME LIKE '"+ token.substring(token.indexOf(COLON)+1).trim() + "%'");
       }
       if (token.startsWith(GENDER)) {
        if (whereCondt.length() > 0) {
         whereCondt.append(" AND ");
        }
        whereCondt.append("GENDER ='"+ token.substring(token.indexOf(COLON)+1).trim() + "'");
       }
      } //End of for
      
      if (whereCondt.length() > 0) {
       sql.append(whereCondt.toString());
      }
      
      Connection cxn = context.getConnection();
      Statement stmt = cxn.createStatement();
      ResultSet rs = stmt.executeQuery(sql.toString());
      outResults[0] = rs;
     } //END OF METHOD
    }
    

    A correction preceding: "for the case on the information in the TABLE of the DataSet to be targeted on each node is also sent for the tag requests will target only this dataset (and avoids duplicates).»

    should read "in the case of on TABLE query Tags will only target the local primary data on the node for tables partitioned, while for replicated tables, it is sent to only one of the lines (and so avoids duplicates in both cases).» WHERE clause to TABLE is not used for cutting data only for the size of the set of nodes to the target.

    The tag prunes yet the query to all of the local primary buckets in all cases (i.e. which WE ALL and on GROUPS of SERVERS) so the comment about and equivalent was incorrect. However, this will always be looking for data in duplicate for replicated tables and TABLE is the only way to avoid it for now.

  • How to return a value from stored procedure.

    Hello

    I have an insert in which insert a username through generated sequence number.

    I need this generated sequence number stored procedure return.

    Kindly help me to achieve this goal.

    It might be useful if there is a code sample for the same thing.

    Thank you
    Ahmed Shareefuddin

    Something like this:

    create or replace procedure xproc (num out number) is
    begin
     insert into mytab values (myseq.nextval);
     select myseq.currval into num from dual;
    end;
    /
    

    Max
    http://oracleitalia.WordPress.com

  • ORA-06508, procedure cannot call the procedure of package

    I have a large stored procedure that calls a package (procedure) that manages a number of procedures to determine whether the process can continue or not.  (It checks authorization of the student to enroll in a class).  We have a web process calling the stored procedure, and that works fine.  What does not work, is a call to the package.  Oracle returned ORA-06508: PL? SQL: could not find program unit called.

    I have included instructions for debugging, so I know that it is the specific call to a procedure in the package fails with ORA-06508.  Thinking it's perhaps something in the package, I inserted a debug statement as the first line in the procedure called in the package.    (Debugging instructions call a procedure inserts of rows in a table of debugging with independent validation).

    When I log in the user account with sqlplus and run a test, everything works fine.  But when the web process is running under the same user, the process fails to call the procedure of package and fails with ORA-06508.

    It seems as if the web process runs with the rights of the appellant, or a role is not granted.

    Can someone help me understand what the problem is?

    offered hv, I appreciate your comments.

    We solved the problem: remove the package that couldn't be cited, then re-create.   That's all!

    Apparently, something in the database was tangled upward.   The server recently had problems with disk space, then it might have been related to that.  But we'll never know for sure.

    The stored procedure and packaging (procedures) which he called were owned by the same schema, and there is no mechanism that I can find to prevent one of the other appellant.  But that was the case - Oracle threw the ORA-06508 exception when the stored procedure called the package procedure.

    I replaced the stored procedure and package several times fine-tuning debugging code, but this has not fixed the problem.

    Finally let it drop and then re-create the package, it's which solved the problem.

    Regarding requests to view the code, there is no way that I could reproduce the problem, since the error that occurred was against the permissions and rules which packages run and the procedures of the Oracle.  Thanks for all the tips and suggestions.

  • Question packets and stored procedures

    Been working with Oracle for a month now and I have a question about stored procedures/packages. I created 3 stored procedures and a search function to do some work as follows:
    1 load the initial set of data into a table.
    2. turn to day of the preceding table columns by using a specific search function.
    3. put to update a single column with a value based on grouped subsets of the data in the table.

    I divide the latter in separate proceedings to facilitate debugging and validation of each step, but now I want to put them all together and run them sequentially. In my view, there are two ways to do this:
    1. create another stored procedure that will run the three in the right order.
    2 create a package and move all procedures and functions and call each in the right order.

    Don't know which approach is preferable, although I'm leaning towards the first option, any actual experience would be appreciated. Thanks in advance!

    Dave

    How about option 3:

    3 create a package and move all procedures and functions, and then add an additional procedure in the package that calls each in the correct order and call this procedure.

    PS. only this last procedure must be in the package spec. All others must be put into the body (and can remain hidden for the code outside the package).

    Published by: Toon Koppelaars February 26, 2010 21:07

  • java.sql.SQLException: ORA-06550 and ORA-00900 call stored procedures

    Hi all

    I have 2 a stored procedures that I want to call from my Session bean. One of them takes a few settings, but not the other. When I call the procedures, I get the following errors described below. I tested the two stored procedures in sql plus and sqldveleoper and they work well. The funniest, it is, I have another stored procedure that I can call successfully from the same bean in session with no problems, so I'm a bit confused as to why his play now.

    I use stand-alone 10.1.3.4 OC4J and Oracle 10 g Db 10.2.0.4 and platform DB that I use is Oracle10gPlatform and Eclipselink as my JPA provider. I have also tried against toplink (not toplink essentials) and still no joy

    Here is the error I get when I try and call the procedure which takes the parameters of the session bean
    Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'HASHDATA'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    
    Error Code: 6550
    Call: BEGIN HashData(input=>?, hashedValue=>?, hashed=>?); END;
         bind => [password1, => hashedValue, => hashed]
    Query: DataReadQuery()
    Here are my stored procedure that take parameters
    create or replace procedure hashData(input IN VARCHAR2, hashedValue OUT BLOB, hashed OUT BOOLEAN)  as  
    
    inputRaw RAW(2000);
    --hashed BOOLEAN := false;
    begin 
    
    dbms_output.put_line('the data to be hashed is '||input);
    
    dbms_output.put_line('converting input to raw ...');
    inputRaw := utl_i18n.string_to_raw(input,'AL32UTF8');
    
    dbms_output.put_line('Hashing Data ...');
    hashedValue := DBMS_CRYPTO.Hash (src=>inputRaw,typ=>DBMS_CRYPTO.HASH_SH1);
    
    dbms_output.put_line('hash is '||UTL_I18N.raw_to_char(dbms_lob.substr(hashedValue, 4000,1)));
    
    if (hashedValue  is not null) then 
     
    
     hashed :=true;
      dbms_output.put_line('hashedValue IS NOT  null');
     else
     hashed := false;
      dbms_output.put_line('hashedValue IS null');
     end if;
    
    end;
    Here is my code in the session bean to call the procedure that takes as parameters (Hashdata)

    public UserBean() {
              // TODO Auto-generated constructor stub
    
              sessMan = SessionManager.getManager();
              session = sessMan.getSession("Session", Thread.currentThread()
                        .getContextClassLoader());
    
         }
    
    public Serializable hashData(String input){
    
              logger.debug("Hashing Data ... "); 
              hashedValue= null; 
              boolean hashed=false; 
         
              StoredProcedureCall call = new StoredProcedureCall();
    
              ValueReadQuery query = new ValueReadQuery();
              call.setProcedureName("HashData");
              call.addNamedArgumentValue("input", input);
              call.addNamedOutputArgument("hashedValue", "hashedValue", java.sql.Blob.class);
              call.addNamedOutputArgument("hashed", "hashed", java.lang.Integer.class);
                        
              query.addArgument("input");
              
              query.setCall(call);
              
              session.executeQuery(query);
               
              if ((Boolean)hashed){
                   logger.debug("The data has been hashed and the hash value is: "+hashedValue);
              }
              
              else{
                   logger.debug("The data has could not be hashed");
                   hashedValue=null;
              }
              
              return (Serializable)hashedValue;
              }
    When I call the other takes no parameters, I get the following error.
    Internal Exception: java.sql.SQLException: ORA-00900: invalid SQL statement
    
    Error Code: 900
    Call: BEGIN testJPAProc(); END;
    Query: DataReadQuery()
    Here is the procedure which takes no parameters
    create or replace procedure testJPAProc is 
     
     begin
     dbms_output.put_line('testJPAProc called');
     end;
    Heres is the code to call procedures that take no parameters
                                    StoredProcedureCall call = new StoredProcedureCall();
      
              ValueReadQuery query = new ValueReadQuery();
              
              call.setProcedureName("testJPAProc");
              query.setCall(call);
              
              session.executeQuery(query);
    You guys can tell me where I'm wrong if I do something wrong. Why make these mistakes? because as far as I can tell the code (java and pl/sql) are both correct unless there is something I missed. It's kinda funny because I have another stored procedure I can call successfully.


    Thank you

    The first question is that the Boolean in Oracle is not a supported JDBC type, but a PLSQL type.
    Change to an INTEGER is probably the best, you can also use the PLSQLStoredProcedureCall class to access.

    The second problem is perhaps that the stored procedure is not valid, make sure that it compiled correctly. It can also be the type of your query, you must use a DataModifyQuery, not a read request that it returns nothing.
    If still no luck, try to call directly through JDBC, it works?

    ---
    James: http://www.eclipselink.org: http://en.wikibooks.org/wiki/Java_Persistence

  • Find the stored procedure performance

    Hello

    which of these two options is faster? (cpu/memory load is not a problem)

    -A selection on a view using a statement WHERE
    -A stored procedure returns a REF_CURSOR

    Queries:
    1.) SELECT * FROM View_AllUsers WHERE userId = 1;
    (2.) SP_GetUser (1);


    Scenario:

    Users table)
    UserID INT,
    username VARCHAR
    )

    View_AllUsers 'userId', 'user name '.
    SELECT username, username OF THE USERS;

    SP_GetUser (@UserID)
    SELECT username, username OF USERS WHERE userId = @userId;

    Top hand, retrieving a result using SQL directly is going to be faster wrapping it in a stored procedure because you add another layer to it.

    Here is an example to prove:

    SQL > CREATE TABLE test AS SELECT MOD(OBJECT_ID,17) AS USERID, OBJECT_NAME AS USER_NAME FROM ALL_OBJECTS;
    
    Table created.
    
    SQL > CREATE VIEW test_vw AS SELECT * FROM test;
    
    View created.
    
    SQL > CREATE OR REPLACE PROCEDURE test_sp(ID IN test.userid%TYPE, cur OUT SYS_REFCURSOR)
      2  AS
      3  BEGIN
      4     OPEN cur FOR SELECT * FROM test WHERE USERID = ID;
      5  END;
      6  /
    
    Procedure created.
    
    SQL > set timing on
    SQL > set autotrace traceonly
    SQL > var ID NUMBER;
    SQL > var ref REFCURSOR;
    SQL > exec :ID := 15;
    
    SQL > SELECT * FROM test_vw WHERE USERID = :ID; -- Just to "warm" up the cache
    
    847 rows selected.
    
    Elapsed: 00:00:00.23
    
    SQL > exec test_sp(:ID,:ref);
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.03
    SQL > print ref -- Again "warming" up the cache
    
    847 rows selected.
    
    Elapsed: 00:00:00.32
    SQL > SELECT * FROM test_vw WHERE USERID = :ID;
    
    847 rows selected.
    
    Elapsed: 00:00:00.17
    SQL > exec test_sp(:ID,:ref);
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.03
    SQL > print ref
    
    847 rows selected.
    
    Elapsed: 00:00:00.21
    SQL > SELECT (.21-.17)/.17*100 AS PERCENT_DIFF FROM DUAL;
    
    PERCENT_DIFF
    ------------
      23.5294118
    

    As you can see, the view was much faster because there is no overhead associated with MS and PL/SQL context switching.

  • disconnected rowset select CachedRowSet of a statement within the stored procedure?

    Hello everyone

    I'm using CachedRowSet returned from a parameterized select statement and it works very well.

    If I put the same select statement in a simple read only then stored procedure I get this exception: "a result set has been generated for the update.

    I'm not trying to update all lines in my code.

    I tried to make the CachedRowSet to be read-only, but this does not help, same error.

    Question 1: a stored procedure returns a single result set can be called to fill a CachedRowSet read-only? (in a similar way to a method of CallableStatement prepareCall with input/output settings).

    Question 2: in general is something to be encouraged for future development or are they deprecated or replaced with something else or better using CachedRowSet, FilteredRowSet (disconnected) and WebRowSet, JDBCRowSet (connected)?

    Thank you very much in advance

    It work? (be sure that your stored procedure done * nothing * before running this query)

    PreparedStatement p = conn.prepareStatement ("{call dbo.p_testCachedJDBCRowSet (?)}" ");

    p.setInt (1, 10);

    CRS CachedRowSetImpl = new CachedRowSetImpl();

    CRS. Populate (p.ExecuteQuery ());

  • Recordset Paging with a stored procedure in MSSQL

    Hi all
    I have a problem with the paging recordset using a recordset of a procedure stored in MSSQL 2000.

    The page works fine without the Recordset pagination feature. That is, it returns a recordset and displays the information on the screen as expected. However, as soon as I add this feature in, the page of the database server indicating that a parameter has not been supplied to the stored procedure returns an error. I suspect that this could be to do with the refresh in the service.

    Has anyone encountered this problem before and all the ideas how to get around?

    Any help appreciated.

    Thanks in advance.

    Ben.

    Thanks for all your help. This works a treat!

    I didn't know it was possible to run a stored procedure from the behavior of the recordset object. I was under the impression that the stored procedures must be accessible by the behavior of 'command '. A new day to dawn!

    Thank you!

Maybe you are looking for