I need an example of oci V7.3 to call stored procedure with IN/OUT parameters.

Hi,
I'm developing an application to access data from Oracle V7.3 using OCI. Is there a way to get the IN, OUT and IN/OUT parameters of a stored procedure from the database ? How can I execute the stored procedures dynamically, through OCI and get the data back ? Is there any sample programs ?
Any help is appreciated.
Thanks
David Lin

Since ODP.NET does not support Oracle Object type, you can not call this stored procedure directly.
You can write a wrapper procedure over the existing procedure accepting basic types, e.g. Varchar, Number, etc. and call your stored procedure after creating a object from the basic types.

Similar Messages

  • Is it possible to working in Java Stored Procedures with OCI driver?

    Hello ALL.
    Could you help me...
    Is it possible to working in Java Stored Procedures with OCI driver?
    I want to try to do some workaround...
    I need to work with following parametrs from Java Stored Procedures:
    DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
    String url = null;
    url = "jdbc:oracle:oci:@TEST";
    conn = DriverManager.getConnection (url,"scott","tiger");
    Is it possible?
    I tried but I have errors...
    Please, help me!
    Thanks

    You cannot call OCI functions directly from PL/SQL. You could, of course, write an external procedure that made OCI calls, though you could also write an external procedure in Java. I'm guessing the documentation is trying to convey this same information-- you would need an external procedure that used OCI if you wanted to use the old-school interfaces for LONG and LOB data types. If you converted to using LOBs rather than LONGs, you could do everything in PL/SQL.
    Justin

  • I need return the result of a query on a stored procedure

    I need return the result of a query on a stored procedure, I mean when I execute a stored procedure it returns a result set as a select query.
    Best regards...

    If you want some pl/sql code that can be used in a query as it were a table you may be interested in table functions:
    SQL> create or replace type
      2  t_emp is object (
      3  name            varchar2(30),
      4  hire_date date,
      5  salary       number);
      6  /
    Tipo creato.
    SQL> create or replace type
      2  t_emptab is table of t_emp;
      3  /
    Tipo creato.
    SQL> create or replace function tab_fun(p_dept in number)
      2  return t_emptab is
      3  e t_emptab;
      4  begin
      5    select t_emp(ename,hiredate,sal)
      6      bulk collect into e
      7      from emp
      8     where deptno=p_dept;
      9
    10    return dip;
    11  end;
    12  /
    Funzione creata.
    SQL> select *
      2  from table(tab_fun(20));
    NAME                           HIRE_DATE  SALARY
    SMITH                          17-DIC-80        800
    JONES                          02-APR-81       2975
    SCOTT                          09-DIC-82       3000
    ADAMS                          12-GEN-83       1100
    FORD                           03-DIC-81       3000A procedure cannot be used in a select statement.
    Max
    http://oracleitalia.wordpress.com

  • Need a procedure with in, out, in out parameters - small example.

    Hi Masters,
    Need a small example with 3 parameters in a procedure. How to know call by value and call by reference with out and inout parameters.
    create or replace procedure sample(x in number, y out number, z in out number) is
    begin
         pass the x value into y and z as well. and display the 3 values.   Code requried..
    end;
    Thanks a lot in adv.
    AR

    Hi,
    874273 wrote:
    Hi Masters,
    Need a small example with 3 parameters in a procedure. How to know call by value and call by reference with out and inout parameters.
    create or replace procedure sample(x in number, y out number, z in out number) is
    begin
         pass the x value into y and z as well. and display the 3 values.   Code requried..
    end;
    Thanks a lot in adv.
    AR
    I'm not sure I understand the question.
    In PL/SQL, the way to pass the value of x to another variable v is:
    v := x;
    Here, v can be an OUT argument or an IN OUT argument.  (It can be any kind of variable except an IN argument or a CONSTANT.)
    PL/SQL doesn't really have any way to display values.  For debugging, people often use dbms_output, like this:
    dbms_output.put_line (y || ' = y inside sample procedure');
    Many front end tools (such as SQL*Plus) can display the text after PL/SQL finishes.
    By default, all arguments in PL/SQL are passed by value.  To call by reference, use the NOCOPY hint, as shown below:
    SET SERVEROUTPUT ON;
    CREATE OR REPLACE PROCEDURE sample ( x  IN              NUMBER
                                       , y  OUT             NUMBER
                                       , z  IN OUT  NOCOPY  NUMBER
    IS
    BEGIN
         y := x;
         z := x;
         dbms_output.put_line (y || ' = y inside sample procedure');
         dbms_output.put_line (z || ' = z');
    END sample;
    SHOW ERRORS

  • Can we have an example of using update, insert, and delete stored procedure

    I would like to see an example of using retrieve (return resultset), update, insert, and delete stored procedures in JSF. I need to see syntax how JSF can call those stored procedures. This option is absolutely important when building web-application. Currently, I haven't found resource to do for this purpose yet. The database can be any such Oracle, DB2, pointbase, etc that support stored procedures.
    Anyone knows?
    Thanks,
    Tue Vu

    Hi ttv,
    I asked around a bit and here's some more info:
    To bind a ResultSet to a read only Data Table component just set the "value" property of the Data Table component to point at it, and JSF will synthesize a DataModel around it.
    * Note that because we can't call the stored procedure at design time, Creator can't do the fancy table layout stuff it does for rowsets. You'll need to hand craft the columns just like the Google Client example.
    * As I mentioned previously, you will have to manually code the stored procedure access in your java code - see the code clip I mentioned in previous reply (and if this is via a stored procedure, then any textbook about JDBC will undoubtedly have examples). Simplest way might be a getter method on the page bean that contains the call to the stored procedure and returns the resulting ResultSet object.
    * Don't forget to close the result set - we typically do this at the end of the request (i.e. add a close in the afterRenderResponse() method.
    * Don't throw exceptions - or if you have to, make sure you close the result set in a finally clause (thrown exceptions bypass the afterRenderResponse method in the lifecycle).
    * You give up on the caching provided by our RowSetDataModel (which can't be connected to a ResultSet even manually), so I would recommend that you only use datatables to display the data and then go to a single row page to do edits/deletes (similar to the TwoPage example in AppModel and the Update, Insert Delete tutorial).
    And yes please do submit an example - we will gladly post it!!! :) The best way to submit this kind of thing would be through:
    http://developers.sun.com/prodtech/javatools/jscreator/reference/codesamples/sampleapps.html
    on the right side, Related Links, under Creator Heros, click Submit Content and there you can send it in!
    Hope this helps!
    Val

  • Big overhead calling stored procedure vs query in oci program

    My previous question hasn;t got a reply. I guess I did not state it well so I rephrased it a little and repost here. Hopefully somebody can help me with this problem.
    I'm a newbie on OCI. I hope to use OCI for array DML to improve performance. It takes only 1 seconds to insert 20,000 records using the simple insert query, which is almost a miracle to me.
    Then I tested using a stored procedure. This SP does exactly the same thing as the query: Inserting into the table with the 10 parameter provided.
    However, it takes 23 seconds for 20,000 records.
    Is calling a stored procedure fundamentally slower than a query in Oci, or I just did it wrong?
    Following is the codes:
    sword Tform_1::update_all_rows(OCIEnv envhp, OCISvcCtx svchp, OCIError errhp, OCIStmt update_p, OCIStmt *select_p)
    int *intArry = new int[20000];
    for (int i = 0; i < 20000; i++)
    intArry = 50000 + i;
    // text mySql = (text ) "Insert into testPro (a, b, c, d, e, f, g, h, i, j) VALUES (:a, :b, :c, :d, :e, :f, :g, :h, :i, :j)";
    text mySql = (text ) "BEGIN\
    CDSDEVELOPER_UTILPKG.INSERTTESTPRO(:a, :b, :c, :d, :e, :f, :g, :h, :i, :j);\END;";
    ub4 prefetch = 10;
    sword errr;
    ub4 c1;
    text c2[30];
    OCIBind *bndhp;
    OCIDefine *defnp1,
    *defnp2;
    for (int i = 0; i < MAXROWS; i++)
    if (OCIDescriptorAlloc((dvoid *) envhp, (dvoid **) &(intArry),
    (ub4) OCI_DTYPE_ROWID, (size_t) 0, (dvoid **) 0))
    ShowMessage("FAILED: OCIDescriptorAlloc()\n");
    return (OCI_ERROR);
    if (OCIStmtPrepare (update_p, errhp,
    mySql, strlen(mySql), OCI_NTV_SYNTAX, OCI_DEFAULT))
    ShowMessage ("Prepare failed \n");
    return (OCI_ERROR);
    for (int k = 1; k <= 10; k++)
    if (OCIBindByPos ( update_p,
    &bndhp,
    errhp,
    k,
    intArry,
    sizeof(int),
    SQLT_INT,
    (ub2 *) 0,
    (ub2 *) 0,
    (ub4) 0,
    (ub4) 0,
    (ub4 *) 0,
    (ub4) OCI_DEFAULT))
    ShowMessage ("Bind failed \n");
    return (OCI_ERROR);
    if (errr = OCIStmtExecute(svchp,
    update_p,
    errhp,
    (ub4) MAXROWS,
    (ub4) 0,
    (OCISnapshot *) NULL,
    (OCISnapshot *) NULL,
    (ub4) OCI_DEFAULT))
    report_error(errhp);
    ShowMessage ("Update failed \n");
    return (OCI_ERROR);
    delete[] intArry;
    Can anybody tell me what is wrong? Thanks very much.
    Changsong

    Karl: Thanks a lot for your reply. I think you are right about context switch when calling a stored procedure.
    I found even wrapping a 'begin' and 'end' around the query text in the call slows down a great deal (from 1 second to 5 seconds for 20000 inserts).
    so a lot of the array binding benefits come from bulk-insert feature in oci, which is not allowed when calling a stored procedure. I've compared the performace using oci array binding to call a sp vs. traditional borland C++ builder BDE stored procedure component, and it is 23seconds vs 45 seconds. Still a lot of gain here, but compared with the bulk insert feature, I'm quite disappointed. My problem is most of the database transaction is done within some stored procedures and thus cann't take much advantage of bulk insert.
    Changsong

  • Need sample source code for calling stored procedure in Oracle

    Hi.
    I try to call stored procedure in oracle using JCA JDBC.
    Anybody have sample source code for that ?
    Regards, Arnold.

    Thank you very much for a very quick reply. It worked, but I have an extended problem for which I would like to have a solution. Thank you very much in advance for your help. The problem is described below.
    I have the Procedure defined as below in the SFCS1 package body
    Procedure Company_Selection(O_Cursor IN OUT T_Cursor)
    BEGIN
    Open O_Cursor FOR
    SELECT CompanyId, CompanyName
    FROM Company
    WHERE CompanyProvince IN ('AL','AK');
    END Company_Selection;
    In the Oracle Forms, I have a datablock based on the above stored procedure. When I execute the form and from the menu if I click on Execute Query the data block gets filled up with data (The datablock is configured to display 10 items as a tabular form).
    At this point in time, I want to automate the process of displaying the data, hence I created a button and from there I want to call this stored procedure. So, in the button trigger I have the following statements
    DECLARE
    A SFCS1.T_Cursor;
    BEGIN
    SFCS1.Company_Selection(A);
    go_Block ('Block36');
    The cursor goes to the corresponding block, but does not display any data. Can you tell me how to get the data displayed. In the future versions, I'm planning to put variables in the WHERE clause.

  • Help Needed in Creating Java Class and Java Stored Procedures

    Hi,
    Can anyone tell how can i create Java Class, Java Source and Java Resource in Oracle Database.
    I have seen the Documents. But i couldn't able to understand it correctly.
    I will be helpful when i get some Examples for creating a Java Class, Java Source and Stored Procedures with Java with details.
    Is that possible to Create a Java class in the oracle Database itself ?.
    Where are the files located for the existing Java Class ?..
    Help Needed Please.
    Thanks,
    Murali.v

    Hi Murali,
    Heres a thread which discussed uploading java source file instead of runnable code on to the database, which might be helpful :
    Configure deployment to a database to upload the java file instead of class
    The files for the java class you created in JDev project is located in the myworks folder in jdev, eg, <jdev_home>\jdev\mywork\Application1\Project1\src\project1
    Hope this helps,
    Sunil..

  • In JDBC Sender Adapter , the server is Microsoft SQL .I need to pass current date as the input column while Executing stored procedure, which will get me 10 Output Columns. Kindly suggest me the SQL Query String

    In JDBC Sender Adapter , the server is Microsoft SQL .I need to pass current date as the input column while Executing stored procedure, which will get me 10 Output Columns. Kindly suggest me the SQL Query String , for executing the Stored Procedure with Current date as the input .

    Hi Srinath,
    The below blog might be useful
    http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/03/06/executing-stored-procedure-from-sender-adapter-in-sap-pi-71
    PI/XI: Sender JDBC adapter for Oracle stored procedures in 5 days
    regards,
    Harish

  • Need an example for work flow based on multistep activity

    hi,
    i need an example for work flow based on multistep activity for practicing.please do the need.
    thanks

    Hi,
    Workflow document information:
    Check these links.
    http://www.sapgenie.com/workflow/index.htm
    /people/ginger.gatling/blog/2005/12/01/link-workflow-business-objects-to-your-collaboration-tasks
    http://help.sap.com/saphelp_nw04/helpdata/en/92/bc26a6ec2b11d2b4b5006094b9ea0d/content.htm
    http://help.sap.com/saphelp_bw33/helpdata/en/92/bc26a6ec2b11d2b4b5006094b9ea0d/content.htm
    http://help.sap.com/saphelp_bw31/helpdata/en/8d/25f94b454311d189430000e829fbbd/content.htm
    http://www.sap-press.com/product.cfm?account=&product=H950
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PSWFL/PSWFL.pdf
    http://www.workflowing.com/id18.htm
    http://www.e-workflow.org/
    http://www.sap-img.com/workflow/sap-workflow.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/a5/172437130e0d09e10000009b38f839/frameset.htm
    http://www.sap-img.com/workflow/sap-workflow.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/a5/172437130e0d09e10000009b38f839/frameset.htm
    &**********Reward points if helpful**************&

  • Need an example code for IMAP

    Hello friends,
    I need an example of IMAP using Javamail to retieve new mails from an INBOX .Pls send me an example if u have any .Or suggest me the site where i can get an example on it.

    Hi,
    I suggest to look at the demo files in the javamail package.
    I think msgshow.java is a good example.

  • Need some example of  'SET DATE MASK'.

    Hi Gurus,
    I need come example of 'SET DATE MASK ' & 'SET TIME MASK'.
    Thanking you.
    Subash

    Hi Subasha,
    / : SET DATE MASK = 'MMMM DD, YY'
    This displays the date as : September 26, 07.
    YY Year (2 digits)
    YYYY Year (4 Digits)
    MM Month (2 Digits)
    MMM Month Name (Abbreviated)
    MMMM Month Name (Full)
    DD Day as two digits
    DDD Day name (Abbreviated)
    DDDD Day name
    Using the SET DATE MASK causes the subsequent date fields to be displayed using the same formatting. To return to the default formatting use the following command:
    /: SET DATE MASK = ' '
    /: SET TIME MASK = 'HH hrs MM min SS sec'
    This displays the time as : 11 hrs 43 min 37 sec'
    The following are the codes that can be used in the time mask:
    HH Hours
    MM Minutes
    SS Seconds
    The time formatting can be reset to the default setting using:
    /: SET TIME MASK = ' '

  • Need an example of AS3 to duplicate form

    I have been trying to solve this problem for 4 days to no avail. The entire site is done with the exception of this one hangup. I need to have 2 email forms on 2 different places in the timeline going to 2 different addresses. I have the PHP for both, but am having problems getting the 2nd form to function.
    When I try to reuse the same code for the 2nd email, I get a load of errors regarding duplicate functions.
    Can anybody edit, copy and paste an example of the following script (the one that works with the first form).  I believe can figure out the instance name changes, etc. if I have something to work with.
    I am a total newbie and don't know a thing about AS3 and I have a hard time understanding the explanations.  I just need a script that won't conflict with the first form as duplicating functions etc.  Thanks (PS: The string in red is for the 1st email form. I also have a PHP file "send_email_02.php" for the 2nd email form.
    stop();
    contact_name.text = contact_email.text = contact_subject.text =
    contact_message.text = message_status.text = "";
    send_button.addEventListener(MouseEvent.CLICK, submit);
    reset_button.addEventListener(MouseEvent.CLICK, reset);
    var timer:Timer;
    var var_load:URLLoader = new URLLoader;
    var URL_request:URLRequest = new URLRequest( "send_email.php" );
    URL_request.method = URLRequestMethod.POST;
    function submit(e:MouseEvent):void
    if( contact_name.text == "" || contact_email.text == "" ||
      contact_subject.text == "" || contact_message.text == "" )
      message_status.text = "Please complete all text fields.";
    else if( !validate_email(contact_email.text) )
      message_status.text = "Please enter a valid email address.";
    else
      message_status.text = "sending...";
      var email_data:String = "name=" + contact_name.text
            + "&email=" + contact_email.text
            + "&subject=" + contact_subject.text
            + "&message=" + contact_message.text;
      var URL_vars:URLVariables = new URLVariables(email_data);
      URL_vars.dataFormat = URLLoaderDataFormat.TEXT;
      URL_request.data = URL_vars;
      var_load.load( URL_request );
      var_load.addEventListener(Event.COMPLETE, receive_response );
    function reset(e:MouseEvent):void
    contact_name.text = contact_email.text = contact_subject.text =
    contact_message.text = message_status.text = "";
    function validate_email(s:String):Boolean
    var p:RegExp = /(\w|[_.\-])+@((\w|-)+\.)+\w{2,4}+/;
    var r:Object = p.exec(s);
    if( r == null )
      return false;
    return true;
    function receive_response(e:Event):void
    var loader:URLLoader = URLLoader(e.target);
        var email_status = new URLVariables(loader.data).success;
    if( email_status == "yes" )
      message_status.text = "Success! Your message was sent.";
      timer = new Timer(500);
      timer.addEventListener(TimerEvent.TIMER, on_timer);
      timer.start();
    else
      message_status.text = "Failed! Your message was not sent.";
    function on_timer(te:TimerEvent):void
    if( timer.currentCount >= 10 )
      contact_name.text = contact_email.text = contact_subject.text =
      contact_message.text = message_status.text = "";
      timer.removeEventListener(TimerEvent.TIMER, on_timer);

    There are several ways to do this. The way that I like best is using a User Setting.
    1) Pick a name for your setting.
    2) Enter the name of the setting in the web service configuration for the two (or more) web services that want to share the setting. Any portlet that needs to "see" the setting must have it specified its web service configuration.
    3) When a user clicks on a link in one of your portlets, set the setting: IPortletResponse.SetSettingValue(SettingType.User, "settingName", "settingValue")
    4) In another portlet, get the setting and display it: IPortetRequest.GetSettingValue(SettingType.User, "settingName")
    The nice thing about doing it this way is that even if your portlets are set to be cached "forever," they will change whenever you change the user setting (assuming you followed step 2).
    Hope this helps,
    Chris Bucchere
    [email protected]
    Bucchere Development Group
    http://www.bucchere.com| 415.516.3941

  • Need JNDI example for THIN CLIENT

    I ned a JNDI example for a thin client (as opposed to a java program connecting on the same machine as the server).
    1> Specifically, I need an example of a JNDI Provider URL
    Would it be <b>corbaloc.iiop:<host>:5004   ???</b>
    2> Also, how do I create a Queue Connection factory from within the GUI (Visual Administrator), so I can find out what to use on the THIN CLIENT Program?
    Thanks

    Hi,
    Please find the answers below.
    > I ned a JNDI example for a thin client (as opposed to
    > a java program connecting on the same machine as the
    > server).
    >
    > 1> Specifically, I need an example of a JNDI Provider
    > URL
    >
    > Would it be <b>corbaloc.iiop:<host>:5004   ???</b>
    Have a look at <a href="http://help.sap.com/saphelp_nw04/helpdata/en/08/8f633e0084e946e10000000a114084/frameset.htm">this</a> link.
    > 2> Also, how do I create a Queue Connection factory
    > from within the GUI (Visual Administrator), so I can
    > find out what to use on the THIN CLIENT Program?
    Have a look at <a href="http://help.sap.com/saphelp_nw04/helpdata/en/26/9b569f525445b0b3d66474b7569d39/frameset.htm">this</a> link.
    > Thanks
    Hope that helps,
    Vladimir

  • I need an example of JSR179 implementation for CDC based device

    Actually i am trying to develop an LBS(Location based Service) application for Pocket PC that is a CDC based Device,
    I searched a lot on internet for any example that could help me but could't found anything usefull information.
    I found a lot of stuff for MIDP, i found JSR179 implementation for MIDP but could't found anything for CDC(Connected Device Configuration).
    So i need an example of JSR179 implementation for CDC based device. I really need it.
    waiting for your help....
    thanx
    Vivek Mishra

    What is it from a business perspective that you are trying to accomplish?
    What are you going to do with this data once you get it into the format you're envisioning?
    Are you anticipating creating a collection of REC_SET records? Is there a reason that you're not using an associative array keyed on the c2 value (assuming collections are even appropriate to the problem you're trying to solve)?
    Justin

