How to Access the Return Value of a Function

Hi,
How do I access the return value when calling an Oracle function from .NET using Oracle.DataAccess.Client? The function returns an integer of 0, 1 or 99.
Dim db_command_oracle As New OracleCommand()
db_command_oracle.Connection = db_connection_oracle
db_command_oracle.CommandType = CommandType.StoredProcedure
db_command_oracle.CommandText = "swsarsi.import_appointments"
Dim ret_value As New OracleParameter()
ret_value.OracleDbType = OracleDbType.Int32
ret_value.Direction = ParameterDirection.ReturnValue
ret_value.Size = 2
ret_value.OracleDbType = OracleDbType.Int32
db_command_oracle.Parameters.Add(ret_value)
Dim IN_student_id As New OracleParameter()
IN_student_id.OracleDbType = OracleDbType.Varchar2
IN_student_id.Direction = ParameterDirection.Input
IN_student_id.Size = 10
IN_student_id.Value = student_id
db_command_oracle.Parameters.Add(IN_student_id)
db_command_oracle.ExecuteNonQuery()
messagebox.show(ret_value) ?????

Your ODP.NET code looks correct. What error are you seeing?
One thing that will definitely generate an error is that .NET message boxes require that strings be displayed. ret_value is a parameter object. You need to access its value and convert it to a string. At a minimum, you need to change that.

