Executing a Stored Procedure

I have this code
CallableStatement stmt1 = conn.prepareCall("{?= call suma(?)}");
stmt1.setInt(2, 12);
stmt1.registerOutParameter(1, Types.INTEGER );
stmt1.registerOutParameter(2, Types.INTEGER );
stmt1.execute();
But it doesn't work, I copy this from a book.
I am using the jdbc-odbc bridge to connect to a SQL Server 7.0
Someone can help?
Thanks

Thats is because when I execute the program, it finishes abnormally and with no apparent reason. I think it can be problems with SQL Server or something
Thanks

Similar Messages

  • Error while executing a stored procedure from forms6i

    When I execute a STORED PROCEDURE from ORACLE DB 10g this procedure works perfectly fine.
    But when I execute the same from the FORMs 6i I get the following error:
    PDE-PLU022 Don't have access to the stored program unit
    XMLPARSERCOVER in schema CARE.
    where XMLPARSERCOVER is the class and
    CARE is the schema.
    Regards,
    Jignesh S

    I have tried this with both the owner of the schema and the intended user, -from both forms and directly.
    All rights was granted on the stored procedure. Since posting I have found that one of the tables that the procedure might insert into, was not explicitly granted to the intended user, and after rectifying that the error message went away.
    -however, the procedure now silently "finishes" without any evidence that it ever ran, if invoked from the forms application. When invoked from SQL Plus (or JDev, or Toad) it runs as expected.
    I have no public synonym for the procedure, -is that necessary?
    The stored procedure in question is implemented in java, and published as a stored procedure. It does rather heavy lifting, when running, using a view against another server , updating local tables and quite a lot of data validation/cleansing, and logging. All recourses are within the same schema.
    Any ideas?

  • Error ORA-04031 while executing a stored procedure from Pro C++ code

    I am getting the error ORA-04031(Unable to allocate 4096 bytes of shared memory("Shared Pool",.....)) while trying to execute a stored procedure from my pro*C application. This happens only after a few hours since the application has been running. I am closing the cursor after every database call.
    Does anyone know why it is happening and any possible solutions?
    TIA
    Srithaj.

    One thing that can be done is to flush the shared pool before starting the application.
    alter system flush shared pool;
    Another is to increase the shared pool size by setting the parameter shared_pool_size in init_sid.ora file.
    null

  • Error while executing the stored procedure through sender JDBC adapter

    Hi All,
    I am getting below error while executing the stored procedure through sender JDBC adapter.
    Database-level error reported by JDBC driver while executing statement 'exec SapgetNextEntity 'SalesOrder''. The JDBC driver returned the following error message: 'com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.'. For details, contact your database server vendor.
    what is the problem? any idea to anyone...
    regards
    Ramesh

    hi Dharamveer,
    I am not getting below statement for your reply
    Try to use Refrence Cursor it will return u reference of resultset.
    I mention SP like this
    exec SapgetNextEntity 'SalesOrder'
    SapgetNextEntity -
    > SP Name
    SalesOrder----
    > Parameter I am passing...
    regards
    Ramesh

  • Strange error while executing a stored procedure: Incorrect syntax near '@p0'

    All, I am getting a strange error while executing a stored procedure: Incorrect syntax near '@p0'  using JDBC CallableStatment.
    Here is my code...
    CallableStatement cStmt = con.prepareCall("{call SET CHAINED ON EXEC <dbName>.<schemaName>.<SPName> (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
    cStmt.setString(1, "2012005881");
    cStmt.setString(2, "07");
    cStmt.setString(3, "10");
    cStmt.setString(4, "Case title");
    cStmt.setString(5, "Open");
    java.sql.Date dt1 = new java.sql.Date(2014,10,20);
    cStmt.setDate(6, dt1);
    cStmt.setString(7, "01");
    cStmt.setString(8, "N");
    cStmt.setString(9, "ADA Test");
    cStmt.setString(10, "N");
    cStmt.setString(11, "English");
    cStmt.setString(12, "N");
    cStmt.setString(13, "N");
    cStmt.setString(14, "N");
    cStmt.setString(15, "N");
    cStmt.setString(16, "N");
    cStmt.setString(17, "N");
    cStmt.setString(18, "07");
    cStmt.setString(19, "10");
    cStmt.setString(20, "juache0");
    java.sql.Date dt2 = new java.sql.Date(2014,10,20);
    java.sql.Date dt3 = new java.sql.Date(2014,10,20);
    cStmt.setDate(21, dt2);
    cStmt.setDate(22, dt3);
    cStmt.setString(23, "userid0");
    cStmt.setString(24, "");
    cStmt.setString(25, "");  
    cStmt.setString(26, "");
    java.math.BigDecimal bg1 = new java.math.BigDecimal(10);
    cStmt.setBigDecimal(27, bg1);
    cStmt.setString(28, "userid");
    cStmt.setString(29, "userid");
    int hadResults = cStmt.executeUpdate();
    Your help is greatly appreciated.
    I am executing the above using Jconnect3.0 driver, inside WebSphere Application Server V8.0
    Thanks
    Nags

    NOTE: I don't work with JDBC/jConnect so (at this point) just some questions ...
    1 - are you sending this to ASE, ASA, IQ, or some other RDBMS?
    2 - what is the value of <schemaname>?
    3 - do you have other prepareCall() instances that successfully call a stored proc? [would be interesting to see if there's a difference in the format of the calls]
    A quick google search shows a couple ways to submit a stored proc execution to the RDBMS, with the format depending on the format expected by the target RDBMS.
    I'm wondering if you really need/want the parentheses around the argument list, ie, what happens if you change
    from
    -- parentheses around args
    EXEC <dbName>.<schemaName>.<SPName> ( ?,?,?,?,?,...,? )
    to
    -- no parentheses around args
    EXEC <dbName>.<schemaName>.<SPName> ?,?,?,?,?,...,?
    In ASE if I wrap the parameters in parentheses I get the same error you're getting:
    ================== w/ parentheses => error
    1> sp_who (sa)
    2> go
    Msg 102, Level 15, State 1:
    Server 'CC1_V1', Line 1:
    Incorrect syntax near 'sa'.   <<=== sa == @p0 ??
    ================== w/out parentheses => works
    1> sp_who sa
    2> go
    fid spid status  loginame origname ...
       0   17 running sa       sa       ...
    ==================

  • Executing a stored procedure using a button within a region

    Hello APEX Users:
    I have the task of creating a link within an apex region to execute a stored procedure from another schema using two arguments. What is the best method of executing a procedure in apex using a link or button? Thanks.
    Ben

    Stop posting follow-ups to closed/old threads.
    <li>Other users may ignore the thread as it appears to be closed
    <li>Your assumption that the questions are related may be incorrect, leading to confusion about the nature of the problem and potential solutions.
    <li>Watches on the thread may have expired, so the original participants may be unaware of the new post, or they may no longer be active on the forum
    <li>APEX Phone Test
    <li>You have no ability to mark posts as helpful or correct
    Post your question as a new thread, including the following information:
    <li>APEX version
    <li>DB version and edition
    <li>Web server architecture (EPG, OHS or APEX listener)
    <li>Browser(s) used
    <li>Theme
    <li>Templates
    <li>Region type
    <li>Links to related posts and threads using the methods in the FAQ.
    Your question has NOTHING to do with this thread.
    And update your forum profile with a better handle than "862509".

  • Incorrect Update Count by executing a stored procedure from Java

    Hi Guys,
    I am calling a stored procedure from the java program which is modifying the rows of a table. Now I want to know how many rows have been modified by executing the stored procedure. I am writing the following code for the purpose:
    OracleCallableStatement stmt =
    (oracle.jdbc.driver.OracleCallableStatement)con.prepareCall("{callsp_um_setForumID(?,?)}");
    stmt.setInt(1,101);
    stmt.setInt(2,666);
    n = stmt.executeUpdate();
    System.out.println(n + " row(s) updated");
    This procedure is actually modifying the table(When I query the databse it has modified 1 row). But it is returning a value 0 and is printing "0 row(s) updated".
    Is there a way by which I can find out the number of rows updated by executing the stored procedure?
    Thanks
    Sachin
    [email protected]

    I'm no expert on this, but I have a similar call where I fetch
    an Oracle REF CURSOR from a call to a stored function. If you
    fetch the cursor as an Object from your CallableStatement, you
    can then cast it to a ResultSet e.g.
    mystatement.executeUpdate();
    ResultSet rs = (ResultSet) mystatement.getObject(1);
    Then you should be able to loop through your ResultSet as usual.
    Good luck!
    Chris

  • Geeting TIMEOUT while executing a Stored Procedure.

    Hi Gurus,
    Am facing a TimeOut  issue while executing the Sql Stored Procedure.
    I have changed a settings of Execution TimeOut to Zero (which is unlimited ), Am still unable to execute the Stored Procedure.
    Should i have to add any TimeOut Command in my Sql Stored Procedure. If please suggest me.
    Thanks in advance.

    Time out is the client who throws the error  not SQL Server. Please read Erland's article
    http://www.sommarskog.se/query-plan-mysteries.html
    Are you sure there is blocking/locking? Is that possible someone run BEGIN TRAN and did not properly specify COMMIT TRAN?
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Executing a stored procedure from an Ifs Program

    I have a need to execute a stored procedure in another schema
    within the same database, and I need to receive an OUT parameter
    to continue processing. The oracle.ifs.server.sql.IfsConnection
    is not in my class path. Can someone tell me which jar file to
    adde to my classpath to have this funcitonality that IFS claim.
    Regards,
    Jeff

    Guys I need help with this one as soon as possible.

  • Is it possible to execute a stored procedure using the JDBC adapter?

    Hi all,
    Can anybody confirm whether we can execute a stored procedure created in a database using the processing parameters of a JDBC adapter of a communication channel?
    If yes, then please let me know how (may be with an example)
    Thanks.

    Yes, that is possible. You have to chose EXECUTE in the action field to execute the stored procedure. Here's a little piece on the JDBC receiver:
    JDBC Receiver
    For writing data to an SQL database you also need to define a strict data type. The general format is like this:
        <ns:MT_RECORDSET>
              <STATEMENT>
                   <TABLE_NAME ACTION="">
                        <TABLE/>
                        <ACCESS>
                             <FIELD1/>
                             <FIELD2/>
                             <FIELDn/>
                        </ACCESS>
                        <KEY>
                             <ID compareOperation=""/>
                             <FIELDx compareOperation=""/>
                        </KEY>
                   </TABLE_NAME>
              </STATEMENT>
    </ns:MT_RECORDSET>
    This recordset represents an SQL statement like "update TABLE1 set FIELD1=123, FIELD2=456, FIELDn='xyz' where ID=12345 and FIELDx is NULL"
    MT_RECORDSET is the name of the Message Type used.
      For the value of the attribute ACTION you can choose from the following values:
         UPDATE : updates the given fields in the table with their new values
         INSERT : insert the given fields as a new row in the table
         UPDATE_INSERT : insert rows in the table when update is not possible
         DELETE : deletes given fields from the table
         SELECT : selects given fields from the table. Note that this option returns a response in the JDBC Sender form!
         EXECUTE : execution of a stored SQL procedure
         SQL_QUERY | SQL_DML : option to transfer more complex SQL statements to the database
      The attribute compareOperation can have the following values:
         EQ : equal
         NEQ : not equal
         LT : less than
         LTEQ : less than or equal to
         GT : greater than
         GTEQ : greater than or equal to
         LIKE : used to compare strings

  • Execute oracle stored procedure in CF8

    I am executing a stored procedure like this.
    <cfstoredproc procedure="GetAction"
    datasource="test_DSN">
    <cfprocparam cfsqltype="CF_SQL_INTEGER"
    dbvarname="actionId" type="in" value="1">
    <cfprocresult name="actions" resultset="1" >
    </cfstoredproc>
    and my stored procedure in oracle is,
    create or replace function GetAction(actionId IN
    ACTION.ID%TYPE)
    RETURN ACTION%ROWTYPE
    IS
    actions
    ACTION%ROWTYPE;
    begin
    select *
    INTO actions
    FROM ACTION WHERE ID = actionId;
    RETURN actions;
    end GetAction;
    then I get the error message like,
    ORA-01008: not all variables bound
    Please help me on this.
    Thanx

    If you want to return a result set (result of a query) from
    your PL/SQL, you will have to do what Daverms suggested and convert
    your function to a procedure
    and use a reference cursor to return your result set. Your
    procedure will have to be contained in a package in order for you
    to declare a ref cursor "globally" so that it can be accessed by
    CF.
    Oh, and be sure to change your cfstoredproc procedure
    parameter to add the package name to the proc name.
    <cfstoredproc procedure="your_pkg.GetAction"
    datasource="test_DSN">
    Phil

  • Executing the stored procedure with output which is a collection of objects

    Hello,
    I have the objects and collection of objects within an objects as below:
    CREATE OR REPLACE TYPE SHARE_OUTST_T
    AS OBJECT
    SHR_OUTST_AMT     number
    CREATE OR REPLACE TYPE SECURITY_T
    AS OBJECT
         VOTE_PER_SHR     number
    , CUSIP     varchar2(12)
    , EXCHANGE     varchar2(10)
    , IV_TYPE_CD     varchar2(10)
    , SEC_TICKER_SYMB     varchar2(20)
    CREATE OR REPLACE TYPE ALTERNATE_ID_T
    AS OBJECT
    ( ALT_ID_TYPE     varchar2(20)
    CREATE OR REPLACE TYPE ISSUE_MAINT_VERSION_T
    AS OBJECT
         IM_KEY_ID number     
    ,     IM_VER_NUM number
    ,     EFF_TMSTMP timestamp
    , EXP_TMSTMP timestamp
    ,     NEXT_REVIEW_TMSTMP timestamp
    ,     APPR_STATUS_REF_ID number
    , VOTE number
    , ADD_USR_ID varchar2(20)
    , ADD_TMSTMP timestamp
    , UPD_USR_ID varchar2(20)
    , UPD_TMSTMP timestamp
    , LOCK_LEVEL_NUM number
    , ACTION VARCHAR2(1)
    CREATE OR REPLACE TYPE ISSUE_SHARE_MAINT_T
    AS OBJECT
         IM_KEY_ID      number     
    ,     IM_VER_NUM      number
    ,     SHR_OUTST_AMT      number
    ,     CURR_OUTST_AMT     number
    ,      ADD_USR_ID      varchar2(20)
    ,      ADD_TMSTMP      timestamp
    ,      UPD_USR_ID      varchar2(20)
    ,      UPD_TMSTMP      timestamp
    ,      LOCK_LEVEL_NUM      number
    ,     ACTION     VARCHAR2(1)
    CREATE OR REPLACE TYPE ISSUE_MAINT_COMMENT_T
    AS OBJECT
         IM_KEY_ID      number     
    ,     IM_VER_NUM      number
    ,     COMMENT_TXT     varchar2(400)
    ,      ADD_USR_ID      varchar2(20)
    ,      ADD_TMSTMP      timestamp
    ,      UPD_USR_ID      varchar2(20)
    ,      UPD_TMSTMP      timestamp
    ,      LOCK_LEVEL_NUM      number
    ,     ACTION     VARCHAR2(1)
    CREATE OR REPLACE TYPE ISSUE_MAINT_COMMENT_COL_T AS TABLE OF ISSUE_MAINT_COMMENT_T;
    CREATE OR REPLACE TYPE ISSUE_VERSION_T
    AS OBJECT
         SHARE_OUTST     SHARE_OUTST_T
    ,     SECURITY     SECURITY_T
    ,     ALTERNATE_ID     ALTERNATE_ID_T
    ,     ISSUER     ISSUER_T
    ,     ISSUE_MAINT_VERSION     ISSUE_MAINT_VERSION_T
    ,     ISSUE_SHARE_MAINT     ISSUE_SHARE_MAINT_T
    , ISSUE_MAINT_COMMENT_COL ISSUE_MAINT_COMMENT_T
    CREATE OR REPLACE TYPE ISSUE_VERSION_COL_T AS TABLE OF ISSUE_VERSION_T;
    And the stored procedure as :
    =======================================
    PROCEDURE get_all_issue_version_col
    ( pv_issue_version_col OUT issue_version_col_t
    AS
    CURSOR cur_issue_version
    IS
    SELECT
    issue_version_t (
    SHARE_OUTST_T (so.shr_outst_amt )
    , SECURITY_T ( s.vote_per_shr
    , s.sec_cusip
    , s.PRI_MKT_EXCH_CD
    , s.IV_TYPE_CD
    , s.SEC_TICKER_SYMB )
    , ALTERNATE_ID_T (a.ALT_ID_TYPE)
    , ISSUER_T (i.ISSR_ID )
    , ISSUE_MAINT_VERSION_T (imv.im_key_id
    , imv.im_ver_num
    , imv.eff_tmstmp
    , imv.exp_tmstmp
    , imv.next_review_tmstmp
    , imv.appr_status_ref_id
    , imv.vote
    , imv.add_usr_id
    , imv.add_tmstmp
    , imv.upd_usr_id
    , imv.upd_tmstmp
    , imv.lock_level_num
    , NULL )
    , ISSUE_SHARE_MAINT_T (ism.im_key_id
    , ism.im_ver_num
    , ism.shr_outst_amt
    , ism.curr_outst_amt
    , ism.add_usr_id
    , ism.add_tmstmp
    , ism.upd_usr_id
    , ism.upd_tmstmp
    , ism.lock_level_num
    , NULL)
    , ISSUE_MAINT_COMMENT_T(imc.im_key_id
    , imc.im_ver_num
    , imc.comment_txt
    , imc.add_usr_id
    , imc.add_tmstmp
    , imc.upd_usr_id
    , imc.upd_tmstmp
    , imc.lock_level_num
    , NULL )
    FROM
    share_outst so
    , security s
    , alternate_id a
    , issuer i
    , issue_maintenance_version imv
    , issue_share_maintenance ism
    , issue_maintenance_comment imc
    WHERE
    s.sec_key_id = so.SEC_KEY_ID
    and s.SEC_KEY_ID = a.SEC_KEY_ID
    and s.MSTR_ISSR_KEY_ID = i.ISSR_KEY_ID
    and s.SEC_CUSIP = imv.SEC_CUSIP (+)
    and s.SEC_CUSIP = ism.SEC_CUSIP (+)
    and imv.IM_KEY_ID = imc.IM_KEY_ID (+);
    BEGIN
    OPEN cur_issue_version ;
    FETCH cur_issue_version BULK COLLECT INTO pv_issue_version_col ;
    CLOSE cur_issue_version ;
    END ;
    PROCEDURE get_all_issue_col_v1
    ( pv_issue_version_col OUT NOCOPY issue_version_col_t
    , pv_row_count IN number
    , pv_issuer_id IN VARCHAR2
    AS
    CURSOR cur_issue_version
    IS
    SELECT
    issue_version_t (
    SHARE_OUTST_T (so.shr_outst_amt )
    , SECURITY_T ( s.vote_per_shr
    , s.sec_cusip
    , s.PRI_MKT_EXCH_CD
    , s.IV_TYPE_CD
    , s.SEC_TICKER_SYMB )
    , ALTERNATE_ID_T (a.ALT_ID_TYPE)
    , ISSUER_T (i.ISSR_ID )
    , ISSUE_MAINT_VERSION_T (imv.im_key_id
    , imv.im_ver_num
    , imv.eff_tmstmp
    , imv.exp_tmstmp
    , imv.next_review_tmstmp
    , imv.appr_status_ref_id
    , imv.vote
    , imv.add_usr_id
    , imv.add_tmstmp
    , imv.upd_usr_id
    , imv.upd_tmstmp
    , imv.lock_level_num
    , NULL )
    , ISSUE_SHARE_MAINT_T (ism.im_key_id
    , ism.im_ver_num
    , ism.shr_outst_amt
    , ism.curr_outst_amt
    , ism.add_usr_id
    , ism.add_tmstmp
    , ism.upd_usr_id
    , ism.upd_tmstmp
    , ism.lock_level_num
    , NULL)
    , ISSUE_MAINT_COMMENT_T(imc.im_key_id
    , imc.im_ver_num
    , imc.comment_txt
    , imc.add_usr_id
    , imc.add_tmstmp
    , imc.upd_usr_id
    , imc.upd_tmstmp
    , imc.lock_level_num
    , NULL )
    FROM
    share_outst so
    , security s
    , alternate_id a
    , issuer i
    , issue_maintenance_version imv
    , issue_share_maintenance ism
    , issue_maintenance_comment imc
    WHERE
    s.sec_key_id = so.SEC_KEY_ID
    and s.SEC_KEY_ID = a.SEC_KEY_ID
    and s.MSTR_ISSR_KEY_ID = i.ISSR_KEY_ID
    and s.SEC_CUSIP = imv.SEC_CUSIP (+)
    and s.SEC_CUSIP = ism.SEC_CUSIP (+)
    and imv.IM_KEY_ID = imc.IM_KEY_ID (+);
    BEGIN
    OPEN cur_issue_version ;
    FETCH cur_issue_version BULK COLLECT INTO pv_issue_version_col ;
    CLOSE cur_issue_version ;
    END ;
    ====================
    When I execute this stored procedure thru rapid sql, I get error
    Error: ORA-06550: line 1, column 21:
    PLS-00306: wrong number or types of arguments in call to 'GET_ALL_ISSUE_VERSION_COL'
    ORA-06550: line 1, column 21:
    PL/SQL: Statement ignored, Batch 1 Line 1 Col 21
    What is that I am missing?
    Any help would be greatly appreciated.

    I've never tried Rapid SQL, but my guess is that you can't pass objects through it. I'd write a test case on the server and try it there. It looks like it should work but I didn't build a test case. If it works on the server but not in the tool, it's like the tool. OCI8 doesn't support passing instantiated objects.

  • Execute oracle stored procedure from C# always returns null

    Hi,
    I'm trying to execute a stored procedure on oracle 9i. I'm using .Net OracleClient provider.
    Apparently, I can execute the stored procedure, but it always returns null as a result (actually all the sp's I have there returns null)! I can execute any text statement against the database successfully, and also I can execute the stored procedure using Toad.
    This is not the first time for me to call an oracle stored procedure, but this really is giving me a hard time! Can anyone help please?
    Below are the SP, and the code used from .Net to call it, if that can help.
    Oracle SP:
    CREATE OR REPLACE PROCEDURE APIECARE.CHECK_EXISTENCE(l_number IN NUMBER) AS
    v_status VARCHAR2(5) := NULL;
    BEGIN
    BEGIN
    SELECT CHECK_NO_EXISTENCE(to_char(l_number))
    INTO v_status
    FROM DUAL;
    EXCEPTION WHEN OTHERS THEN
    v_status := NULL;
    END;
    DBMS_OUTPUT.PUT_LINE(v_status);
    END CHECK_CONTRNO_EXISTENCE;
    C# Code:
    string connStr = "Data Source=datasource;Persist Security Info=True;User ID=user;Password=pass;Unicode=True";
    OracleConnection conn = new OracleConnection(connStr);
    OracleParameter param1 = new OracleParameter();
    param1.ParameterName = "v_status";
    param1.OracleType = OracleType.VarChar;
    param1.Size = 5;
    param1.Direction = ParameterDirection.Input;
    OracleParameter param2 = new OracleParameter();
    param2.ParameterName = "l_number";
    param2.OracleType = OracleType.Number;
    param2.Direction = ParameterDirection.Input;
    param2.Value = 006550249;
    OracleParameter[] oraParams = new OracleParameter[] { param1, param2 };
    OracleCommand cmd = new OracleCommand("CHECK_EXISTENCE", conn);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.AddRange(oraParams);
    conn.Open();
    object result = cmd.ExecuteScalar();
    conn.Close();

    Hi,
    Does that actually execute? You're passing two parameters to a procedure that only takews 1 and get no error?
    Your stored procedure doesnt return anything and has no output parameters, what are you expecting to be returned exactly?
    If you're trying to access V_STATUS you'll need to declare that as either an output parameter of the procedure, or return value of the function, and also access it via accessing Param.Value, not as the result of ExecuteScalar.
    See if this helps.
    Cheers,
    Greg
    create or replace function myfunc(myinvar in varchar2, myoutvar out varchar2) return varchar2
    is
    retval varchar2(50);
    begin
    myoutvar := myinvar;
    retval := 'the return value';
    return retval;
    end;
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    public class odpfuncparams
         public static void Main()
          OracleConnection con = new OracleConnection("user id=scott;password=tiger;data source=orcl");
          con.Open();
          OracleCommand cmd = new OracleCommand("myfunc", con);
          cmd.CommandType = CommandType.StoredProcedure;
          OracleParameter retval = new OracleParameter("retval",OracleDbType.Varchar2,50);
          retval.Direction = ParameterDirection.ReturnValue;
          cmd.Parameters.Add(retval);
          OracleParameter inval = new OracleParameter("inval",OracleDbType.Varchar2);
          inval.Direction = ParameterDirection.Input; 
          inval.Value="hello world";
          cmd.Parameters.Add(inval);
          OracleParameter outval = new OracleParameter("outval",OracleDbType.Varchar2,50);
          outval.Direction = ParameterDirection.Output;
          cmd.Parameters.Add(outval);
          cmd.ExecuteNonQuery();
          Console.WriteLine("return value is {0}, out value is {1}",retval.Value,outval.Value);
          con.Close();
    }

  • How to execute an Stored procedure in SQLDeveloper?

    Hi
    Thank you for reading my post
    I want to know how i can execute an Stored procedure in SQL developer 1.1.0.21
    for example those sotred procedure from HR schema.
    one of them is add_job_history
    when i click on it and select run i see a new dialog with some sql as follow:
    DECLARE
      P_EMP_ID NUMBER;
      P_START_DATE DATE;
      P_END_DATE DATE;
      P_JOB_ID VARCHAR2(10);
      P_DEPARTMENT_ID NUMBER;
    BEGIN
      P_EMP_ID := NULL;
      P_START_DATE := NULL;
      P_END_DATE := NULL;
      P_JOB_ID := NULL;
      P_DEPARTMENT_ID := NULL;
      HR.ADD_JOB_HISTORY(
        P_EMP_ID => P_EMP_ID,
        P_START_DATE => P_START_DATE,
        P_END_DATE => P_END_DATE,
        P_JOB_ID => P_JOB_ID,
        P_DEPARTMENT_ID => P_DEPARTMENT_ID
    END;I checked the help and it said i should replace =>P_emp_id with some number
    I did that and i get error.
    can some one give me a sample for executing this procedure?
    thanks

    Remove the NULL values with the data you want to use in the SP.
    BEGIN
    P_EMP_ID := 32;
    P_JOB_ID := 'boss';
    For the date you have to chose the approriate string....

  • How to execute a stored procedure/function in TOAD?

    Hi, All ,
    Can someone please tell me how to execute a stored procedure/function in TOAD?
    I have tired
    EXECUTE PROCEDURENAME(888), but it doesn’t work.
    TOAD give me the error: invalid SQL statement.
    Thanks a lot

    Write PL/SQl block.
    i.e Begin
    Procedure name..
    end;
    Then it will be excuted.
    Ashutosh

  • How to execute a stored procedure with an out parameter ?

    Guys I am struggling with executing a stored procedure from sql plus.I mean my stored procedure has 2 input parameter and 1 out put parameter (status of the execution).
    MY_PROCEDURE(p_name in varchar2,p_age in number,p_status out varchar2)
    end my_procedure;
    When I say
    EXECUTE MY_PROCEDURE('manohar','Shetty');
    i get insufficient parameters errors.
    please help.

    EXECUTE isn't a valid PL/SQL construct. It's a SQL*Plus command. You don't want to put any SQL*Plus commands in a PL/SQL block.
    You can always execute a stored procedure purely through PL/SQL
    begin
      my_stored_procedure( x, y, z );
    end;SQL*Plus happens to give you the execute command so you can avoid the begin and end statements.
    Justin

Maybe you are looking for

  • How can I restore my Mac Book Pro?

    Hi, I want to restore my MacBook Pro that is running Mac OS X Lion (Version 10.7.5) It's running very slow and I want to completely restore everything like I had just bought it.. I don't have any install discs or anything. I found a youtube video tha

  • Upload file in clustered environment- Very Urgent

    Hi, My requirement is to upload a file onto the WebServer and also list out the file names on the front end and provide a funcionality to delete them from the server. Environment Details: -Product: WebSphere Portal -Type - Clustered Enviroment with 2

  • 2007 Macbook Pro 17" problem

    I have a late 2007 Macbook Pro 17", not sure how but my permissions are all screwed up and I am unable to fix them, so basically I can't use the app store to upgrade or get software updates I need.  Permission repair doesn't seem to fix them? Is ther

  • Best way to move through recordset using html buttons?

    Hi, I would like to allow users of a jsp page to be able to navigate through a recordset using buttons on the webpage. Could someone please advise on the best / easiest way to do this? Thanks, Jay

  • I installed iphoto 9.2.  When I try to create slideshow iphoto crashes.  Please Help.

    I installed iphoto 9.2.  When I try to create slideshow iphoto crashes.  Please Help.  See Crash Log: Process:         iPhoto [127] Path:            /Applications/iPhoto.app/Contents/MacOS/iPhoto Identifier:      com.apple.iPhoto Version:         9.2