Stored procedure - ref cursor - no rows

Hello,
I am stumped. Hopefully another pair of eyes will see what mine cannot. I am calling a stored procedure that accepts a single output parameter [the proc has been dumbed down to limit variables of my problem] that is a ref cursor. When I make the call I get now data. I have used both adapter and datareaders. If I call the proc from another proc I can loop through the results. I am including the code of my c# function and the stored proc.
The version number of my Oracle.DataAccess.dll is 10.1.0.303.
** Stored Proc ***********************
TYPE refcursor is ref cursor ;
procedure P_CUSTOMER_INFO_GET_SLIM( thecur out refcursor )
is
begin
open thecur for
select *
from customer_info
where rownum < 21;
end P_CUSTOMER_INFO_GET_SLIM;
** C# Func ***************************
          private DataSet _FetchCustomerData2(string CustNbr, string ShipToSuffix)
               string                         sc = "PKG_CUSTOMER_CONTACT.P_CUSTOMER_INFO_GET_SLIM";
               OracleConnection     con = new OracleConnection(_Database.GetConnection().ConnectionString);
               OracleCommand               cmd = new OracleCommand(sc, con);
               OracleDataAdapter da = new OracleDataAdapter(cmd);
               DataSet ds = new DataSet();
               // must pass strings with data
               if (CustNbr.Length==0 || ShipToSuffix.Length==0)
                    return null;
               try
                    // we are calling a stored proc so set it
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("thecur", OracleDbType.RefCursor, DBNull.Value, ParameterDirection.Output);
                    da.Fill(ds, "Customer"); // no data ?????????????????
                    // Close and Dispose OracleConnection object
                    con.Close();
                    con.Dispose();
                    return ds;

