Call stored proc

Hello!
We use TT as CacheConnect to Oracle Database 10g. Can we call Oracle Database 10g stored proc from our C++ application? Than passthrough level we must to use if we can perform this call?
Thank you!

You can call Stored procedures using PassThrough=3 provided that the procedure does not return any values.
Note that the procedure will execute in Oracle against Oracle data not against TimesTen data.
Chris

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

  • 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

  • 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

  • Calling stored proc through JDBC

    Hello all,
    What I am doing is calling a stored proceedure in this manner...
    CallableStatement stmt = dbB.getConn().prepareCall ("call LDPKG.LDGetData(?, ?)");  //dbB is a conn Class I made, it works fine and getConn obviously jsut returns teh Connection object... Those work fine disreguard them.
    stmt.registerOutParameter(1, <IDONTKNOW>);  //I dont know the return type
    stmt.registerOutParameter(2, <IDONTKNOW>);  //I dont know the return type
    stmt.execute();I am unsure of what to put for the return type... The DB has these TYPES created as teh OUT for the stored Proc ...
    TYPE t_returnId is table of LDDATA.UserId%TYPE index by BINARY_INTEGER
    TYPE t_returnName is table of LDDATA.UserName%TYPE index by BINARY_INTEGER
    I dont know how to translate that return type to Java... Any ideas???
    Thanks!

    If you want the whole thing it is like this... I just didnt see the point in being redundant with the output types. Now that Date is an issue I brought it up. didnt think i needed to before.. sorry.
    OracleCallableStatement stmt = (OracleCallableStatement)dbB.getConn().prepareCall ("begin LDPKG.LDGetData(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); end;");
    stmt.registerIndexTableOutParameter(1,500, OracleTypes.NUMBER, 0);
    stmt.registerIndexTableOutParameter(2,500, OracleTypes.DATE, 0);
    stmt.registerIndexTableOutParameter(3,500, OracleTypes.VARCHAR, 0);
    stmt.registerIndexTableOutParameter(4,500, OracleTypes.VARCHAR, 0);
    stmt.registerIndexTableOutParameter(5,500, OracleTypes.VARCHAR, 0);
    stmt.registerIndexTableOutParameter(6,500, OracleTypes.VARCHAR, 0);
    stmt.registerIndexTableOutParameter(7,500, OracleTypes.VARCHAR, 0);
    stmt.registerIndexTableOutParameter(8,500, OracleTypes.VARCHAR, 0);
    stmt.registerIndexTableOutParameter(9,500, OracleTypes.NUMBER, 0);
    stmt.registerIndexTableOutParameter(10,500, OracleTypes.VARCHAR, 0);
    stmt.registerIndexTableOutParameter(11,500, OracleTypes.VARCHAR, 0);
    stmt.registerIndexTableOutParameter(12,500, OracleTypes.VARCHAR, 0);
    stmt.registerIndexTableOutParameter(13,500, OracleTypes.VARCHAR, 0);
    stmt.registerIndexTableOutParameter(14,500, OracleTypes.VARCHAR, 0);
    stmt.execute();I'm still looking through Google but not finding much about this :(.

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

  • Can i call stored proc from VOImpl, not from AM?

    Hi,
    i know how to invoke proc from bb defined in AM...
    in VOImpl i have a method getSelectedRows()
    which gets me rows selected in table by user.
    how can i invoke stored proc from there?
    Edited by: grodno on Jan 31, 2013 3:35 AM

    Hi,
    its exactly the same code. The only missing link you have is the access to the transaction. In a Viewimpl file just call this.getApplicationModule() to get access to an application module.
    The method can also be exposed on a client interface (same as for AM)
    Frank

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

  • 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

  • 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

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

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

Maybe you are looking for