How to get multiple out parameters from a pl/sql stored procedure in ADF Jdeveloper 11g release2

I´m trying to call from AppModuleImpl a stored procedure from my oracle DB which receives one input parameter and returns 5 out parameters. 
I´m using jdeveloper 11g release2  ADF and I have created a java bean "ProRecallPlatesBean " with the atributes and accesors and I serialize it. just like in this article http://docs.oracle.com/cd/E24382_01/web.1112/e16182/bcadvgen.htm#sm0297
This is my code so far:
public ProRecallPlatesBean getCallProRecallPlates(String numPlates) {
CallableStatement st = null;
try {
          // 1. Define the PL/SQL block for the statement to invoke
          String stmt = "begin CTS.Pk_PreIn.proRecallPlates(?,?,?,?,?,?); end;";
          // 2. Create the CallableStatement for the PL/SQL block
          st = getDBTransaction().createCallableStatement(stmt,0);
          // 3. Register the positions and types of the OUT parameters
          st.registerOutParameter(2,Types.VARCHAR);
st.registerOutParameter(3,Types.VARCHAR);
st.registerOutParameter(4,Types.VARCHAR);
st.registerOutParameter(5,Types.VARCHAR);
st.registerOutParameter(6,Types.VARCHAR);
// 4. Set the bind values of the IN parameters
st.setString(1,numPlates);
// 5. Execute the statement
st.executeUpdate();
// 6. Create a bean to hold the multiple return values
ProRecallPlatesBean result = new ProRecallPlatesBean();
// 7. Set values of properties using OUT params
result.setSpfVal(st.getString(2));
result.setTransportTypeVal(st.getString(3));
result.setTransportCompanyVal(st.getString(4));
result.setCompanyDescrVal(st.getString(5));
result.setDGAPrint(st.getString(6));
// 8. Return the result
return result;
} catch (SQLException e) {
throw new JboException(e);
} finally {
if (st != null) {
try {
// 9. Close the JDBC CallableStatement
st.close();
catch (SQLException e) {}
In Jdeveloper I went into AppModule.xml JAVA>Client Interface section and expose "getCallProRecallPlates" Then I can see "getCallProRecallPlates" in Data Controls, I drag and drop it to a JSF page, an input text component and a button are generated in order to put in there the procedure input parameter (numPlates).
I don't know if I'm on the right track.
When I click the button, the "result" variable is supposed to be filled with data from the stored procedure. I want each of those values to be displayed in Output text or input text adf components but I dont know how. Thank you very much in advance I´m a newbie and i'll appreciate your help!

What version are you on?
Works fine for me on my 11g:
SQL> create or replace procedure testxml (clob_out out clob)
  2  is
  3     l_clob   clob;
  4     l_ctx    dbms_xmlquery.ctxhandle;
  5  begin
  6     l_ctx := dbms_xmlquery.newcontext ('select * from dual');
  7     l_clob := dbms_xmlquery.getxml (l_ctx);
  8     clob_out := l_clob;
  9     dbms_xmlquery.closecontext (l_ctx);
10  end testxml;
11  /
Procedure created.
SQL>
SQL> variable vout clob;
SQL>
SQL> exec testxml (:vout)
PL/SQL procedure successfully completed.
SQL>
SQL> print vout
VOUT
<?xml version = '1.0'?>
<ROWSET>
   <ROW num="1">
      <DUMMY>X</DUMMY>
   </ROW>
</ROWSET>But definitely you can optimize your proc a bit: Try
create or replace procedure testxml (clob_out in out nocopy clob)
is
   l_ctx    dbms_xmlquery.ctxhandle;
begin
   l_ctx := dbms_xmlquery.newcontext ('select * from dual');
   clob_out := dbms_xmlquery.getxml (l_ctx);
   dbms_xmlquery.closecontext (l_ctx);
end testxml;
/

Similar Messages

  • How to get list of parameters or arguments for a stored procedure

    Hi,
    Is there a way we can get the list of arguments or parameters for a stored procedure through Data Dictionary?
    I mean the way oracle has Meta Data tables like user_tables/dba_tables, user_triggers/dba_triggers through which we can get information about tables, triggers etc, in the same way is there a way in oracle so that we can get information about a procedure like what kind of arguments need to be passed, are they IN or OUT parameters, and what is their Data Types?
    I could find there is one View dba_procedures, but it does not give any information about the arguments a procedure takes.
    Thanks,
    Makrand
    Thansk

    or
    SQL> desc Raisesal ;
    PROCEDURE Raisesal
    Argument Name                  Type                    In/Out Default?
    ID                             NUMBER(4)               IN
    PERCENT                        NUMBER                  IN

  • How to get the selection parameters from logical database into one of the t

    Hi Sap ABAP Champians,
    How to get the selection parameters from logical database into one of the tab in the tabstrip selection-screen.
    Please help me for this
    Thanks
    Basu

    Hi
    Thanks, that will work, but then I'll have to insert code into all my reports.
    I can see that "Application Server Control Console" is able to rerun a report.
    This must mean that the Report Server has access to the runtime parameters.
    But how?
    Cheers
    Nils Peter

  • How to get multiple records using fn-bea:execute-sql()

    Hi,
    I created Proxy service(ALSB3.0) to get records from DB table. I have used Xquery function(fn-bea:execute-sql()). Using simple SQL query I got single record, but my table having multiple records. Please suggest how to get multiple records using fn-bea:execute-sql() and how to assign them in ALSB variable.
    Regards,
    Nagaraju
    Edited by: user10373980 on Sep 29, 2008 6:11 AM

    Hi,
    Am facing the same issue stated above that I couldnt get all the records in the table that am querying in the Proxyservice.
    For example:
    fn-bea:execute-sql('EsbDataSource', 'student', 'select Name from StudentList' ) is the query that am using to fetch the records from the table called StudentList which contains more than one records like
    Id Name
    01 XXX
    02 YYY
    03 ZZZ
    I tried to assign the result of the above query in a variable and while trying to log the variable, I can see the below
    <student>
    <Name>XXX</Name>
    </student>
    I want to have all the records from my table in xml format but it's not coming up. I get the value only from the first row of my table.
    Please suggest.
    regards,
    Venkat

  • How to get second maximum salary from employee table(sql query)

    how to get second maximum salary from employee table(sql query)

    dude there is no matter of structure .........that user already said its from employee table ...............its basic table in sql and there is no need to specify the table structure
    .........i think u got my point I think you are the one who didn't understand Sarma's point.
    Give a man a fish and you feed him once. Teach a man how to fish and you feed him a life long.
    >
    and the query is
    select max(sal) from emp where sal<(select max(sal)
    from emp);
    this will give the 2nd max salary from the emp tableBtw: You solution is bad, because it needs to scan and sort the table emp twice. And a better solution has been given already.
    Message was edited by:
    Sven W. - reordered statements

  • Passing parameters from Excel to SQL stored proc. to analyse resultset in PowerPivot

    Hi,
    Not sure if I posted this question at the right forum ...
    I would like to implement the following scenario:
    - Enter parameters @startdate and @enddate in cells in an Excel worksheet (i.e. cell A2 has the value for the startdate parameter; cell B2 has the value for the endate parameter).
    - Pass these parameters to a SQL stored procedure (using MSQuery?). See below.
    - Calling stored procedure in PowerPivot to get the resultset in PowerPivot.
    The SP calls some functions in SQL Server. See below.
    I have read several posts on several forums but I can't get the parameters from Excel (MSQuery?) to the SP.
    What's the best way to have PowerPivot picking up the resultset from the SP?
    How do I get the Excel cells A2 and B2 to the SP below?
    SP:
    USE [Test]
    GO
    /****** Object: StoredProcedure [dbo].[_Pink_SP_CapaciteitTest] Script Date: 29-7-2014 15:41:04 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[_Pink_SP_CapaciteitTest]
    @startdate DATETIME,
    @enddate DATETIME
    AS
    BEGIN
    SET NOCOUNT ON
    SET DATEFIRST 1
    DECLARE @TempCapacity TABLE
    ResourceNo INT,
    ResourceName NVARCHAR(60),
    JobCode NVARCHAR(12),
    JobDescription NVARCHAR(50),
    CostcenterCode NCHAR(8),
    CostcenterDescription NVARCHAR(50),
    CostcenterClass NVARCHAR(30),
    CostcenterClassDescription NVARCHAR(60),
    Date DATETIME,
    Weekday INT,
    WeekNo INT,
    Month INT,
    Year INT,
    Capacity FLOAT,
    ConsultancyTot FLOAT,
    ConsultancyTotReserved FLOAT,
    Sick FLOAT,
    Doctor FLOAT,
    Pregnant FLOAT,
    Vacation FLOAT,
    VacationCancellation FLOAT,
    SpecialLeave FLOAT,
    CompHours FLOAT,
    Support FLOAT
    INSERT INTO @TempCapacity
    SELECT h.res_id AS ResourceNo,
    h.fullname AS ResourceName,
    h.job_title AS JobCode,
    j.descr50 AS JobDescription,
    h.costcenter AS CostcenterCode,
    cc.oms25_0 AS CostcenterDescription,
    ccc.CostcenterClassCode AS CostcenterClass,
    ccc.Description AS CostcenterClassDescription,
    CONVERT(VARCHAR(10), t.datum, 105) AS [Date],
    DATEPART(DW, t.datum) AS [Weekday],
    (SELECT [dbo].[ISOWeekNumber] (t.datum)) AS WeekNo,
    MONTH(t.datum) AS [Month],
    YEAR(t.datum) AS [Year],
    (SELECT ROUND([dbo].[HRCapacityHours] (h.res_id, t.datum, t.datum), 2)) AS Capacity,
    (SELECT ISNULL([dbo].[HRAbsenceHours] (50, h.res_id, t.datum, t.datum + 1), 0)) AS ConsultancyTot,
    (SELECT ISNULL([dbo].[HRAbsenceHours] (51, h.res_id, t.datum, t.datum + 1), 0)) AS ConsultancyTotReserved,
    (SELECT ISNULL([dbo].[HRAbsenceHours] (9538, h.res_id, t.datum, t.datum + 1), 0)) AS Sick,
    (SELECT ISNULL([dbo].[HRAbsenceHours] (8531, h.res_id, t.datum, t.datum + 1), 0)) AS Doctor,
    (SELECT ISNULL([dbo].[HRAbsenceHours] (9924, h.res_id, t.datum, t.datum + 1), 0)) AS Pregnant,
    (SELECT ISNULL([dbo].[HRAbsenceHours] (8501, h.res_id, t.datum, t.datum + 1), 0)) AS Vacation,
    (SELECT ISNULL([dbo].[HRAbsenceHours] (8551, h.res_id, t.datum, t.datum + 1), 0)) AS VacationCancellation,
    (SELECT ISNULL([dbo].[HRAbsenceHours] (8511, h.res_id, t.datum, t.datum + 1), 0)) AS SpecialLeave,
    (SELECT ISNULL([dbo].[HRAbsenceHours] (9518, h.res_id, t.datum, t.datum + 1), 0)) AS CompHours,
    (SELECT ISNULL([dbo].[HRAbsenceHours] (3200, h.res_id, t.datum, t.datum + 1), 0)) AS Support
    FROM humres h (NOLOCK)
    LEFT OUTER JOIN hrjbtl j (NOLOCK) ON h.job_title = j.job_title
    LEFT OUTER JOIN kstpl cc (NOLOCK) ON h.costcenter = cc.kstplcode
    LEFT OUTER JOIN CostcenterClasses ccc (NOLOCK) ON cc.Class_01 = ccc.CostcenterClassCode AND ccc.ClassID = 1
    CROSS APPLY (SELECT * FROM [dbo].[AllDays] (@startdate, @enddate)) t
    WHERE h.ldatindienst <= t.datum
    AND ISNULL(h.ldatuitdienst, t.datum) >= t.datum
    AND h.fullname NOT LIKE '%inhuur%'
    AND h.emp_type IN ('E', 'C')
    AND h.job_title IN ('F09CONS', 'F09PRIN')
    ORDER BY h.fullname,
    t.datum
    SELECT * FROM TempCapacity
    END
    Thanks!

    Hi,
    According to your description, I think you want to call a store procedure in PowerPivot with the parameters which are stored in the cells of an Excel workbook.
    Are you using the PowerPivot add-in in Excel or PowerPivot in SQL Server?
    This forum is to discuss problems of Office development such as VBA, VSTO, Apps for Office .etc. If you are using Excel PowerPivot, since it is an add-in for Excel and it doesn't publish API for us, we cannot automatically call a stored procedure in Excel.
    We can get the data from Cells A2 and B2 with code, but it's hard to set it as the parameters of a SP when calling it from PowerPivot. About calling a SP from Excel manually, you could post in
    Excel IT pro forum for more effective responses.
    If you are using PowerPivot in SQL Server, I'm afraid your issue is more related to the feature of PowerPivot. We can get data from SQL Server database into Excel workbook, but I'm not sure whether we can get data from Excel cells in SQL Server. So I suggest
    you posting in
    SQL Server PowerPivot forum for more effective responses.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Passing collection parameters from/to Oracle 8i stored procedure to/from Weblogic java program

    Environment- Oracle DB 8.1.7 (Sun) - JDBC OCI 8.1.7 - Application Server (WebLogic 6.0 or 6.1)QuestionHow to pass oracle collection data types from PL/SQL stored procedures to Weblogic java program as in/out stored procedures parameters. I am hitting oracle error 2006 unidentified data type trying to pass the following data types:-o java.sql.Structo java.sql.Arrayo oracle.sql.STRUCTo oracle.sql.ARRAYo oracle.jdbc2.Structo oracle.jdbc2.Arrayo any class implemented oracle.jdbc2.SQLData or oracle.sql.CustomDatumInformationAbout PL/SQL stored procedure limitation which only affects the out argument types of stored procedures calledusing Java on the client side. Whether Java methods cannot have IN arguments of Oracle 8 object or collection type meaning that Java methods used to implement stored procedures cannot have arguments of the following types:o java.sql.Structo java.sql.Arrayo oracle.sql.STRUCTo oracle.sql.ARRAYo oracle.jdbc2.Structo oracle.jdbc2.Arrayo any class implemented oracle.jdbc2.SQLData or oracle.sql.CustomDatum

    this is becoming a mejor problem for me.And are you storing it as a blob?
    Oracle doesn't take varchars that big.
    And isn't LONG a deprecated field type for Oracle?
    From the Oracle docs......
    http://download-west.oracle.com/docs/cd/B13789_01/server.101/b10759/sql_elements001.htm#sthref164
    Oracle strongly recommends that you convert LONG RAW columns to binary LOB (BLOB) columns. LOB columns are subject to far fewer restrictions than LONG columns. See TO_LOB for more information.

  • How to view multiple output parameters from web services

    I have used the Labview tool to create a .NET assembly from a WSDL file.
    In the WSDL file the service has been defined to return 2 output parameters.
    In Labview, when I invoke the method for this service the first output parameter ends up as the return value of the method.  I can create an indicator for this and it gets updated properly when I run the VIS to use the web service..  The indicator is an integer value but recognizes the type defined within the WSDL file. 
    The second output parameter shows up as an output value.  When I right click on it and create an indicator for it I get a .NET icon on the front panel rather than an integer value. 
    How can I view the value for this second output parameter after running the web service?
    Is there a difference in how multiple output parameters handled in newer versions of Labview (I am using verison 7.1)?

    scrooge wrote:
    You can try this link .
    the link is dead... or i dont have access..

  • How to retreive out parameters from function in sql statement

    hi dear,
    Suppose i have a fuction with two "out" parameters, i want to show the values of these paramenters in sql stm.
    like
    select my_function() from dual;
    Thanx

    Can't be done. To use a function in SQL it can only have a single return value.
    Try something like this changing the data types appropriately.
    var x number
    var y number
    var z number
    exec :x := my_function(:y, :z)
    print

  • How to get the OUT value of a PL/SQL procedure?

    that is to say, I want to get a number form a procedure which code is familiar to:
    create or replace procedure get_salary(
    name in varchar2,
    id in varchar2,
    salary out number
    In java code, How to get the value of salary?
    PLZ

    You'll want something like this:
    CallableStatement stmt;
    Connection        conn;
    << Create connection to database >>
    stmt = conn.prepareCall( "{call get_salary( ?, ?, ? )}" );
    stmt.setString( 1, someName );
    stmt.setString( 2, someID   );
    stmt.registerOutParameter( 3, java.sql.Types.INTEGER );
    stmt.executeUpdate();
    int outSalary = stmt.getInt( 3 );Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How do you send a date from java to a stored procedure

    Oracle 8.0.5
    using thin drivers
    I'm trying to pass a date to a stored procedure. Does anybody
    have an example of how to do this.
    I want to send a month-day-year 01/01/1999 to oracle to be
    inserted into the table. what should the java code look like?
    and what should the (in) line look like in oracle.
    Thanks
    Kirk
    null

    Wow. You got me there.  All of the pdfs that i have, when i tap that icon, open a drop down window with the choices of e mail or print.  I wonder if the particular pdf you are working on is somehow protected?  Try a different pdf and see if the box recats the same way.   You might also do a full shut down and just try again.  Make sure there is not an old instance of i books, or some other pdf editor sitting in the task bar, by doblue clicking the home button, and shutting down any open apps.

  • How can I use a button to trigger a SQL Stored Procedure?

    I have a stored procedure (UpdateAdsUsers) that performs updates on multiple tables all tied together with one
    parameter - @username
    (I'm using DWCS5, SQL SERVER 2008, ASP VB)
    UPDATE users SET defaultview='0' WHERE user_name=@username
    UPDATE db_settings SET valuestr='MM/DD/YYYY' WHERE keyword='dateformat' AND user_name=@username
    UPDATE db_settings SET valuestr='Y' WHERE keyword='COPY_MSG_VIA_EMAIL' AND user_name=@username
    UPDATE db_settings SET valuestr='4' WHERE keyword='web_download_rend' AND user_name=@username
    UPDATE db_settings SET valuestr='Y' WHERE keyword='cpy_confirm' AND user_name=@username
    UPDATE db_settings SET valuestr='WLPG:12' WHERE keyword='INITIAL_ASSETS' AND user_name=@username
    UPDATE db_settings SET valuestr='20' WHERE keyword='thumb_disp_row' AND user_name=@username
    UPDATE db_settings SET valuestr='20' WHERE keyword='text_disp_row' AND user_name=@username
    UPDATE db_settings SET valuestr='5' WHERE keyword='para_disp_row' AND user_name=@username
    UPDATE db_settings SET valuestr='a.editorial.company_name' WHERE keyword='sortorder1' AND user_name=@username
    UPDATE db_settings SET valuestr='a.editorial.title' WHERE keyword='sortorder2' AND user_name=@username
    UPDATE db_settings SET valuestr='a.editorial.production_type' WHERE keyword='sortorder3' AND user_name=@username
    UPDATE tnailview_fields SET rendition='1', first_field='company_name', second_field='title', third_field='adsx_type', fourth_field='adsx_status' WHERE user_name=@username
    UPDATE textview_fields SET rendition='1', first_field='company_name', second_field='title', third_field='title_desc', fourth_field='production_type', fifth_field='audio_summary', sixth_field='totalruntime', seventh_field='adsx_type', eighth_field='adsx_status' WHERE user_name=@username
    UPDATE paraview_fields SET rendition='1', first_field='company_name', second_field='title', third_field='title_desc', fourth_field='production_type', fifth_field='audio_summary', sixth_field='totalruntime', seventh_field='adsx_type', eighth_field='adsx_status' WHERE user_name=@username
    SELECT * FROM adsx_preferences WHERE user_name=@username
    This functions perfectly in SQL.
    Using Dreamweaver CS5, I've added the Procedure as a Command (ADS_User) with the one variable (@username).
    <%
    set ADS_User = Server.CreateObject("ADODB.Command")
    ADS_User.ActiveConnection = MM_ADSX_STRING
    ADS_User.CommandText = "dbo.UpdateAdsUser"
    ADS_User.Parameters.Append ADS_User.CreateParameter("@RETURN_VALUE", 3, 4)
    ADS_User.Parameters.Append ADS_User.CreateParameter("@username", 129, 1,32,ADS_User__username)
    ADS_User.CommandType = 4
    ADS_User.CommandTimeout = 0
    ADS_User.Prepared = true
    ADS_User.Execute()
    %>
    In a perfect world, either an image click or a form submit would run the procedure.  The parameter (@username) is currently sent to the page as a URL Querystring of the same name.
    I'm sure it's something obvious, but I'm new.
    Thanks in advance

    I'm not sure what your question is. Is this currently failing? Or are you not able to figure out how to send the username to the script page? You really just need to create a form and pass the value in a form field.
    >The parameter (@username) is currently sent to
    >the page as a URL Querystring of the same name.
    Never use a querystring to update data. It is too dangerous. Use the post method instead.

  • How to get a specific value from a mult-value returning procedure

    Hi,
    We're using Oracle 11.1.
    I have a procedure that I'm calling in a query that looks like the following:
       PROCEDURE tcmenc1_clean_codes (
          p_icd_code_1_source   IN     VARCHAR2,
          p_icd_code_2_source   IN     VARCHAR2,
          p_icd_code_3_source   IN     VARCHAR2,
          p_claim_code_1_src    IN     VARCHAR2,
          p_claim_code_2_src    IN     VARCHAR2,
          p_claim_code_3_src    IN     VARCHAR2,
          p_revenue_code_1_src            IN     VARCHAR2,
          p_cpt_code_1_src                IN     VARCHAR2,
          p_icd_code_1_std        OUT VARCHAR2,  <------------------------Just want this one.
          p_icd_code_2_std        OUT VARCHAR2,
          p_icd_code_3_std        OUT VARCHAR2,
          p_icd_code_1_std         OUT VARCHAR2,
          p_icd_code_2_std         OUT VARCHAR2,
          p_icd_code_3_std         OUT VARCHAR2,
          p_revenue_code_1_std               OUT VARCHAR2,
          p_hcpcs_code_std                   OUT VARCHAR2,
          p_cpt_code_std                     OUT VARCHAR2,
          p_generic_cd_std                   OUT VARCHAR2
       )I'd like to return only the p_icd_code_1_std value. how can I do this?
    Can I just use:
    PROCEDURE tcmenc1_clean_codes (input1, input2, input 3,...,
    p_icd_code_1_std => output1);Also If I don't have inputs for all my inputs, can I specify just the fields I want to input?

    I'm not sure I understand what you mean by target?
    I thought about using a function to pass parameters to this procedure and then have another input parameter that would determine
    which output parameter to use.
    I just wanted to see if there was a cleaner way to do this.

  • Returning array of values from a PL/SQL stored procedure

    I try to run the following example, always happen errors: Run-time error'91' Object variable or With block variable not set.(in line: Set myRS.Source = myCmd1 and Set myRS.Source = myCmd2) Who can tell me where is wrong? I check variable, all set.
    Option Explicit
    Dim myCnn As ADODB.Connection
    Dim myCmd1 As ADODB.Command
    Dim myCmd2 As ADODB.Command
    Dim myRS As ADODB.Recordset
    Dim myConnStr As String
    Dim mySQL As String
    Dim inputssn As Long
    Private Sub cmdGetEveryone_Click()
      Dim myLine As String
      Set myRS.Source = myCmd1
      myRS.Open
      myLine = ""
      While Not myRS.EOF
          myLine = myLine & myRS.AbsolutePosition & " " & _
                   myRS(0) & ", " & myRS(1) & ", " & myRS(2) & vbCrLf
          myRS.MoveNext
      Wend
      MsgBox myLine
      myRS.Close
    End Sub
    Private Sub cmdGetOne_Click()
      Set myRS.Source = myCmd2
      inputssn = InputBox("Enter the SSN you wish to retrieve:")
      myCmd2(0) = inputssn
      myRS.Open
      If myRS.RecordCount = 0 Then
         MsgBox "No data found"
      Else
         MsgBox "Person data: " & myRS(0) & ", " & myRS(1) & ", " & myRS(2)
      End If
      myRS.Close
    End Sub
    Private Sub Form_Load()
      'Using an "On-the-fly" nameless ODBC connection
      'Replace <User ID>, <Password>, and <Server> with the
      'appropriate parameters.
      '  myConnStr = "UID=*****;PWD=*****;driver=" _
      '         & "{Microsoft ODBC for Oracle};SERVER=dseOracle;"
      ' myConnStr = "UID=CSUPerson;pwd=euclid;driver={Microsoft ODBC for Oracle};SERVER=company;"
      'you may also use a named connection DSN such as "myOracleODBC" as follows
      myConnStr = "user id=csuperson;password=euclid;DSN=myOracleODBC;"
      Set myCnn = New ADODB.Connection
      With myCnn
          .ConnectionString = myConnStr
          .CursorLocation = adUseClient
          .Open
      End With
      'the entry RESULTSET 99 indicates the arguments (ssn, fname, lname)
      'are arrays of up to 99 cells each.
      'The binding vars (ssn, fname, lname) should be retrieved in VB using a recordSet
      mySQL = "{call packperson.allperson({RESULTSET 99, ssn, fname, lname})}"
      Set myCmd1 = New ADODB.Command
      With myCmd1
          Set .ActiveConnection = myCnn
          .CommandText = mySQL
          .CommandType = adCmdText
      End With
      mySQL = "{call packperson.oneperson(?,{RESULTSET 2, ssn, fname, " _
             & "lname})}"
      Set myCmd2 = New ADODB.Command
      With myCmd2
          Set .ActiveConnection = myCnn
          .CommandText = mySQL
          .CommandType = adCmdText
          .Parameters.Append .CreateParameter(, adInteger, adParamInput)
      End With
      Set myRS = New ADODB.Recordset
      With myRS
          .CursorType = adOpenStatic
          .LockType = adLockReadOnly
      End With
    End Sub
    Private Sub Form_Unload(Cancel As Integer)
      myCnn.Close
      Set myCnn = Nothing
      Set myCmd1 = Nothing
      Set myCmd2 = Nothing
      Set myRS = Nothing
    End Sub
    Package:
    PACKAGE packperson AS
    TYPE tssn is TABLE of NUMBER(10)
    INDEX BY BINARY_INTEGER;
    TYPE tfname is TABLE of VARCHAR2(15)
    INDEX BY BINARY_INTEGER;
    TYPE tlname is TABLE of VARCHAR2(20)
    INDEX BY BINARY_INTEGER;
    PROCEDURE allperson
    (ssn OUT tssn,
    fname OUT tfname,
    lname OUT tlname);
    PROCEDURE oneperson
    (onessn IN NUMBER,
    ssn OUT tssn,
    fname OUT tfname,
    lname OUT tlname);
    END packperson;
    BODY:
    PACKAGE BODY packperson
    AS
    PROCEDURE allperson
    (ssn OUT tssn,
    fname OUT tfname,
    lname OUT tlname)
    IS
    CURSOR person_cur IS
    SELECT ssn, fname, lname
    FROM employee;
    percount NUMBER DEFAULT 1;
    BEGIN
    FOR singleperson IN person_cur
    LOOP
    ssn(percount) := singleperson.ssn;
    fname(percount) := singleperson.fname;
    lname(percount) := singleperson.lname;
    percount := percount + 1;
    END LOOP;
    END;
    PROCEDURE oneperson
    (onessn IN NUMBER,
    ssn OUT tssn,
    fname OUT tfname,
    lname OUT tlname)
    IS
    CURSOR person_cur IS
    SELECT ssn, fname, lname
    FROM employee
    WHERE ssn = onessn;
    percount NUMBER DEFAULT 1;
    BEGIN
    FOR singleperson IN person_cur
    LOOP
    ssn(percount) := singleperson.ssn;
    fname(percount) := singleperson.fname;
    lname(percount) := singleperson.lname;
    percount := percount + 1;
    END LOOP;
    END;
    END;DB table:
    CREATE TABLE EMPLOYEE
    (FNAME VARCHAR2(15) NOT NULL,
    MINIT    CHAR,
    LNAME VARCHAR2(15) NOT NULL,
    SSN VARCHAR2(9) NOT NULL,
    BDATE DATE,
    ADDRESS VARCHAR2(30),
    SEX CHAR,
    SALARY NUMBER(10,2),
    SUPERSSN VARCHAR2(9),
    DNO NUMBER NOT NULL,
    PRIMARY KEY(SSN));
    DESC EMPLOYEE;
    INSERT INTO EMPLOYEE VALUES
    ('John','B', 'Smith', '123456789','09-JAN-65',
      '731 fONDREN, hOUSTON, TX', 'M', 30000, '333445555',5);
    INSERT INTO EMPLOYEE VALUES
    ('Frankin','T', 'Wong', '333445555','08-DEC-55',
      '683 Voss, Houston,Tx', 'M', 40000, '888665555',5);
    INSERT INTO EMPLOYEE VALUES
    ('Alicia','J', 'Zelaya', '999887777','19-JUL-68',
      '3321Castle, Spring, TX', 'F',25000 , '987654321',4);
    INSERT INTO EMPLOYEE VALUES
    ('Jennifer','S', 'Wallace', '987654321','20-JUN-41',
      '291 Berry, Bellaire, TX', 'F',43000 , '888665555',4);
    INSERT INTO EMPLOYEE VALUES
    ('Ramesh','K', 'Narayan', '666884444','15-SEP-62',
      '975 Fire Oak, Humble, TX', 'F',38000 , '333445555',5);
    INSERT INTO EMPLOYEE VALUES
    ('Joyce','A', 'English', '453453453','31-JUL-72',
      '5631 Rice,Houston,TX', 'F',25000 , '333445555',5);
    INSERT INTO EMPLOYEE VALUES
    ('Ahmad','V', 'Jabbar', '987987987','29-MAR-69',
      '980 Dallas,Houston, TX', 'M',25000 , '987654321',4);
    INSERT INTO EMPLOYEE VALUES
    ('James','E', 'Borg', '888665555','10-NOV-37',
      '450 Stone, Houston, TX', 'M',55000 , null,1);All help I will appreciat it.

    I can't comment on the problem returning PL/SQL arrays, but I will suggest that a more appropriate method of achieving your goal is to call a procedure which returns a REF CURSOR.
    See the examples here:
    http://asktom.oracle.com/~tkyte/ResultSets/index.html

  • How do i handle out parameter from a stored procedure in a vb form?

    hi all,
    I want to return a varchar2(500) type of out parameter from a pl/sql stored procedure to a vb form?? how do i do this??
    regards
    akshay

    Well, when you create the parameter collection for your command object, just set the correct value for the direction component.
    You would set it to one of the below, depending on if the parameter is IN OUT or only OUT:
            <parameter_obj>.Direction = ParameterDirectionEnum.adParamInputOutput
            <parameter_obj>.Direction = ParameterDirectionEnum.adParamOutput

Maybe you are looking for