Maybe you are looking for

  • Preview crashing with large photos on iMac 5K

    Not sure if this is a Yosemite Beta (10.10.3 - 14D105g) problem, or if it's the base model iMac 5K, but when I try and view these 'High resolution comparisons: Canon 5DS R vs the world' that I downloaded, either Preview crashes or my machine reboots.

  • Messages not working properly in Mountain Lion?

    Hi and thanks for reading. I am writing because while I instantly receive my iMessages on both my iPhone and iPad, it happens only sometimes on my MAC running Lion Mountain. Even if I launch the iMessage apps it does not receive anything until I star

  • Using Subroutines in SAP script

    Hi Experts, I am trying to get value of Z variables from a subroutine pool program using Perform ... EndPerform in my sap script form. In my form window i have written PERFORM ITEM_LINE_2F IN PROGRAM ZMEPRINTFORMS USING &EKPO-MENGE& CHANGING &V_EKPO_

  • 5508 Guest Anchor 7.4MR2

    We are upgrading all Foreign 5508 WLC's to 7.4MR2.  Out Guest Anchor is currently on 7.0.235.  Any reason not to upgrade the Guest Anchor to 7.4MR2?  Has anyone encountered any issues doing this?  We are not having any issues on 7.0, and I just did n

  • Java Help with ...conversion?

    I've got to make sure that the answer is an integer, this is what I have: import java.util.Scanner; public class Homework622a           public int temp2Celcius()           Scanner input = new Scanner(System.in);           int tempf;                do