Hey all,
I ended up declaring a variable in the proc as refcursor and opening it. Then I assigned the out parameter ref cursor to the variable. That took care of it. See below.
Thanks,
Mike
procedure P_CUSTOMER_INFO_GET(
CustomerNumber in varchar2
,ShipToSuffix in varchar2
,thecur out refcursor
is
-- variable declarations
mycur refcursor;
begin
open mycur for
select CORP_CODE
,CUST_NUMBER
,CUST_SHIP_TO_SFFX
,CUST_BILL_TO_SUFF
,CUST_AR_OFF_CODE
,CUST_NAME
,CUST_SHIP_BILL_IND
,CUST_SHIP_VIA_CODE
,CUST_CLASS_CODE
,CUST_TYPE_CODE
,CUST_PRICE_CODE
,DISC_MKUP_CODE
,TRADE_DISC_CODE
,CUST_N_D_ACCT_NO
,CUST_PRY_PRICE_AGR
,CUST_ADDR_1
,CUST_ADDR_2
,CUST_ADDR_3
,CUST_CITY
,CUST_STATE
,CUST_ZIP
,CUST_COUNTRY_CODE
,CUST_FAX_NO
,CUST_FAX_NO_EXP
,CUST_PHONE_NO
,CUST_PHONE_NO_EXP
,CUST_CRDT_LIM_CODE
,CUST_CREDIT_STATUS
,CUST_CRED_CARD_NO
,CUST_CC_EXP_DATE
,CUST_DUNNING_FLAG
,CUST_ID
,CUST_SP_FILE_IND
,CUST_ST_TAX_CODE
,LAST_MAINT_DATE
from customer_info
where CUST_NUMBER = CustomerNumber
and CUST_SHIP_TO_SFFX = ShipToSuffix;
-- send the cursor back
thecur := mycur;

Similar Messages

  • Is BC4J a viabl option for database with stored procedure (ref cursor) API?

    I'm about to begin a Web application development project. As foundation, we have a (Oracle) database of certain complexity that have a data access API developed with PL/SQL packages.
    This API is designed to get data through stored procedures/functions that return REF CURSOR.
    Personally I have been investigating about Oracle ADF/JSF, and a number of others J2EE technologies, and at this moment I am doubting if ADF BC are a viable option to my development team.
    I think this because I have noticed that one of the great drawback in ADF BC is the lack of simplicity to get data through stored procedures/functions that returns REF CURSORS.
    I have been looking for documentation and the only thing that I have found are two examples:
    1.- One that really do not work (fails in get data from ref cursor): ADF BC StoredProcedure Sample application.
    2.- And other published by Steve Muench in
    http://radio.weblogs.com/0118231/stories/2003/03/03/gettingAViewObjectsResultRowsFromARefCursor.html. This sample works fine.
    But, the problem with the approach of this last article is the amount (and complexity) of the code necessary to make so basic and recurrent operation as is "obtain data through a stored procedure (ref cursor)".
    Below it is the code that I have constructed to call a function that returns a ref cursor (based on steve's article).
    If this is the only way to make this (historically so basic and simple) task, then it is obvious that BC is not a viable technology to my (or I am in a mistake?), since we have about 50 stored procedures/functions to access the underlying data; that stored procedures/functions are key to development of the new application (and, still more, currently are used to anothers apps ).
    By all this, I would like consult to Oracle's people:
    1.- I really must reject BC as technology to implement this project ?
    2.- It is possible to access stored procedures in a simpler way using BC?
    3.- If the answer to 2 is NOT: in near future, the BC team has plans to give more support to the simple access to stored procedures?
    4.- If the answer to 3 is NOT: what another technology you recommend to construct my data access/business tier and still be able to using the others characteristics of ADF?
    Thank you very much for your guidelines.
    Regards, RL.
    ** And the code!!!
    ** ###   I am forced to do this for each call to a procedure???? ###
    package myrefcursor.model;
    import java.math.BigDecimal;
    import java.sql.CallableStatement;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    import java.sql.SQLException;
    import java.sql.Types;
    import oracle.jbo.JboException;
    import oracle.jbo.domain.NullValue;
    import oracle.jbo.domain.Number;
    import oracle.jbo.server.DBTransaction;
    import oracle.jbo.server.ViewObjectImpl;
    import oracle.jbo.server.ViewRowImpl;
    import oracle.jbo.server.ViewRowSetImpl;
    import oracle.jdbc.driver.OracleCallableStatement;
    import oracle.jdbc.driver.OracleTypes;
    public class TraePolizasViewImpl extends ViewObjectImpl {
        private static final String SQL = "begin ? := PKG_PRUEBA.trae_polizas(?);end;";
        private static final String COUNTSQL = "begin ? := PKG_PRUEBA.count_trae_polizas(?);end;";
        public TraePolizasViewImpl() {
        protected void executeQueryForCollection(Object qc,Object[] params,int numUserParams) {
            BigDecimal rut_contratante = null;
            Object[] theUserParam = null;
            System.out.println(params);
            System.out.println(params[0]);
            if (params != null)
                theUserParam = (Object[]) params[0];
            //if (theUserParam != null && theUserParam.length > 0 )
            if (! (theUserParam[1]   instanceof NullValue) )
                rut_contratante = (BigDecimal)theUserParam[1];
            storeNewResultSet(qc ,retrieveRefCursor(qc, rut_contratante));
            super.executeQueryForCollection(qc, params, numUserParams);
        protected void create() {
          getViewDef().setQuery(null);
          getViewDef().setSelectClause(null);
          setQuery(null);
        protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet rs) {
          rs = getResultSet(qc);
          ViewRowImpl r = createNewRowForCollection(qc);
          try {
            populateAttributeForRow(r,0, nullOrNewNumber(rs.getBigDecimal(1)));
            populateAttributeForRow(r,1, rs.getString(2));
          catch (SQLException s) {
           throw new JboException(s);
          return r;
        protected boolean hasNextForCollection(Object qc) {
          ResultSet rs = getResultSet(qc);
          boolean nextOne = false;
          try {
            nextOne = rs.next();
            if (!nextOne) {
              setFetchCompleteForCollection(qc, true);
              rs.close();
          catch (SQLException s) {
           throw new JboException(s);
          return nextOne;
        protected void releaseUserDataForCollection(Object qc, Object rs) {
           ResultSet userDataRS = getResultSet(qc);
           if (userDataRS != null) {
            try {    userDataRS.close();    }
            catch (SQLException s) { ; }  
          super.releaseUserDataForCollection(qc, rs);
        public long getQueryHitCount(ViewRowSetImpl viewRowSet) {
          return viewRowSet.getRowCount();
        private ResultSet retrieveRefCursor(Object qc, BigDecimal rut_contratante) {
          CallableStatement st = null;
          try {
            st = getDBTransaction().createCallableStatement(SQL, DBTransaction.DEFAULT);
            st.registerOutParameter(1,OracleTypes.CURSOR);
            if (rut_contratante == null)
                st.setNull(2, Types.NUMERIC);
            else
                st.setBigDecimal(2, rut_contratante);
            st.execute();
            ResultSet rs = ((OracleCallableStatement)st).getCursor(1);
            rs.setFetchSize(getFetchSize());
            return rs ;
          catch (SQLException s) {
            throw new JboException(s);
          finally {try {st.close();} catch (SQLException s) {;}}
        private void storeNewResultSet(Object qc, ResultSet rs) {
          ResultSet existingRs = getResultSet(qc);
          if (existingRs != null) {
            try {existingRs.close();} catch (SQLException s) {;}  
          setUserDataForCollection(qc,rs);
          hasNextForCollection(qc); // Prime the pump with the first row.
        private ResultSet getResultSet(Object qc) {
            return (ResultSet)getUserDataForCollection(qc);
        private static Number nullOrNewNumber(BigDecimal b) {
             try {
               return b != null ? new Number(b) : null;
             catch (SQLException s) { ; }
             return null;
        public BigDecimal getprutcontratante() {
            return (BigDecimal)getNamedWhereClauseParam("prutcontratante");
        public void setprutcontratante(BigDecimal value) {
            setNamedWhereClauseParam("prutcontratante", value);
    }

    no?

  • STORED PROCEDURE/REF CURSOR: How to output entire buffer

    I wrote a Stored Procedure wherein I use a Cursor to extract multiple
    rows and columns. I then write them into the buffer
    (dmbs_output.put_line). But when I try to capture the entire result
    into an OUT variable, I only get the last buffered line.
    So how do I output the entire buffer- all rows and columns? In other words (maybe), how do I use dbms_output.get_lines() to assign value to an OUT variable?
    Alternatively, using REF CURSOR as OUT variable, I added the following to "CREATE OR REPLACE PROCEDURE ... ()":
    cursor_out_test OUT cursor_test
    But when I tried:
    DEFINE CURSOR TYPE cursor_test IS REF CURSOR RETURN table%ROWTYPE;
    ...or...
    DECLARE TYPE cursor_test IS REF CURSOR RETURN table%ROWTYPE;
    I still got syntax errors.
    In one line, what I am trying to do is break the result array at the database level rather than at the application level.
    Cheers, Bill
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/sqloperations.htm#LNPLS00605

    I did the following:
    OPEN CURSOR x
         LOOP
              FETCH CURSOR x INTO col1, col2
              (EXIT WHEN...)
              variable_line := col1 || col2
         END LOOP
    CLOSE CURSOR
    But after closing this cursor, variable_line contains only the last buffered line. I want all the looped lines (without using associative arrays, nested tables etc). So I guess I am just looking for some way to append data lines- adding chr(10) doesn't work either.
    Cheers, Bill

  • Forms Data-Block based on stored procedures - REF CURSOR feature NOT FUNCTIONING

    This topic is related to another topic in this forum titled "FORMS HOW TO SET QUERY SOURCE ARGUMENTS??" I posted my message there as well. I am posting as a NEW TOPIC so that it catches the attention of Oracle Support.
    I built a data form based on a stored procedure and REF CURSOR IN OUT parameter.
    My procedure takes a IN parameter to fill in the criteria for the OPEN <cursor_variable> select ... where ... statement.
    In the Value setting of the Query source Arguments , I set the VALUE to ":BLOCK_NAME.ITEM_NAME" at design time to supply the input value to the procedure. this works to the extent of making available the form item value to the stored procedure parameter. I verified this by doing an insert into some debug table , of the incoming parameter value inside my stored procedure.
    The cursor gets opened properly into the REF cursor variable. I verified this by fetching a record into a local variable and inserting the value into a debug table again in the stored procedure.
    (I took care to close and re-open the REF cursor variable again - so that the front-end can continue to fetch it from the first record. )
    ***** PROBLEM **************
    But the front end forms runtime is giving me a FRM-40301 - query returned no records even though the REF cursor is returned properly opened.
    Did anybody else face the same problem ??
    Please post what you found.
    Thanks,
    Shankaran
    null

    This topic is discussed at length in another thread "How Set Value For Query DataSource Arguments?"
    But I am posting the findings here as well.
    THIS TOPIC IS CLOSED.
    My Bad. The problem Cause : I did not include all columns in the
    cursor rowtype in the Data-block. In the wizard for the data block , I selected ONLY the columns that I needed. But I was doing a Select * from <my_table> in my open cursor <Cursor-Variable> .... The <Cursor Variable>
    itself was declared <my_table>%rowtype
    FIX : The Data Block structure (columns included as items) should match the cursor record Structure. One may or may not
    display all the columns in the LAYOUT though.
    But I don't understand why it gives such a misleading message like FRM-40301 Query retrieved no records. Oracle Team fix it.
    Hope this helps people who face the same problem.
    Thanks,

  • Oracle OLE DB Provider / Stored Procedure REF CURSOR errror

    Post Author: robfurrball
    CA Forum: Data Connectivity and SQL
    All,I'm out of ideas on this and would appreciate any suggestions.I'm trying to use Crystal XI to connect to an Oracle 9i database using the Oracle OLE DB Provider (required to use this provider by a 3rd party program that fires off the report).If I connect using the Microsoft OLE DB Provider for Oracle,  the report will return data.  When connecting with the Oracle OLE DB Provider, I get the following:Database Connector Error: 'ADO Error Code: 0x80040e14
    Source: OraOLEDB
    Description: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'SP_MOMGLOBCSHBAL_TEST'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Native Error: 6550 &#91;Database Vendor Code: 6550 &#93;' -
    The procedure's only parameter is an IN OUT SYS_REFCURSOR, and the Oracle OLE DB Provider is version 9.2.0.7.0 Thanks,Rob

    Post Author: robfurrball
    CA Forum: Data Connectivity and SQL
    Summary: After going
    back and forth with Business Objects support they ruled that it was an issue
    with the provider itself, recommended I contact Oracle for resolution, and
    closed the case before I could comment back to them.  I was unable to send this response to their
    support team, so I'm posting it here in hopes that I can save others time/money
    in the future.
    My Response -
      I appreciate your input and would have liked to comment further on the case management system before you closed the case.  I'm a little surprised and disappointed that you recommend I contact Oracle directly about this issue.I would imagine that a company as large as Business Objects would have much better results dealing with Oracle to resolve an issue compared to an individual.Also, since you are able to connect to other objects (such as a table) in Crystal Reports using that provider, I would expect that you would want customers to be able to connect to stored procedures using it as well.  Otherwise, it would seem appropriate to either alert customers of this defect through documentation, public message boards, and forums.Using Crystal to pull data from stored procedures in other databases and data providers made me think that was a viable option for this project.  Since it was not documented as a limitation of Crystal and the provider, it has cost my organization a great deal of time and money trying to troubleshoot an issue I would have expected to be caught in Crystal Reports' internal quality assurance testing.------ This is the final note I received on my support case: -
    Please note that the statement used to execute a procedure within ODBC/OLE DB is different from the native 'Oracle Server' statement.In ODBC or OLE DB, the call is '{CALL "SCHEMANAME"."TEST_PROCEDURE"(3)}' , when using native 'Oracle Server' the call is 'BEGIN "SCHEMANAME"."TEST_PROCEDURE"(:TEST_CURSOR, 1); END ;'In ODBC or OLE DB, the cursor is still used however it is not listed within the SQL Statement as in the Native connection. This is the behavior from Crystal Reports 9 forward that the cursor is not shown through ODBC/OLE DB.In addition to that as the issue is only with the Oracle OLE DB provider and I would suggest you to contact Oracle about this issue, since the issue occurs outside of Crystal Reports when using QTADO with a standard call, so it is not an issue between Crystal Reports and Oracle.The issue is only with Oracle OLE DB provider as the same Oracle stored procedure call works within QTADO with the MS Oracle OLE DB provider.As the issue is with the OLE DB Provider and not with Crystal Reports, we may not be able to proceed further. Hence, I am closing this case from Case Management System.

  • Getting data stored in ref cursor ( got from store proc in oracle) to excel sheet)

    Hey, I am trying to Get data stored in ref cursor ( got from store proc in oracle) to excel sheet in a virtual folder using ssis. 
    I am getting errors and cant do it. If anyone can help me

    Hi Nabin000,
    The Oracle stored procedure doesn't work with SSIS source adapters such as OLE DB Source because the data provider doesn't provide metadata for the source adapter. To achieve your goal, you can use a Script Component as source to call
    the Oracle stored procedure by using System.Data.OracleClient OracleDataReader, and get the rows and add them to the pipeline buffer. For more information, please see:
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/1d0b3a1b-8792-469c-b0d1-f2fbb9e9ff20/dump-oracle-ref-cursor-into-ms-sql-staging-table-using-ssis
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/fcdaa97e-8415-4c3e-8ffd-1ad45b590d57/executing-an-oracle-stored-procedure-from-ssis?forum=sqlintegrationservices 
    http://msdn.microsoft.com/en-us/library/system.data.oracleclient.oracledatareader(VS.90).aspx 
    Regards,
    Mike Yin
    TechNet Community Support

  • Stored procedure with cursor as output param

    It's the first time for me to test a stored procedure with a cursor as output parameter. I executed the following:
    SQL> VARIABLE user_cur REFCURSOR; VARIABLE ret_code VARCHAR2; exec TEST_API.SEARCH_USER( :ret_code, '', '', 'john', '', :user_cur); print ret_code;print user_cur;
    I got the following error:
    Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
    VARCHAR2 (n CHAR) | NCHAR | NCHAR (n) |
    NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR ] ]
    May I know what's the problem?
    The purpose of the stored procedure is to search for user with the name "john".
    The stored procudure input/output params declaration is as follows:
    PROCEDURE SEARCH_USER
    RETURN_CODE OUT VARCHAR2,
    USER_ID_IN IN VARCHAR2,
    POSITION_IN IN VARCHAR2,
    USERNAME_IN IN VARCHAR2,
    STATUS_IN IN VARCHAR2,
    USER_CUR_OUT OUT REFCURSOR
    Edited by: user7383310 on Oct 19, 2008 9:05 PM
    Edited by: user7383310 on Oct 19, 2008 9:05 PM

    for the usage of refcursors in pl/sql refer here..
    http://download.oracle.com/docs/cd/B14117_01/appdev.101/b10807/06_ora.htm#sthref808
    You can code like..
    SQL> create or replace procedure p1(id number,csr out sys_refcursor) is
      2  begin
      3   open csr for select ename from emp where deptno = id;
      4  end;
      5  /
    Procedure created.
    SQL> var csr1 refcursor
    SQL> var n number
    SQL> exec :n := 30;
    PL/SQL procedure successfully completed.
    SQL> exec p1(:n,:csr1);
    PL/SQL procedure successfully completed.
    SQL> print csr1
    ENAME
    ALLEN
    WARD
    MARTIN
    BLAKE
    TURNER
    JAMES
    6 rows selected.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Stored Procedure returning just one row

    Hi! I've a problem with a MSSQL Stored Procedure. This procedure works perfectlly if I execute it directly on MSSQL Query Analyzer. But the problem is in Java, when I call it, the resultset has just one row, and it must have 59, so I don't know what is going on. My procedure is a bit big, but please, help me :)
    This is the procedure code
    CREATE PROCEDURE desc_doctos
    @pt_gaveta varchar(250),
    @pl_idexp varchar(250),
    @pl_idcar numeric,
    @identa int
    AS
    DECLARE @id_carpeta_hija int
    DECLARE @nombre_hija varchar(500)
    DECLARE @fh_creacion datetime
    DECLARE @numero_carpetas int
    DECLARE @numero_documentos int
    DECLARE @cv_aplicacion_des varchar(100)
    DECLARE @id_gabinete_des int
    DECLARE @identa_modificado varchar(10)
    DECLARE @liga varchar(250)
    DECLARE @hora varchar(50)
    DECLARE @fecha varchar(50)
    DECLARE imx_descendencia CURSOR LOCAL FOR
    SELECT IOC.ID_CARPETA_HIJA, IOC.NOMBRE_HIJA,IC.FH_CREACION,
    convert(varchar(2),datepart(dd,IC.FH_CREACION))+'/'+convert(varchar(2),datepart(mm,IC.FH_CREACION))+'/'+convert(varchar(4),datepart(yyyy,IC.FH_CREACION)),
    convert(varchar(2),datepart(hh,IC.FH_CREACION))+':'+convert(varchar(2),datepart(mi,IC.FH_CREACION))+':'+convert(varchar(2),datepart(ss,IC.FH_CREACION)),
    IC.NUMERO_CARPETAS,IC.NUMERO_DOCUMENTOS,
    ICP.CV_APLICACION_DES,ICP.ID_GABINETE_DES
    FROM IMX_ORG_CARPETA IOC, IMX_CARPETA IC, IMX_CARPETAPUENTE ICP
    WHERE
    IOC.TITULO_APLICACION=@pt_gaveta
    AND IOC.ID_GABINETE= @pl_idexp
    AND IOC.TITULO_APLICACION = IC.TITULO_APLICACION
    AND IOC.ID_GABINETE = IC.ID_GABINETE
    AND IOC.ID_CARPETA_HIJA = IC.ID_CARPETA
    AND IOC.TITULO_APLICACION *= ICP.TITULO_APLICACION                
    AND IOC.ID_GABINETE *= ICP.ID_GABINETE
    AND IOC.ID_CARPETA_HIJA *= ICP.ID_CARPETA
    AND ID_CARPETA_PADRE= @pl_idcar;
    OPEN imx_descendencia
         FETCH NEXT FROM imx_descendencia INTO @id_carpeta_hija,@nombre_hija,@fh_creacion,@fecha,@hora,
              @numero_carpetas,@numero_documentos,@cv_aplicacion_des,@id_gabinete_des
         WHILE @@FETCH_STATUS = 0
         BEGIN
              SELECT @identa_modificado = @identa+1          
              IF (@id_gabinete_des IS NOT NULL)
              BEGIN
                   SET @liga = '../jsp/imxvisor.jsp?gaveta='+@cv_aplicacion_des+'&idExp='+convert(varchar(10),@id_gabinete_des)+'&cierre=si'     
                   BEGIN TRAN
                        --INSERT INTO IMX_ARBOL_TEMPORAL VALUES(@nombre_hija,@liga,@identa,0,'_blank','1',1,1)          
                        SELECT @nombre_hija,@liga,@identa,0,'_blank'
                        EXEC lista_doctos @pt_gaveta,@pl_idexp,@id_carpeta_hija,@identa_modificado
                   COMMIT TRAN
              END
              ELSE
              BEGIN
                   SET @liga = '../jsp/datosarbol.jsp?opcion=0&idcarpeta='+convert(varchar(10),@id_carpeta_hija)+'&carpetas='+convert(varchar(10),@numero_carpetas)
                   SET @liga = @liga + '&documentos='+convert(varchar(10),@numero_documentos)+'&hora='+@hora
                   SET @liga = @liga + '&fecha='+@fecha+'&idExp='+@pl_idexp+'&gaveta='+@pt_gaveta
                   BEGIN TRAN
                        --INSERT INTO IMX_ARBOL_TEMPORAL VALUES(@nombre_hija,@liga,@identa,0,'DATOS','1',1,1)
                        SELECT @nombre_hija,@liga,@identa,0,'DATOS'
                        EXEC lista_doctos @pt_gaveta,@pl_idexp,@id_carpeta_hija,@identa_modificado
                   COMMIT TRAN
              END
              EXEC desc_doctos @pt_gaveta,@pl_idexp,@id_carpeta_hija,@identa_modificado
              FETCH NEXT FROM imx_descendencia INTO @id_carpeta_hija,@nombre_hija,@fh_creacion,@fecha,@hora,
                   @numero_carpetas,@numero_documentos,@cv_aplicacion_des,@id_gabinete_des
         END
    CLOSE imx_descendencia
    DEALLOCATE imx_descendencia
    and this is my java code
    import java.sql.*;
    public class pruebasSQL{
         public static void main(String[] args){
              try{
                   Class.forName("com.inet.tds.TdsDriver").newInstance();     
                   Connection connection;
                   connection = DriverManager.getConnection("jdbc:inetdae7:localhost","user","pass");
                   connection.setCatalog( "DataBase");
                   CallableStatement statement = connection.prepareCall("{call desc_doctos ('NVA_EST',1002,0,1)}");
                   ResultSet rs = statement.executeQuery();
                   rs.last();
                   System.out.println(rs.getRow());
                   rs.close();
                   connection.close();
              catch(Exception e){
                   System.out.println(e);
    Hope u can help me =)
    Raul Medina
    [email protected]

    Hi! I managed to resolve this problem. This is what I did, hope somebody finds it usefull
    //connection, declarations, etc...
    PreparedStatement ps = connection.prepareStatement("exec desc_doctos 'NVA_EST',1002,0,1");
                   ResultSet rs = ps.executeQuery();
                   rs.next();
                   System.out.println(rs.getString(1));
                   while(ps.getMoreResults()){
                        rs = ps.getResultSet();
                        rs.next();
    +" "+rs.getString(2)+" "+rs.getString(3)+" "+rs.getString(4)+" "+rs.getString(5));
                        System.out.println(rs.getString(1));
    ------------

  • Stored procedure: nested cursor problem

    Hey folks,
    i am really having a hard time trying to figure out how nested cursors work.
    What i want to do:
    -> Do one select statement and process the yielded rows with one cursor
    -> Do another select statement depending on the first cursor
    The code is quite simple, the beginning of the stored procedure is:
    create or replace
    PROCEDURE extractEntireMD IS
    CURSOR curTemplateUnitId IS
    SELECT
    tu.externalident,
    tu.templateunitid
    FROM
    templateunit tu
    WHERE
    tu.templateunitid = 100007;
    CURSOR curPartTypeId(templateUnitID IN varchar2) IS
    SELECT
    tpt.parttypeid
    FROM
    templateparttype tpt
    WHERE
    tpt.templateunitid = templateUnitID;
    From what i have read, this seems to be right.
    No i want to use this code like this:
    BEGIN
    FOR valInCurTemplateUnitId IN curTemplateUnitId LOOP
    DBMS_OUTPUT.PUT_LINE('ExtIdent: ' || valInCurTemplateUnitId.externalident);
    DBMS_OUTPUT.PUT_LINE('templateunitid: ' || valInCurTemplateUnitId.templateunitid);
    FOR valIncurPartTypeId IN curPartTypeId(valInCurTemplateUnitId.templateunitid) LOOP
    DBMS_OUTPUT.PUT_LINE('PartTypeId: ' || valIncurPartTypeId.parttypeid);
    END LOOP;
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    DBMS_OUTPUT.PUT_LINE('No such data ');
    END;
    The problem:
    I seem to be doing something wrong, because Oracle does not heed the argument which i give to the second cursor from the first cursor:
    CURSOR curPartTypeId(templateUnitID IN varchar2) IS
    which i call via:
    FOR valIncurPartTypeId IN curPartTypeId(valInCurTemplateUnitId.templateunitid)
    Instead, oracle prints out __all__ templateunitids.
    If I modify the second cursor with a constant argument like this:
    CURSOR curPartTypeId(templateUnitID IN varchar2) IS
    SELECT DISTINCT
    tpt.parttypeid
    FROM
    templateparttype tpt
    WHERE
    tpt.templateunitid = 100007;
    The result is correct. So it seems like oracle simply disregards the parameter i am giving him for the second cursor.
    What am i doing wrong?

    > i am really having a hard time trying to figure out how nested cursors work.
    Good. I trust that this will result in the realisation that it is an idiotic thing to emulate the features of the SQL engine in PL/SQL. Only a fool thinks the he/she can outprogram and outsmart the SQL engine, and do things like nested loop joins better and faster in PL/SQL.
    Use SQL for the purpose it was designed. Use PL/SQL for the purpose it was designed.
    Joining of data? That is prime function and feature of SQL. Not PL/SQL.

  • JCA Error while calling Stored Procedure containing cursors in BPEL/OSB

    Hi,
    I created JCA DBAdapter in Jdeveloper for calling remote stored procedure which contains cursors as OUT parameters.
    I'm getting below exception when i try to call the database via BPEL/OSB.the same remote procedure call is working on Invoking with WLI .
    Kindly sugggest !!!
    The invocation resulted in an error: I*nvoke JCA outbound service failed with connection error, exception: com.bea.wli.sb.transports.jca.JCATransportException: oracle.tip.adapter.sa.api.JCABindingException: oracle.tip.adapter.sa.impl.fw.ext.org.collaxa.thirdparty.apache.wsif.WSIFException: servicebus:/WSDL/ServiceBus/BusinessServices/IsdnSiebelConn [ IsdnSiebelConn_ptt::IsdnSiebelConn(InputParameters,OutputParameters) ] - WSIF JCA Execute of operation 'IsdnSiebelConn' failed due to: Get object error.*
    Error retrieving the value of a parameter R_NON_CNF_ATTR_CURSOR.
    An error occurred when retrieving the value of parameter R_NON_CNF_ATTR_CURSOR after invoking the SIEBEL.ISDN_OBT_INS_DET.OBTAINASSETDETAILS API. Cause: java.sql.SQLException: Cursor is closed.
    *; nested exception is:*
    BINDING.JCA-11810
    Get object error.
    Error retrieving the value of a parameter R_NON_CNF_ATTR_CURSOR.
    An error occurred when retrieving the value of parameter R_NON_CNF_ATTR_CURSOR after invoking the SIEBEL.ISDN_OBT_INS_DET.OBTAINASSETDETAILS API. Cause: java.sql.SQLException: Cursor is closed.
    Check to ensure that the parameter has been correctly registered as a valid IN/OUT or OUT parameter of the API. This exception is considered retriable, likely due to a communication failure. To classify it as non-retriable instead add property nonRetriableErrorCodes with value "0" to your deployment descriptor (i.e. weblogic-ra.xml). To auto retry a retriable fault set these composite.xml properties for this invoke: jca.retry.interval, jca.retry.count, and jca.retry.backoff. All properties are integers.
    com.bea.wli.sb.transports.jca.JCATransportException: oracle.tip.adapter.sa.api.JCABindingException: oracle.tip.adapter.sa.impl.fw.ext.org.collaxa.thirdparty.apache.wsif.WSIFException: servicebus:/WSDL/ServiceBus/BusinessServices/IsdnSiebelConn [ IsdnSiebelConn_ptt::IsdnSiebelConn(InputParameters,OutputParameters) ] - WSIF JCA Execute of operation 'IsdnSiebelConn' failed due to: Get object error.
    Error retrieving the value of a parameter R_NON_CNF_ATTR_CURSOR.
    An error occurred when retrieving the value of parameter R_NON_CNF_ATTR_CURSOR after invoking the SIEBEL.ISDN_OBT_INS_DET.OBTAINASSETDETAILS API. Cause: java.sql.SQLException: Cursor is closed.
    ; nested exception is:
    BINDING.JCA-11810
    Get object error.
    Error retrieving the value of a parameter R_NON_CNF_ATTR_CURSOR.
    An error occurred when retrieving the value of parameter R_NON_CNF_ATTR_CURSOR after invoking the SIEBEL.ISDN_OBT_INS_DET.OBTAINASSETDETAILS API. Cause: java.sql.SQLException: Cursor is closed.
    Check to ensure that the parameter has been correctly registered as a valid IN/OUT or OUT parameter of the API. This exception is considered retriable, likely due to a communication failure. To classify it as non-retriable instead add property nonRetriableErrorCodes with value "0" to your deployment descriptor (i.e. weblogic-ra.xml). To auto retry a retriable fault set these composite.xml properties for this invoke: jca.retry.interval, jca.retry.count, and jca.retry.backoff. All properties are integers.
    at com.bea.wli.sb.transports.jca.binding.JCATransportOutboundOperationBindingServiceImpl.invoke(JCATransportOutboundOperationBindingServiceImpl.java:153)
    at com.bea.wli.sb.transports.jca.JCATransportEndpoint.sendRequestResponse(JCATransportEndpoint.java:209)
    at com.bea.wli.sb.transports.jca.JCATransportEndpoint.send(JCATransportEndpoint.java:170)
    at com.bea.wli.sb.transports.jca.JCATransportProvider.sendMessageAsync(JCATransportProvider.java:571)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.bea.wli.sb.transports.Util$1.invoke(Util.java:83)
    at $Proxy127.sendMessageAsync(Unknown Source)
    at com.bea.wli.sb.transports.LoadBalanceFailoverListener.sendMessageAsync(LoadBalanceFailoverListener.java:148)
    at com.bea.wli.sb.transports.LoadBalanceFailoverListener.sendMessageToServiceAsync(LoadBalanceFailoverListener.java:603)
    at com.bea.wli.sb.transports.LoadBalanceFailoverListener.sendMessageToService(LoadBalanceFailoverListener.java:538)
    at com.bea.wli.sb.transports.TransportManagerImpl.sendMessageToService(TransportManagerImpl.java:558)
    at com.bea.wli.sb.transports.TransportManagerImpl.sendMessageAsync(TransportManagerImpl.java:426)
    at com.bea.wli.sb.test.service.ServiceMessageSender.send0(ServiceMessageSender.java:377)
    at com.bea.wli.sb.test.service.ServiceMessageSender.access$000(ServiceMessageSender.java:76)
    at com.bea.wli.sb.test.service.ServiceMessageSender$1.run(ServiceMessageSender.java:134)
    at com.bea.wli.sb.test.service.ServiceMessageSender$1.run(ServiceMessageSender.java:132)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
    at com.bea.wli.sb.security.WLSSecurityContextService.runAs(WLSSecurityContextService.java:55)
    at com.bea.wli.sb.test.service.ServiceMessageSender.send(ServiceMessageSender.java:137)
    at com.bea.wli.sb.test.service.ServiceProcessor.invoke(ServiceProcessor.java:454)
    at com.bea.wli.sb.test.TestServiceImpl.invoke(TestServiceImpl.java:172)
    at com.bea.wli.sb.test.client.ejb.TestServiceEJBBean.invoke(TestServiceEJBBean.java:167)
    at com.bea.wli.sb.test.client.ejb.TestService_sqr59p_EOImpl.invoke(TestService_sqr59p_EOImpl.java:353)
    at com.bea.wli.sb.test.client.ejb.TestService_sqr59p_EOImpl_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:174)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:345)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
    at com.bea.wli.sb.test.client.ejb.TestService_sqr59p_EOImpl_1033_WLStub.invoke(Unknown Source)
    at com.bea.alsb.console.test.TestServiceClient.invoke(TestServiceClient.java:174)
    at com.bea.alsb.console.test.actions.DefaultRequestAction.invoke(DefaultRequestAction.java:117)
    at com.bea.alsb.console.test.actions.DefaultRequestAction.execute(DefaultRequestAction.java:70)
    at com.bea.alsb.console.test.actions.ServiceRequestAction.execute(ServiceRequestAction.java:143)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.access$201(PageFlowRequestProcessor.java:97)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor$ActionRunner.execute(PageFlowRequestProcessor.java:2044)
    at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors.wrapAction(ActionInterceptors.java:91)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processActionPerform(PageFlowRequestProcessor.java:2116)
    at com.bea.alsb.console.common.base.SBConsoleRequestProcessor.processActionPerform(SBConsoleRequestProcessor.java:91)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInternal(PageFlowRequestProcessor.java:556)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:853)
    at com.bea.alsb.console.common.base.SBConsoleRequestProcessor.process(SBConsoleRequestProcessor.java:191)
    at org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:631)
    at org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:158)
    at com.bea.console.internal.ConsoleActionServlet.process(ConsoleActionServlet.java:256)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    at com.bea.console.internal.ConsoleActionServlet.doGet(ConsoleActionServlet.java:133)
    at com.bea.alsb.console.common.base.SBConsoleActionServlet.doGet(SBConsoleActionServlet.java:49)
    at org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlowUtils.java:1199)
    at org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlowUtils.java:1129)
    at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.executeAction(ScopedContentCommonSupport.java:687)
    at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.processActionInternal(ScopedContentCommonSupport.java:142)
    at com.bea.portlet.adapter.scopedcontent.StrutsStubImpl.processAction(StrutsStubImpl.java:76)
    at com.bea.portlet.adapter.NetuiActionHandler.raiseScopedAction(NetuiActionHandler.java:111)
    at com.bea.netuix.servlets.controls.content.NetuiContent.raiseScopedAction(NetuiContent.java:181)
    at com.bea.netuix.servlets.controls.content.NetuiContent.raiseScopedAction(NetuiContent.java:167)
    at com.bea.netuix.servlets.controls.content.NetuiContent.handlePostbackData(NetuiContent.java:225)
    at com.bea.netuix.nf.ControlLifecycle$2.visit(ControlLifecycle.java:180)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:324)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:130)
    at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:395)
    at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:361)
    at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:352)
    at com.bea.netuix.nf.Lifecycle.runInbound(Lifecycle.java:184)
    at com.bea.netuix.nf.Lifecycle.run(Lifecycle.java:159)
    at com.bea.netuix.servlets.manager.UIServlet.runLifecycle(UIServlet.java:388)
    at com.bea.netuix.servlets.manager.UIServlet.doPost(UIServlet.java:258)
    at com.bea.netuix.servlets.manager.UIServlet.service(UIServlet.java:199)
    at com.bea.netuix.servlets.manager.SingleFileServlet.service(SingleFileServlet.java:251)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.AsyncInitServlet.service(AsyncInitServlet.java:130)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:330)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

    You need to open all the cursors in the PLSQL ie., cursors should be initialized in your PLSQL package. JCA DB Adapter tries to open the cursor without checking whether its there or not..If you cant change the PLSQL package, raise a SR with Oracle for a patch.This would be considered as Enhancement Request.
    Regards
    Sesha

  • Query against materialized view from stored procedure brings back empty row

    I have a stored procedure that runs a query against a materialized view. When I run the query outside the SP it works just fine. When I change the MV to a table name, the SP works. When I change it back to the MV i get an empty row. Any ideas? The code is below:
    PROCEDURE getAuth     (p_naid        IN  NUMBER,
                             p_scope       IN VARCHAR2,
                             o_xml_data    OUT SYS_REFCURSOR
                             ) IS
      BEGIN
        IF p_scope = 'Approved' THEN
          OPEN o_xml_data FOR
            SELECT naid,
                   p_naid,
                   auth_type,
                   xml_data
            FROM some_mv
            WHERE naid = p_naid;   
          RETURN;
          CLOSE o_xml_data;
    ... the rest of the procedure ...

    does procedure contain EXCEPTION handler?
    if so, then remove, delete & eliminate EXCEPTION handler (at least during testing & debugging)

  • How to use a parameter passed to stored procedure in cursor?

    I am rather new to Oracle stored procedures and I'm sure that
    this is rather simple. Could someone tell me how to do the
    following: I would like to pass the variable status into my
    stored procedure and then use it in the where clause when
    defining my cursor. I have the stored procedure working 100%
    other than this small detail.
    CREATE OR REPLACE PROCEDURE p_report_starwood_exhibita2(hno
    VARCHAR2, cid INTEGER, kperiod INTEGER, status VARCHAR2, user
    VARCHAR2) IS
    BEGIN
    DECLARE
         CURSOR bid_cursor IS
         SELECT bm.hotelid
         FROM dbo.bidmaster bm
         WHERE bm.channelid = cid
         and bm.contractperiod = kperiod
         and bm.bidstatus like '&status'
    END;
    Thank you

    I am rather new to Oracle stored procedures and I'm sure that
    this is rather simple. Could someone tell me how to do the
    following: I would like to pass the variable status into my
    stored procedure and then use it in the where clause when
    defining my cursor. I have the stored procedure working 100%
    other than this small detail.
    CREATE OR REPLACE PROCEDURE p_report_starwood_exhibita2(hno
    VARCHAR2, cid INTEGER, kperiod INTEGER, status VARCHAR2, user
    VARCHAR2) IS
    BEGIN
    DECLARE
         CURSOR bid_cursor IS
         SELECT bm.hotelid
         FROM dbo.bidmaster bm
         WHERE bm.channelid = cid
         and bm.contractperiod = kperiod
         and bm.bidstatus like '&status'
    END;
    Thank you You can do something like this
    CREATE OR REPLACE PROCEDURE p_report_starwood_exhibita2(hno
    VARCHAR2, cid INTEGER, kperiod INTEGER, status VARCHAR2, user
    VARCHAR2) IS
    BEGIN
    DECLARE
    CURSOR bid_cursor (p_status varchar2) IS
    SELECT bm.hotelid
    FROM dbo.bidmaster bm
    WHERE bm.channelid = cid
    and bm.contractperiod = kperiod
    and bm.bidstatus like p_status
    END;
    and then in the BEGIN section do
    open bid_cursor(status)
    This should work.
    Regards
    Manoj

  • Adding Records Using Stored Procedure (or Cursor?)

    Also, I would like to have a second example of a stored procedure that will add random rows to a table (that is, create duplicates of information already in the table).
    For example,
    IF p_value1 = 'FIRST_VALUE' then
    add this record (incl. seq_no for key);
    ELSIF p_value2 = 'SECOND_VALUE' then
    add that record (incl. seq_no for key);
    and on and on.
    This procedure should also be able to handle random insertion up to several thousand rows. So, I know that I need to loop, say:
    while v_ctr < 1000
    or
    for 1...999
    Much thanks to anyone who can help.
    Many thanks to anyone who can help.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Colin Berrouard ([email protected]):
    You should look in a PL/SQl book,
    There are a lot of examples that can help you
    <HR></BLOCKQUOTE>
    I have already, but when trying to self-learn without not any familiarity with certain concepts and being at most a visual learner, I'm not getting this concept at this point...hence the reason why I asked.
    Thanks.

  • Error when stored procedure returns cursor in pro c

    Hi
    I was trying to make work the stuff explained at
    [m-2537153]
    It executes a stored procedure from pro c that returns a cursor.
    But when i compllie at pro c I get following error. My procedure name is TEST.
    If i change the output parameter to a int value. It compiles ok.
    PLS-S-00306, wrong number or types of arguments in call to 'TEST'
    Error at line 34, column 5 in file E:\C\Test\tt.pc
    TEST(:test_cursor);
    +....1+
    PLS-S-00000, Statement ignored
    Semantic error at line 33, column 1, file E:\C\Test\tt.pc:
    BEGIN
    +1+
    PCC-S-02346, PL/SQL found semantic errors
    Can any one point out what could be the error?
    I am working from oracle 8i client. which connects to oracle 9.0.1.
    OS is win 2000 sp4

    This is my code
    int main(int argc, char** argv)
    +{+
    EXEC SQL BEGIN DECLARE SECTION;
    char user[]="scott";
    char pwd[]="tiger";
    char server[]="testdb";
    char msg_buf[51|http://forums.oracle.com/forums/]+="";+
    int intarg1;
    int intId;
    char strName[]="";
    SQL_CURSOR tcr;
    EXEC SQL END DECLARE SECTION;
    +/* Register sql_error() as the error handler. */+
    EXEC SQL WHENEVER SQLERROR DO sql_error("ORACLE error\n");
    EXEC SQL CONNECT :user IDENTIFIED BY :pwd USING :server;
    Printf("Connected to %s successfully",server);
    EXEC SQL ALLOCATE :tcr;
    EXEC SQL EXECUTE
    BEGIN
    TEST(:tcr);
    END;
    END-EXEC;
    Procedure name is TEST and it like
    CREATE OR REPLACE PROCEDURE TEST (crsdata out sys_refcursor)
    as
    BEGIN
    open crsdata for select id,name from newtab;
    END;

  • Stored procedure with cursor as out parameter

    Can any one help me by showing how to write a procedure with cursor as out parameter and caputuring it in java using jdbc.
    Thanks in advance,
    shravan bharadwaj

    I know that in the SQLJ distribution (which is also downloadable) there is an example in the demo directory called RefCursDemo that shows the SQL code and how to call it - albeit from SQLJ and not JDBC. There may also be a demo in the JDBC distribution, though I am not sure about that.

Maybe you are looking for

  • How do I print a mirror image?  Where did the old functionality go?

    Within the last several months I was able to print a mirror image of my document to my HP DeskJet F4180 in high resolution. I don't know if it is the new HP drivers, or my new Snow Leopard OS but now I can' figure out how to do it again. I can grab a

  • Why do I keep getting actionlist not found when trying to update to version 11.6.602.180?

    WHy do I keep getting actionlist not found when trying to update to update to version 11.6.602.180?

  • Rebate Condition Tables

    Hello All, I've added 2 fields to append structure of KOMP. I've added them in the Rebates list of allowed fields. But, when I go to OV20 to create the Rebate COndition Tables--I can't find them in the field catalog.. pls tell me what am I missing? R

  • Any way to get free ringtones without using a mac or itunes?

    I am a new iphone user. I have a PC..with itunes on it, yet my husband has a mac with all our new music  on it (dont want to open itunes on my pc and have it download all the new stuff...satellite internet can't handle the transfer!) anyway...is ther

  • Right Arrow won't work

    I have noticed that my right arrow key will not work. I tried cleaning it out-nothing happened. The rest of the arrow keys work, but the right one does nothing...I have updated the normal stuff- but this has been going on for a while. Any thoughts? T