Call stored proc problem (SQL exception)

Hello
I have a stored procedure with one param
as follows:
PROCEDURE test1 (xnrid IN VARCHAR2)
This stored procedure is created in package known as "smart".
I tried to call my stored proc via toplink as follows:
          UnitOfWork uow= dbSession.acquireUnitOfWork();
          StoredProcedureCall storedProcedureCall = new StoredProcedureCall();
          storedProcedureCall.setProcedureName("smart.test1");
          storedProcedureCall.addNamedArgument("xnrid");
          DataReadQuery query = new DataReadQuery();
          query.setCall(storedProcedureCall);
          Vector parameters = new Vector();
          //storedProcedureCall.setUsesBinding(true);
          /** For all input params **/
          query.addArgument("xnrid");
          parameters.add("ffff");
          /** execute query **/
          Object result = dbSession.executeQuery(query, parameters);
And I have good oracle exception such as
Internal Exception: java.sql.SQLException: ORA-00900: invalid SQL statement
Error Code: 900
Call:BEGIN smart.test1(xnrid=>'ffff'); END;
Any help is appreciated
gurcan

Hi Sharon
1. You said this code is written in the stored procedure.
2. The scope of the temporary table is valid till its executer's session is valid.
3. So if you execute the stored procedure and then try to find these temporary tables then you wont find them as the stored procedure has already finished its execution. And as soon as the execution of the stored procedure is over these temporary tables are automatically deleted.
4. If you try to execute the code individually then it will show up untill you are logged on. And as your session is valid (Untill you are logged on), SQL Server will show up the tables.
5. As a proof-of-concept:
- Logon to SQL Server.
- Create a temporary table.
- Log off from SQL Server.
- Log on again and try to find the temp table you created. It would not be there as it was valid only for your earlier session.
Let me know if you have any further queries.
Regards
Nikhil