Similar Messages

  • How to display the return value of a function in a text field

    Hi,
    I have 2 textfields in a page.
    i> Empno
    ii> Salary
    The requirement is,
    i. Enter an Employee No.
    ii. On click of the 'SUBMIT' button a process would be executed which calls a function (or procedure with out parameter) which returns the Salary of the given Employee.
    iii. Need to display the salary to the 2nd textfield (Salary).
    Here is my process:
    i. If procedure call-- :P2_X is a page text field and out parameter.
    begin
    Pri_test_PROC(:P2_EMPNO,:P2_X);
    end;ii. If Function call --
    begin
    :P2_X:=Pri_test_PROC(:P2_EMPNO);
    end;
    Issue:
    The process is not getting executed and returning the process error message.
    Could anyone please give me a pointer, how to overcome the issue. Or if this is not the right way, then what is the work around.
    Regards
    Antara

    Antara,
    1. Clue about the error - yes, when I see the error message.
    2. What happens if you try to create a procedure like this:
    CREATE OR REPLACE PROCEDURE fetch_sal (in_emp IN NUMBER, out_sal OUT NUMBER)
    IS
    BEGIN
       FOR c IN (SELECT sal
                   FROM emp
                  WHERE empno = in_emp)
       LOOP
          out_sal := c.sal;
       END LOOP;
    END;and then run this in SQL Plus:
    DECLARE
       v_sal   VARCHAR2 (20);
    BEGIN
       fetch_sal (7839, v_sal);
       DBMS_OUTPUT.put_line (v_sal);
    END;What do you get displayed?
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • How to get the return values from a web page

    Hi all :
       how to get the return values from a web page ?  I mean how pass values betwen webflow and web page ?
    thank you very much
    Edited by: jingying Sony on Apr 15, 2010 6:15 AM
    Edited by: jingying Sony on Apr 15, 2010 6:18 AM

    Hi,
    What kind of web page do you have? Do you have possibility to for example make RFCs? Then you could trigger events (with parameters that could "return" the values) and the workflow could react to those events. For example your task can have terminating events.
    Regards,
    Karri

  • How to get the return value of a LOV item using javascript

    Hello,
    I am trying to put an onchange attribute in the HTML Form Element Attributes field of a LOV item. The javascript should access the new return value of the item. How is this done ? All the methods I have tried give only the display value, not the return value. For example $v() returns the display value.
    Tiina

    If your item is called P1_ITEM this will give you the return value of a popup (displays description,returns key value)
    alert($x('P1_ITEM_HIDDENVALUE').value)
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • How to store the return value from a select list in page item ?

    I'm sorry, I'm sure you will all flame me for this (and its long too :-(. I'm still trying to pick this up and havn't had time to read manual and this forum and up against the clock (as usual), but this must be something thats simple to do, otherwise why have 2 cols on LOV (display text and return value.
    normal kind of thing - master /detail, a master table and a detail table, master.id is PK in master, master.name is the name of the master item. detail.id is pk in detail, detail.mid is foreign key to master.id. I have a tabular report that displays a join of cols from master and detail, with 2 cols being links, one is a link on master.name, that passes master.id to page P1 and it displays a row from master. The other col displays detail.name and passes detail.id to page P3, P3 displays a row of the detail table.
    I want to populate a LOV with possible master.name values, but display the name of the current P3_MID value (from detail.mid). Then a user can pick a different master and it needs to update P3_MID so on submit it updates the row.
    I just can't seem to see in the manual how you can specify where the return value on a LOV goes?
    As I said, sorry for long post and not having had time to read docs correctly - someone just point me at the subject matter somewhere, please.

    Sorry, I was trying to be to complex and obviously APEX is just too damn cleaver - I figured out how this works - basically APEX pulls the LOV and then matchs the mid to it to display the correct name - simple and easy - just me making it difficult

  • How to pass the return value?

    when i call another procedure in a different vi file(xxx.sql), how am i going to pass the return value that the end user key in?
    how to Promt the message and accept the value that keyed in?
    Please help...
    this is urgent!
    Thank you.

    Use OUT paramter to pass values from called procedure.
    You can pass the values as IN / IN OUT / OUT
    parameters.
    For sample coding please mail
    null

  • How to Change the return value for the parameters

    Hi, Can anyone help me with my problem?
    I have a parameter called "P1_Projects" defined in the HTMLDB page, on the report region, there are 2 buttons, one is "Go" button to submit the report on the screen, so user can preview the report, then another button "Export to PDF" can be clicked to generate the report using Oracle Report Services. The "Export to PDF" button will use the same set of parameters submitted for the "Go" button.
    So, the parameter "P1_Projects" is being used by these 2 buttons. and I have to pass a "%" wild card for "All Projects". To make the "Export to PDF" button work, I have to safe encode the return value for "%" to "%25" in order to pass the URL formula, but now my "Go" button doesn't work with "%25", it only recognize the "%" wild card.
    Is there a way to conditionally change the value depends which button is clicked?
    Any hint or help is highly appreciated!
    Hong

    try creating a plsql process which sets the P1_Projects item as required.
    in the plsql you can do:
    if :REQUEST = 'GO' then
    xxx
    else
    xxxx
    end if;
    set the condition to plsql expression:
    :REQUEST in ('GO', 'EXPORT')
    NB. the request value is usually set to the button name when a page is submitted from a button

  • How to set the returned value of CFL in a matrix

    dear all,
    I got a matrix binded to a DataSource and two CFLs are in this matrix. The codes for handling AfterChooseFromList is as following.  It works almost fine. But when a docoment containing more than two
    rows in the matrix and I reselect the CFL cell values more than two times, an error occured sometimes, not everytime. The error message is "This entry already exists in the following tables @CYW_PRROW [Message 131-183]"
    I have tried to find out what kind of situation to cause this error, but still in the mud.
    Can anybody give me some suggestion? Thanks.
    Public Sub OnAfterChooseFromList_Matrix(ByVal pVal As SAPbouiCOM.ItemEvent)
            Dim ActionSuccess As Boolean = pVal.ActionSuccess
            Dim oform As SAPbouiCOM.Form = SBO_Application.Forms.Item(pVal.FormUID)
            Dim oitem As SAPbouiCOM.Item = oform.Items.Item("mtx_0")
            Dim omatrix As SAPbouiCOM.Matrix = CType(oitem.Specific, SAPbouiCOM.Matrix)
            Dim oDataTable As SAPbouiCOM.DataTable
            oDataTable = pVal.SelectedObjects
            Dim val As String
            Try
                val = oDataTable.GetValue(0, 0)
            Catch ex As Exception
            End Try
            omatrix.GetLineData(pVal.Row)
            oform.DataSources.DBDataSources.Item("@CYW_PRROW").Offset = pVal.Row - 1
            If pVal.ColUID = "col_0" Then
                Try
                    oform.DataSources.DBDataSources.Item("@CYW_PRROW").SetValue("U_PRItemCode", pVal.Row - 1, CStr(val))
                Catch ex As Exception
                    SBO_Application.MessageBox(ex.Message)
                End Try
            Else
                Try
                    oform.DataSources.DBDataSources.Item("@CYW_PRROW").SetValue("U_PRSupp", pVal.Row - 1, CStr(val))
                Catch ex As Exception
                    SBO_Application.MessageBox(ex.Message)
                End Try
            End If
            omatrix.SetLineData(pVal.Row)
            If pVal.FormMode = "1" Then
                oform.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE
            End If
        End Sub
    Another quesion, can I assign the returned value of CLF directly to the cell?

    Hello  Chao-Yi Wu,
    I don't have a real solution for you - just a few comments:
    1. At
            Try
                val = oDataTable.GetValue(0, 0)
            Catch ex As Exception
            End Try
    I would add
            Try
                if oDataTable Is Nothing Then Exit Sub ' If the User cancels the CFL
                val = oDataTable.GetValue(0, 0)
            Catch ex As Exception
            End Try
    2. At
       If pVal.ColUID = "col_0" Then
    I would make the branch by the pVal.ChooseFromListUID instead of the ColUID
    and the 2nd not with "Else" but with "Else If ....."
    3. It may work with EditText.String/Value of a cell but I never do that because of performance-reasons.
    I always do it the same way as you in principle - I don't really know what the problem is.
    4. Maybe some unique indexes on your table (although this should give an error at the update and not at CFL when "the unique-law is broken"...)?
    Sorry - that's all for the moment.
    Cheers,
    Roland

  • How to get the return value of a method

    hi there
    here is the code i write a method
    public void time(int x,int y){
    int xx;
    int yy;
    xx++;
    yy++;
    x=xx;
    y=yy;
    i want to use the return value of x and y at another place,who can tell if it is possible. thank u very much

    You declare the return type of the method, and then use the return keyword to return a value which you can assign to a variable.
    As the other respondent said, you cannot return more than one value from a function. If you need to return two related values, you may want to enclose them in a class and return an instance of that class. For instance:
    class TimeValue {
       final int x;
       final int y;
    public TimeValue(int x, int y) {
       this.x = x;
       this.y = y;
    }Then your method could create a new TimeValues and return it:
    public TimeValue time(int x,int y){
       int xx = x;
       int yy = y;
       ++xx;
       ++yy;
       return new TimeValue(xx, yy);
    }

  • How to catch the return value of ldap- bind?

    For net::ldap,
    my $ldap = Net::LDAP->new( .. );
    $ldap->bind($DN,$password);
    if the bind failed, what's the returned value for this?
    Many examples I read suggested "undef" is returned, but looks like it's not the case on Sun Solaris.
    Marg8

    somehow "undef" is not returned.
    for ldap->bind($DN,$password) or die "can't bind";
    it always continue no matter what DN or password you put in.
    So looks to me it returned something else.
    Marg8

  • How to read the return values of the API call

    Hi Friends,
    I am trying to access an image on DocumentMall and I am passing the following URL to login to DocumentMall in my ABAP program.
    https://beta-dmapi.documentmall.com/dmapi/login.do?account=NOBLEBETA&appid=39xxxxxxn&username=admin&password=pasxxxxx
    This will inturn return the Session ID as shown below.
    errorcode=0
    sessionid=ae820d5e-a0e9-4d50-ba3e-e2b41ffd3053
    Can you tell me how to capture the session ID in ABAP.
    thanks
    Krishna

    How are you calling it?  Using HTTP_CLIENT?  If so, use the methods of the response object to get the header or body fields.

  • How to pass the property value to getter function

    In jsp, I have a select box,like this:
    <html:select property="chooseType" styleId="chooseType" onchange="javascript:checkType()">
    <html:option value="Type1">Type1</html:option>
    <html:option value="Type2">Type2</html:option>
    <html:option value="Type3">Type3</html:option>
    </html:select>
    javascript, I use document.getElementById("chooseType").value="Type3";
    however, i form.java file, using getChooseType(), I could not get the value "Type3". If I do not set the value by javascript, I just select "Type3" from GUI, value "Type3" is passed properly to the getter.
    How to pass the value,set in javascript to getter?
    Edited by: [email protected] on Nov 17, 2009 4:23 PM

    I just found it is caused by the following code.
    javascript, I use document.getElementById("chooseType").disabled=true;
    So if I disable the select box, the value can not be passed to form. How to disable the select box but still pass the value to form?
    Edited by: [email protected] on Nov 17, 2009 11:56 PM

  • How to get the return when use this function ----- getUsersInGroup()

    how do we assign list of nodes that getUsersInGroup() returns? And how do we get the result of the returns? And where is the groups and users config files? I am attempting notifications to all users in a group. Thank you!!

    Why do you want to do that, you cannot attach a VO which is not present in the AM. Can you elaborate on your requirement.

  • How to get the returned value from Functions with Callable statement?

    I was glad to find that stored procedures can be invoke with Java class code by the object of Callable statement like :
    String stmt = "BEGIN departments_pkg.do_select(?,?,?); END;";
    and getting the output variables by
    populateAttribute(DEPARTMENTNAME,st.getString(2),true,false);
    But i would like to get values returned from FUNCTION other than stored procedure, how can i achieve it? Thanks a lot!

    Here is  my code
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_1202.
      MODULE subscreen_find.
      CALL SUBSCREEN SUBSEARCH INCLUDING sy-cprog dynnr.
    PROCESS AFTER INPUT.
      MODULE USER_COMMAND_1202.
      CALL SUBSCREEN SUBSEARCH.
    MODULE subscreen_find.
      case sy-ucomm.
        when 'SELECTED'.             "fcode
          case 'ZSKILL_SEARCH'.     "data element
            when '01'.                       " value range
              dynnr = 0110.
            when '02'.
              dynnr = 0111.
          endcase.
      endcase.
    ENDMODULE.
    kindly tell me what is wrong
    Edited by: Raji Thomas on Feb 8, 2010 10:20 AM

  • Please:How to repeat the return values multiple times in sapscript

    Currently my subroutine is returning a value called TOQBSSHB single time and i am working with standard layout called RFFOUS_C.Please can anybody tell me if i want to show multiple times TOQBSSHB for different values of VBLNR .Is it possible if it is what are changes i should make on layout and subroutine.
    PERFORM EXTRACT IN PROGRAM Y_MIT_TEST2
    USING &REGUH-VBLNR&
    USING &REGUH-NAME1&
    CHANGING&TOTQBSHB&
    ENDPERFORM
    FORM EXTRACT TABLES IN_PAR STRUCTURE ITCSY OUT_PAR STRUCTURE ITCSY.
    TABLES : REGUP,BSEG,REGUH,REGUD.
      DATA : BILL_NO LIKE REGUH-VBLNR.
      DATA : ITAB LIKE REGUP OCCURS 0 WITH HEADER LINE.
      DATA : JTAB LIKE REGUP OCCURS 0 WITH HEADER LINE.
      DATA : BELNR1 LIKE ITAB-BELNR.
      DATA : QBSHB1 LIKE REGUD-SWNES.
      DATA : QBSHB2 LIKE REGUD-SWNES.
      DATA : TOTOQBSHB LIKE REGUD-SWNES.
      READ TABLE IN_PAR WITH KEY NAME = 'REGUH-VBLNR'.
      IF SY-SUBRC = 0.
       BILL_NO = IN_PAR-VALUE.
      ENDIF.
    SELECT * FROM REGUP INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE VBLNR
    = BILL_NO.
      READ TABLE ITAB INDEX 1.
      IF SY-SUBRC = 0.
      MOVE ITAB-QBSHB TO QBSHB1.
      MOVE ITAB-BELNR TO BELNR1.
      ENDIF.
    SELECT * FROM BSEG INTO CORRESPONDING FIELDS OF TABLE JTAB WHERE BELNR
    = BELNR1.
      LOOP AT JTAB.
      READ TABLE JTAB INDEX SY-TABIX.
      IF SY-SUBRC = 0.
      QBSHB2 = QBSHB2 + JTAB-QBSHB.
      ENDIF.
      ENDLOOP.
      TOTOQBSHB = QBSHB1 + QBSHB2.
      READ TABLE OUT_PAR WITH KEY NAME = 'TOTQBSHB'.
      IF SY-SUBRC = 0.
      MOVE TOTOQBSHB TO OUT_PAR-VALUE.
      MODIFY OUT_PAR INDEX SY-TABIX.
      ENDIF.
    ENDFORM.

    I said :
    - A) you should copy the main program without to copy
         includes, so when the systems ask you which objects
         you want to copy: check all excluding INCLUDES.
    So you'll have a new program which uses the same includes of the standard program.
    - B) in your z-program you find the point where you should insert your code: you'll have two cases:
    - you should insert code in a point that is writen in z-program;
    - you should insert code in a point (for example a form) that isn't write in z-program, but in a standard include your z-program use.
    In first case you only write your code, in second one before you should copy the include, than insert it in your z-program and so insert your code in the include.
    For example:
    - A) Copy RFFOUS_C in ZRFFOUS_C
    - B) I should change the code of routine  
         SCHECKDATEN_EINGABE, it's defined in RFFORI01, so I copy it in ZRFFORI01, insert my code in it.
    - C) found where my z-program call include RFFORI01:
    subroutines for check print and prenumbered checks                  *
      INCLUDE RFFORI01.
    now replace this with the call to my new include:
      INCLUDE RFFORI01.
      INCLUDE ZRFFORI01.
    If you do in this way you copy only includes where you should change the code.
    Message was edited by: max bianchi
    Message was edited by: max bianchi

Maybe you are looking for