Similar Messages

  • SQL Exception: Invalid column index while calling stored proc from CO.java

    Hello all,
    I am getting a "SQL Exception: Invalid column index" error while calling stored proc from CO.java
    # I am trying to call this proc from controller instead of AM
    # PL/SQL Proc has 4 IN params and 1 Out param.
    Code I am using is pasted below
    ==============================================
              OAApplicationModule am = (OAApplicationModule)oapagecontext.getApplicationModule(oawebbean);
    OADBTransaction txn = (OADBTransaction)am.getOADBTransaction();
    OracleCallableStatement cs = null;
    cs = (OracleCallableStatement)txn.createCallableStatement("begin MY_PACKAGE.SEND_EMAIL_ON_PASSWORD_CHANGE(:1, :2, :3, :4, :5); end;", 1);
         try
    cs.registerOutParameter(5, Types.VARCHAR, 0, 2000);
                        cs.setString(1, "[email protected]");
                             cs.setString(2, s10);
    //Debug
    System.out.println(s10);
                             cs.setString (3, "p_subject " );
                             cs.setString (4, "clob_html_message - WPTEST" );
                   outParamValue = cs.getString(1);
    cs.executeQuery();
    txn.commit();
    catch(SQLException ex)
    throw new OAException("SQL Exception: "+ex.getMessage());
    =========================================
    Can you help please.
    Thanks,
    Vinod

    You may refer below URL
    http://oracleanil.blogspot.com/2009/04/itemqueryvoxml.html
    Thanks
    AJ

  • Exception while calling stored procedure in SQL server

    Hi,
    I run into a problem while calling a proc in SQL server. I am using a database control to do so. The proc returns a integer. This is the first time I use SQL server. Any thoughts? Thanks in advance.
    My method call is:
    int createAccount(SQLParameter[] param)
    The sql is:
    {call espsiCompany(?, ?, ?)}
    The error is:
    java.lang.NullPointerException
    at com.bea.wlw.runtime.core.control.DatabaseControlImpl.getStatement_v2(DatabaseControlImpl.jcs:1885)
    at com.bea.wlw.runtime.core.control.DatabaseControlImpl.invoke(DatabaseControlImpl.jcs:2691)
    at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java:373)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:423)
    at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:396)
    at com.bea.wlw.runtime.jcs.container.JcsProxy.invoke(JcsProxy.java:388)
    at services.OnyxDBControl.createAccount(OnyxDBControl.ctrl)
    at services.OnyxDBControlTest.createAccount(OnyxDBControlTest.jws:18)

    Hi. That's not the signature of the procedure. What I'd like to see is
    the SQL used to create the procedure, eg:
    create procedure myProc @foo int, @bar varchar(30) ....
    as
    begin
    end
    Jun Li wrote:
    Here you go. Thanks for your time.
    DECLARE @RC int
    DECLARE @iSiteId int
    DECLARE @iCompanyId int
    DECLARE @chLanguageCode char(4)
    DECLARE @vchAssignedId varchar(255)
    DECLARE @vchCompanyName varchar(255)
    DECLARE @vchAddress1 varchar(255)
    DECLARE @vchAddress2 varchar(255)
    DECLARE @vchAddress3 varchar(255)
    DECLARE @vchCity varchar(255)
    DECLARE @chRegionCode char(4)
    DECLARE @chCountryCode char(4)
    DECLARE @vchPostCode varchar(40)
    DECLARE @vchPhoneNumber varchar(40)
    DECLARE @vchEmailAddress varchar(255)
    DECLARE @vchURL varchar(255)
    DECLARE @iCompanyTypeCode int
    DECLARE @iCompanySubTypeCode int
    DECLARE @iFamilyId int
    DECLARE @iParentId int
    DECLARE @iPrimaryContactId int
    DECLARE @vchContactFirstName varchar(255)
    DECLARE @vchContactLastName varchar(255)
    DECLARE @iDivisionCode int
    DECLARE @iSICCode int
    DECLARE @iMarketSector int
    DECLARE @vchTaxId varchar(255)
    DECLARE @vchDunnsNumber varchar(255)
    DECLARE @iPhoneTypeId int
    DECLARE @iAddressTypeId int
    DECLARE @iSourceId int
    DECLARE @iStatusId int
    DECLARE @bValidAddress tinyint
    DECLARE @iAccessCode int
    DECLARE @bPrivate tinyint
    DECLARE @vchUser1 varchar(255)
    DECLARE @vchUser2 varchar(255)
    DECLARE @vchUser3 varchar(255)
    DECLARE @vchUser4 varchar(255)
    DECLARE @vchUser5 varchar(255)
    DECLARE @vchUser6 varchar(255)
    DECLARE @vchUser7 varchar(255)
    DECLARE @vchUser8 varchar(255)
    DECLARE @vchUser9 varchar(255)
    DECLARE @vchUser10 varchar(255)
    DECLARE @chInsertBy char(10)
    DECLARE @dtInsertDate datetime
    DECLARE @tiLockRecord tinyint
    DECLARE @tiRecordStatus tinyint
    DECLARE @tireturnType tinyint
    -- Set parameter values
    EXEC @RC = [ONYXPROD].[dbo].[espsiCompany] @iSiteId, @iCompanyId OUTPUT , @chLanguageCode, @vchAssignedId, @vchCompanyName, @vchAddress1, @vchAddress2, @vchAddress3, @vchCity, @chRegionCode, @chCountryCode, @vchPostCode, @vchPhoneNumber, @vchEmailAddress, @vchURL, @iCompanyTypeCode, @iCompanySubTypeCode, @iFamilyId, @iParentId, @iPrimaryContactId, @vchContactFirstName, @vchContactLastName, @iDivisionCode, @iSICCode, @iMarketSector, @vchTaxId, @vchDunnsNumber, @iPhoneTypeId, @iAddressTypeId, @iSourceId, @iStatusId, @bValidAddress, @iAccessCode, @bPrivate, @vchUser1, @vchUser2, @vchUser3, @vchUser4, @vchUser5, @vchUser6, @vchUser7, @vchUser8, @vchUser9, @vchUser10, @chInsertBy, @dtInsertDate, @tiLockRecord, @tiRecordStatus, @tireturnType

  • Calling Stored Proc from JDBC

    Hi All,
    I have a simple stored proc in SQL server 2000
    CREATE PROCEDURE dbo.sp_myProc
    AS
    SELECT CategoryID,CategoryName from Categories
    GO
    My java code is
    CallableStatement cs = connection.prepareCall("{? = call sp_myProc}");
    cs.registerOutParameter(1, Types.VARCHAR);
    boolean result = cs.execute();
    System.out.println("Result : "+result);
    ResultSet rs = (ResultSet)cs.getResultSet();
    while(rs.next())
    System.out.println(rs.getString("CategoryID"));
    When I execute this, the stored procedure gets executed succesfully i.e, the Result is true.
    But the resultset object : rs is Null. It returns a null pointer exception at rs.next();
    The table has values & this returns proper values in SQL analyzer.
    I use Microsoft JDBC drivers for SQL server.
    Is there anything I am doing wrong, all examples i saw refered to the same thing. I am struck with this any help would be appreciated.
    Thanks in advance,
    Sudhindra

    Sorry - small mistake here.
    The number of ? marks in the () brackets = the number of parameters in the procedure.
    Thus with your procedure nothing gets returned.
    With an Oracle Db you will declare the proc as follows:
    PROCEDURE abcd (par1 IN OUT VARCHAR2, par2 IN OUT VARCHAR2)
    IS
    BEGIN
    SELECT abc, def INTO par1, par2 FROM xyz;
    END;
    Thus you will register two in String parameters AND two out String parameters.
    If you require more than one record to be returned the you need to have a look at some collection type to be returned other than VARCHAR2.
    Andre

  • ODP problem Calling Stored proc..

    First here is the code (C#) Errror I am getting is
    (Either wrong number of arguments or right at the execute command it just hangs..)
    OracleConnection oOracleConn = new OracleConnection();
    oOracleConn.ConnectionString = "Data Source=Config;USER ID=xyz;PASSWORD=xyz;";
    oOracleConn.Open();
    OracleCommand myCmd = new OracleCommand("Config.BillerVersionIns", oOracleConn);
    myCmd.CommandType = CommandType.StoredProcedure;
    OracleTimeStamp x = OracleTimeStamp.GetSysDate();
    myCmd.BindByName = true;
    myCmd.Parameters.Add("p_BillerID ", OracleDbType.Int32).Value = 409;
    myCmd.Parameters.Add("p_BillerName", OracleDbType.Varchar2).Value = "TestBiller";
    myCmd.Parameters.Add("p_BillerActiveInd", OracleDbType.Char).Value = "Y";
    myCmd.Parameters.Add("p_ParentBillerID", OracleDbType.Int32);//( this can be null)
    myCmd.Parameters.Add("p_PaymentAcceptanceInd", OracleDbType.Char).Value = "Y";
    myCmd.Parameters.Add("p_VersionDesc", OracleDbType.Varchar2).Value = "Version Number 4";
    myCmd.Parameters.Add("p_EffectiveDate", OracleDbType.TimeStamp).Value = x;
    myCmd.Parameters.Add("o_BillerID", OracleDbType.Int32).Direction = ParameterDirection.Output;
    myCmd.Parameters.Add("o_VersionID", OracleDbType.Int32).Direction = ParameterDirection.Output;
    myCmd.Parameters.Add("o_VersionDesc", OracleDbType.Varchar2).Direction = ParameterDirection.Output;
    myCmd.Parameters[3].Status = OracleParameterStatus.NullInsert;
    OracleDataReader myreader = myCmd.ExecuteReader();
    And now the Stored proc in Oracle 10g...( pls note I have tested this stored proc from Oracle client tool its getting executed perfectly only problem is when I try to call it from code above it throws error)..
    Var v1 Number
    Var v2 Number
    Var v3 Varchar2(50)
    Exec Config.BillerVersionIns (409,'Midwest Energy1', 'Y', NULL, 'Y', 'Version Number 1', SYSDATE, :v1, :v2, :v3)
    Print v1
    Print v2
    Print v3
    Oracle Procs
    TEXT
    Procedure BillerVersionIns
    ( p_BillerID In Number,
    p_BillerName In Varchar2,
    p_BillerActiveInd In Char,
    p_ParentBillerID In Number,
    p_PaymentAcceptanceInd In Char,
    p_VersionDesc In Varchar2,
    p_EffectiveDate In TimeStamp,
    o_BillerID out NOCOPY Number,
    o_VersionID out Number,
    o_VersionDesc out NOCOPY Varchar2
    ) Is
    v_BillerID Number;
    v_VersionID Number;
    v_EffectiveDate TimeStamp;
    v_SysDate TimeStamp;
    Begin
    v_EffectiveDate := p_EffectiveDate;
    v_EffectiveDate := SYSDATE;
    v_SysDate := SYSDATE;
    If (p_BillerID Is Null) Then
    v_VersionID := 1;
    Insert Into Config.Biller(BillerID, BillerName, BillerActiveInd, ParentBillerID, PaymentAcceptanceInd, CreatedDate, UpdatedDate)
    Values (Config.Biller_Seq.NextVal, p_BillerName, p_BillerActiveInd, p_ParentBillerID, p_PaymentAcceptanceInd, v_SysDate, v_SysDate);
    Select BillerID Into v_BillerID From Config.Biller Where BillerName = p_BillerName;
    Insert Into Config.BillerVersion (BillerID, VersionID, BillerName, VersionDesc, BillerVersionActiveInd, EffectiveDate, RetireDate, ParentBillerID, PaymentAcceptanceInd, CreatedDate)
    Values (v_BillerID, v_VersionID, p_BillerName, p_VersionDesc, 'Y', v_EffectiveDate, NULL, p_ParentBillerID, p_PaymentAcceptanceInd, v_SysDate);
    o_BillerID := v_BillerID;
    o_VersionID := v_VersionID;
    Select VersionDesc Into o_VersionDesc From Config.BillerVersion Where BillerID = v_BillerID And VersionID = v_VersionID;
    Else
    Select Max(VersionID) Into v_VersionID From Config.BillerVersion Where BillerID = p_BillerID;
    Update Config.BillerVersion
    Set BillerVersionActiveInd = 'N',
    RetireDate = v_SysDate
    Where BillerID = p_BillerID
    And VersionID = v_VersionID;
    v_VersionID := v_VersionID + 1;
    Update Config.Biller
    Set BillerName = p_BillerName,
    BillerActiveInd = p_BillerActiveInd,
    ParentBillerID = p_ParentBillerID,
    PaymentAcceptanceInd = p_PaymentAcceptanceInd,
    UpdatedDate = v_SysDate
    Where BillerID = p_BillerID;
    Insert Into Config.BillerVersion (BillerID, VersionID, BillerName, VersionDesc, BillerVersionActiveInd, EffectiveDate, RetireDate, ParentBillerID, PaymentAcceptanceInd, CreatedDate)
    Values (p_BillerID, v_VersionID, p_BillerName, p_VersionDesc, 'Y', v_EffectiveDate, NULL, p_ParentBillerID, p_PaymentAcceptanceInd, v_SysDate);
    o_BillerID := p_BillerID;
    o_VersionID := v_VersionID;
    Select VersionDesc Into o_VersionDesc From Config.BillerVersion Where BillerID = p_BillerID And VersionID = v_VersionID;
    End If;
    End;
    69 rows selected
    TEXT
    Message was edited by:
    user588434

    One additional point I would make on the Spring integration side is that you should probably cast to ClientSession below rather than SpringClientSession. Or, in this case, even to oracle.toplink.publicinterface.Session.
    java.sql.Connection conn = ((ClientSession) session).getAccessor().getConnection();
    Or probably even better would be to refactor the code so that you can execute a DatabaseQuery with a stored procedure Callable. Although I know you already said that you inherited this code from somewhere else, so maybe there's nothing you can do.
    But in general, I try to do whatever I can to avoid having to extract the Connection from a TopLink Session.

  • How to Call Stored Proc. through JDBC from SQL Server

    I have to call Stored Procedure by JDBC in java. This is the prog i m using:
    import java.sql.*;
    import java.io.*;
    class callSP
    public static void main(String a[]) throws Exception
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection c=DriverManager.getConnection("jdbc:odbc:first","sa","");
    //CallableStatement cs=c.prepareCall("{? =call GET_CLUSTER(?)}");
    CallableStatement cs=c.prepareCall("{call GET_CLUSTER(?)}");
    cs.registerOutParameter(1,Types.CHAR);
    //cs.setString(1, "Teamwork");
    cs.execute();
    //cs.executeUpdate();
    String output=cs.getString(1);
    System.out.println(output);
    catch (SQLException e)
    System.out.println(e);
    This is the Stored Procedure:
    CREATE PROCEDURE GET_CLUSTER
    @Ip_THESAURUS_KEY_WORD CHAR(40)
    AS
    DECLARE @Lc_THESAURUS_CODE INT,
    @Lc_CLUSTER_CODE INT
    BEGIN
    --GET THE THESARUS CODE FOR THE KEYWORD
    SELECT @Lc_THESAURUS_CODE = THESAURUS_CODE
    FROM THESAURUS_LIST
    WHERE THESAURUS_KEY_WORD = @Ip_THESAURUS_KEY_WORD
    --GETTING THE CLUSTER ID
    SELECT @Lc_CLUSTER_CODE = CLUSTER_CODE
    FROM THESAURUS_ENRICH_CLUSTER
    WHERE THESAURUS_CODE = @Lc_THESAURUS_CODE
    --GET THE CLUSTER KEYWORDS
    SELECT THESAURUS_KEY_WORD
    FROM THESAURUS_LIST T,THESAURUS_ENRICH_CLUSTER C
    WHERE T.THESAURUS_CODE=C.THESAURUS_CODE
    AND C.CLUSTER_CODE=@Lc_CLUSTER_CODE AND NOT THESAURUS_KEY_WORD=@Ip_THESAURUS_KEY_WORD
    END
    GO
    Check it out what is problem. Data is not getting, it is giving exception.

    Please be specific regarding the problem that you are facing, that's the key to getting help in the forum. If there's exception in your program, such as NullPointerException or SQLException, please state it in your post.

  • Calling stored proc (with 2 IN and 3 OUT) - from SQL Plus

    This is the signature of my stored proc:
    CREATE OR REPLACE PROCEDURE myschema.myproc
       p_usr_name     IN  VARCHAR2,    
       p_send_tmstmp  IN  DATE,    
       p_ret_value    OUT NUMBER,
       p_err_code     OUT VARCHAR2
    )If I need to call it from sql plus, how do I need to pass the arg?
    This is what I am doing
    execute myschema.myproc('abc123','02-MAY-2008');
    What is wrong here? If someone could help. Thx!

    Try something like this
    var usr_name    varchar2(30)  
    var send_tmstmp varchar2(11)  
    var ret_value   number
    var err_code    varchar2(10)
    begin
    :usr_name    := 'abc123';
    :usr_name := '02-MAY-2008';
    myschema.myproc ( p_usr_name           => :usr_name,
                      p_send_tmstmp        => TO_DATE( :usr_name, 'DD-MON-YYYY' ),
                      p_ret_value          => :ret_value,
                      p_err_code           => :err_code);
    end;
    print ret_value;
    print err_code;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Calling stored proc from java using 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

  • 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

  • Use 'default' keyword in call string while calling stored proc?

    I am calling following sql server stored procedure from java code using my jdbc driver for sql server: CREATE PROCEDURE test_findTbInfo (
    @paramIn_Str varchar(10),
    @paramOut_Int int OUT,
    @paramIn_Int int = 20
    AS
    begin
    set @paramOut_Int = @paramIn_Int * 100
    end
    If I make a call like this:
    CallableStatement cs = conn.prepareCall(" { call test_findTbInfo(? , , ? ) }");
    cs.setString(1, "test_tab");
    cs.setInt(2, 4);
    cs.execute();
    It works without any error. But this is not a right behavior. !! The second parameter as you see is passed like an optional parameter. But in stored proc it is NOT an optional param and so if the value not passed it should fail...
    Now if I change the code to
    CallableStatement cs = conn.prepareCall(" { call test_findTbInfo(? , default, ? ) }");
    it works correctly. Gives error that "Procedure 'test_findTbInfo' expects parameter '@paramOut_Int', which was not supplied." which is correct.
    So is it a normal practice to use 'default' keyword while calling sql server stored procedures having optional parameters in jdbc ????
    Anyone knows ??? As far as I know "call test_findTbInfo(? , , ? )" works fine except in some cases and also it forces users to put all optional parameters at the end of parameter list in stored proc.
    Please let me know whether I should go with 'default' throuout for sql server stored proc while calling using my jdbc driver.
    Amit

    {?= call <procedure-name>[<arg1>,<arg2>, ...]}The question mark in the above is the result parameter
    that must be registered.
    That is not the same as an OUT argument.Yes that is true. The result value and OUT parameters are different but they both MUST be registered as per jdbc API
    "The type of all OUT parameters must be registered prior to executing the stored procedure; their values are retrieved after execution via the get methods provided here."
    Anyway, my original question still stays as it was. If there are some optional IN parameters in stored procedure
    e.g.
    PROCEDURE test_findTbInfo (
    @paramIn_Int int = 20,
    @paramOut_Int int OUT
    how do you call this?
    CallableStatement cs = conn.prepareCall(" { call test_findTbInfo( , ? ) }");
    cs.registerOutParameter(1, Types.INTEGER);
    cs.execute();
    or
    CallableStatement cs = conn.prepareCall(" { call test_findTbInfo(default, ? ) }");
    Also note that I am intending to use ONLY sql server driver for this.
    The first as well second seem to work. Except that second way is seems reliable. I just wanted a second opinion on that...
    Amit

  • Call stored proc from inside sp

    I am trying to call a stored proc from inside a stored proc and the stored proc needs to return a ref_cursor. I am trying to loop over the returned ref_cursor, but my problem is that when I compile the sp it says the ref_cursor is not a procedure or is undefined. Can anyone please tell me why I am getting this error? Refer to the code below!
    create or replace
    PROCEDURE TCS_GetPartReferenceData
    contracts IN VARCHAR2
    , showInWork IN INTEGER
    , userClock IN VARCHAR2
    , intMaxResults IN INTEGER
    , ret_cursor OUT SYS_REFCURSOR
    ) AS
    p_cursor SYS_REFCURSOR;
    BEGIN
    TCS_GETDRNSFORCONTRACTS(contracts
    , showinwork
    , userClock
    , intmaxresults
    , p_cursor);
    for r in p_cursor loop
    dbms_output.put_line(r.puid);
    end loop;
    END TCS_GetPartReferenceData;

    Probably you want sth. like
    CREATE OR REPLACE PROCEDURE tcs_getpartreferencedata (contracts       IN     VARCHAR2,
                                        showinwork      IN     INTEGER,
                                        userclock       IN     VARCHAR2,
                                        intmaxresults   IN     INTEGER,
                                        ret_cursor         OUT sys_refcursor)
    AS
    BEGIN
       tcs_getdrnsforcontracts (contracts,
                                showinwork,
                                userclock,
                                intmaxresults,
                                ret_cursor);
    END tcs_getpartreferencedata;
    var cur refcursor
    exec tcs_getpartreferencedata(contracts_value,showinwork_value,userclock_value,intmaxresults_value, :cur)
    print curfill in appropriate values for the parameters _value ....                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Stored Proc Problem

    Hi everyone,
    I have inherited a classic asp site that uses stored procs with a SQL 2005 Server. The problem is this, when I open up "Command" to view the data that my predecessor used all seems ok as I am not an expert in Stored Procs and am just learning this web application. I do not make any changes and then select "OK" - when I do this an error comes up telling me that there is a "MIssing Run Time Variable" for a particular variable. The site itself works well so the error seems incorrect.
    Because I inherited the site and do not have access to my predecessors computer is there a chance that because I am opening the "Command" box for the first time that I am not seeing exactly what was added into it originally??
    I am at a bit of a loss and would really appreciate a steer in the right direction.
    Many thanks
    Scott

    I would not worry too much if it works. I have noticed that if I enter 'custom' code that DW gives me error messages when the code is actually O/k.
    HTH

  • Portable way to call Stored Procs. which return a ResultSet (MySQL/Oracle)?

    Hello!
    I have developed a Java application which calls stored procedures, some of which return a ResultSet (always one).
    I need to support more DBMS vendors, so I used the standard JDBC syntax to call the stored procedures ({call storedProcedure(?,?)}).
    I developed the code using MySQL, but succeded to call SQL Server 2000 stored procedures changing only the driver (that's the purpose of JDBC, right?).
    Now I need to support the Oracle DBMS, but I can't find a way to create a stored procedure which returns a result set and allows me not to change the already stable Java code.
    How could I achieve this result? Should I use some other Oracle object, say a function?
    By the way, I searched the Internet, but only found solutions which would've made me change code. This is definitely not portable
    Thank you very much for your help!
    PS: Some of the stored procedures return both a ResultSet AND OUT parameters.

    Hello and thanks for your reply, jwenting.
    However, keeping useless "philosophy" out of this thread, please just let me clarify that I obviously didn't want portability of stored procedures, I just wanted a standard JDBC to interface with them. I haven't had problems in the past with stored procedures and other DBMSs, I'm having them just now with the Oracle JDBC driver. Since JDBC is meant to be portable, I hoped there was a portable way of calling Oracle stored procedures (or whatever else in Oracle takes inputs and returns output and a ResultSet...). Unfortunately, there doesn't seem to be any, unless I use a commercial driver from DataDirect. I find this a heavy limitation of the Oracle JDBC driver, but, alas, here it is... I'll have to refactor my stable code...
    Thanks again...

  • Calling stored proc via services

    I would be grateful if you could help me in resolving a technical issue in CMS(stellent).
    We have a requirement that we need to call a stored procedure through services .The stored proc takes an input argument and returns a result set and has a defination that starts like
    create or replace
    PACKAGE BODY GETPROJECTPCKG IS
    PROCEDURE PROC_RPU (rpu_list_count IN number, temp_project_cursor OUT project_ref_cursor) IS.
    I've defined a service call like
    <tr>
         <td>GET_RPU_INFO</td>
         <td>DocService
              33
              RECENTPROJECTUPDATE
              null
              null<br>
              null</td>
         <td>5:QgetRpuNames:temp_project_cursor::null</td>
    </tr>
    And below is how I've called the procedure
    <tr>
         <td>QgetRpuNames</td>
         <td>{call GETPROJECTPCKG.PROC_RPU(?)}</td>
         <td>rpu_list_count int</td>
    </tr>
    i tried calling procedure as below also ..
    <tr>
         <td>QgetRpuNames</td>
         <td>{call GETPROJECTPCKG.PROC_RPU(?,?)}</td>
         <td>rpu_list_count int
         temp_project_cursor out:resultset</td>
    </tr>
    As per my understanding the temp_project_cursor which is the resultset that would be returned from procedure should be available on the template specified.
    But while executing the service I am getting an error :
    Unable to create result set for query 'QgetRpuNames({call GETPROJECTPCKG.PROC_RPU(10)})'. ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'PROC_RPU'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored)
    Can you please assist.

    Hey
    if this is still an issue please refert "Call Stored Procedure from Oracle Fusion ECM (Stellent) " at http://www.corecontentonly.com/index.php/downloads/. Jason has shared a component that you can make use of.
    cheers,
    sapan

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

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

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

Maybe you are looking for

  • T400 not booting at all.

    My T400 is not booting at all. When I power it on, no matter it's on AC or battery, it just shows the boot screen Black Screen with Thinkpad written (in BIG white letters). and "To Interrupt normal setup, press the blue ThinkVantage button"  I tried

  • TS1702 how to delete pending download book from iTunes?

    I accidentally downloaded app from iTunes store without noticing that they gave me an e-book together with the app. That e-book file is too big (1GB) that caused me cannot connect to iTunes store. Please let me know how can I permanently delete it fr

  • HT1923 is itunes compatable with Windows 8 ????

    is iTunes compatable with Windows 8 ???   if so how do I update my "Apple ID" on my iphone 5???  when I access ITunes to sync/update my phone it displays an old Apple ID ???

  • STL file in Web Documents

    Hi,        I am able to display 3D files of type STL inside DMS in R/3 and also inside cFolders. But when I try to display using Web Documents I am getting an error. Any setting needs to be done in the backend in order to display 3D files of type stl

  • Imbedding an iCal calendar into iWeb09 - Can it be done?

    I have created a web page that I can embed a Google calendar that I can update via Google and it automatically updates the web site. Is it possible to do this with iCal instead? Any help is appreciated. THANKS!