How to call nested table type from Java

I needed a 2 dimensional array and asked the questuion here.
[Original thread| http://forums.oracle.com/forums/message.jspa?messageID=3419944#3419944]
I have my program working correctly in pl/sql.
The java guys are building this array and passing it in to me, but they don't know how.
A small example of this would be appreciated.
Heres an example of the procedure prototype and the type definitions in use
create or replace
type csn_array_obj
as object
(csn varchar2(20 char),
box_id varchar2(10)
create or replace
type csn_array_type is table of csn_array_obj;
procedure populate_stock(
p_csn_array in csn_array_type
added in example of object and type definition.

There's an orl Oramag article by Tom Kyte rounding up [some Java tips|http://asktom.oracle.com/tkyte/omag/00-nov/o60tom.html] which includes an example of how to do this. You'll need to replace Tom's SIMPLARRAY with your own type.
Cheers, APC
blog: http://radiofreetooting.blogspot.com

Similar Messages

  • Accessing  table type from JAVA

    Hi Experts,
    We are making a custom copy of the std FM COM_BPUS_ORG_CONTPERS_REGISTER .
    It is observed that Tables are obsolete and we should not use them in custom function modules.
    I can pass a table type in import parameter and export parameter.
    Can we access a table type from java layer.
    Also, note that this STANDARD function module has parameter IT_BUSINESSPARTNERROLE_ORG which has table type BU_ROLE_T.
    Is it possible to access this?
    Note:- This Function module is not getting called in standard web shops.
    Please let me now how i can access this table type for hava while calling FM so as to input or retrieve valus from it.
    Regards
    Antony

    The issue with you is more than accessing a table type.
    You said:
    This Function module is not getting called in standard web shops.
    For function modules that are not called as a part of the standard flow, you have to develop your own simple BOM, BO, BEI, BE classes and methods to call the custom RFC - the whole nine yards. See the extension guide and see the Extension Demos 2 and 3 for reference.
    See the sample JCO calls from Java to understand how to access the table types.

  • How to call backing bean method from java script

    Hi,
    I would like to know how to call backing bean method from java script.
    I am aware of serverListener and [AjaxAutoSuggest article|http://www.oracle.com/technology/products/jdev/tips/mills/AjaxAutoSuggest/AjaxAutoSuggest.html]
    but i am running in to some issues with [AjaxAutoSuggest article|http://www.oracle.com/technology/products/jdev/tips/mills/AjaxAutoSuggest/AjaxAutoSuggest.html]
    regarding which i asked for help in other thread with subject ....Question on AjaxAutoSuggest article (Ajax Transactions Using ADF and J...)
    The reason why i posted is ( though i realise both are duplicates) .. that threads looks as a specific question to that article hence i would like to ask the quantified problem is asked in this thread.
    So could any please letme know how to call backing bean method from java script
    Thanks
    Murali
    Edited by: mchepuri on Oct 24, 2009 6:17 PM
    Edited by: mchepuri on Oct 24, 2009 6:20 PM

    Hello,
    May know how to submit a button autoamtically on onload of page with clicking a welcome alert box. the submit button has managed button too to show a message on console using SOP.
    the problem is.
    1. before loading the page a javascript comes on which i clicked ok
    2. the page gets loaded and the button is there which gets automatically clicked and the managed bean associated with prints a message on console using SOP.
    I m trying to do this through server listener and click listener. the code is(adf jspx page)
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1" binding="#{backingBeanScope.backing_check4.d1}">
    <af:form id="f1" binding="#{backingBeanScope.backing_check4.f1}">
    <af:commandButton text="commandButton 1"
    binding="#{backingBeanScope.backing_check4.cb1}"
    id="cb1" action="#{beanCheck4.submit1}"/>
    <af:clientListener type="click" method="delRow"/>
    <af:serverListener type= "jsServerListener"
    method="#{backingBeanScope.backing_check4.submit1}"/>
    <f:facet name="metaContainer">
    <af:resource type ="javascript">
    x=confirm("hi");
    // if(x){
    delRow = function(event){
    AdfCustomEvent.queue(event.getSource(), "jsServerListener", {}, false);
    return true;
    </af:resource>
    </f:facet>
    </af:form>
    </af:document>
    </f:view>
    <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_check4-->
    </jsp:root>
    the backing bean code is -----
    public class classCheck4 {
    public classCheck4() {
    public String submit1() {
    System.out.println("hello");
    return null;
    }

  • How to call a VB application from Java

    Hi,
    does anybody know how to call a VB application from java.
    Would appreciate if you can provide me with an example.
    thanks

    try exec()ing the cad program with the name of the file as a command line parameter...
    Runtime.getRuntime().exec("CADProg.exe Test.prt");
    i have no clue if this will work but it seems like it's worth a try.

  • How to call a .bat file from java code?

    How to call a .bat file from java code? and how can i pass parameters to that .bat file?
    Thanks in advance

    thanks for ur reply
    but still i am getting the same error.
    I am trying to run a .bat file of together tool, my code looks like below
    import java.lang.Runtime;
    import java.lang.Process;
    import java.io.File;
    class SysCall{
         public static void main(String args[]){
              String cmd="D://Borland//Together6.2//bin//Together.bat -script:com.togethersoft.modules.qa.QA -metrics out:D://MySamples//Metrics// -fmt:html D://Borland//Together6.2//samples//java//CashSales//CashSales.tpr";
              //String path="D://Borland//Together6.2//bin//Together.bat ";
              Runtime r= Runtime.getRuntime(); //Declare the system call
              try{
                   System.out.println("Before batch is called");
                   Process p=r.exec(cmd);
                   System.out.println(" Exit value =" + p.exitValue());
                   System.out.println("After batch is called");
              /*can produce errors which must be caught*/
              catch(Exception e) {
                   e.printStackTrace();
                   System.out.println (e.toString());
    I am getting the below exception
    Before batch is called
    java.lang.IllegalThreadStateException: process has not exited
    at java.lang.Win32Process.exitValue(Native Method)
    at SysCall.main(SysCall.java:17)
    java.lang.IllegalThreadStateException: process has not exited

  • How to call a BPEL process from Java ?

    How can I call a BPEL process from Java?
    The Java client should be outside of the PEL engine.
    Does someone have a piece of sample code for
    a "Hello world" java-to-bpel call (+ java client src)?

    http://www.oracle.com/technology/products/ias/bpel/pdf/orabpel-Tutorial7-InvokingBPELProcesses.pdf

  • How to Call abap functn/program from java layer

    Hi all,
        I have to develop a program which has to call abap function/program from java side or how to call a abap program through java ..
    pls send me related links or explanations.. dont send unrelated answers..
    Regards,
    Arivarasu S

    Hi,
    You mean accessing ABAP functions from J2EE perspective, then I think we can do this by using SAP Java Resource Adapter and also through webservices.
    SAP Java Resource Adapter (SAP JRA) can be used as an add-on for the SAP JCo SAP JRA enables the implementation of standard interfaces from diverse J2EE servers to the SAP JCo in the SAP Web AS. The SAP JRA thus simplifies
    communication with ABAP within heterogeneous J2EE landscapes.
    Go through the following links which has Good documentation on how to achieve this
    Accessing BAPIs Using the SAP Java Resource Adapter
    [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/ad09cd07-0a01-0010-93a9-933e247d3ba4]
    Connectivity and Interoperability
    [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/326d82e5-0601-0010-fca4-9caf27b89c26]
    Finally with WebServices. Accessing SAP Business Functions (ABAP) via Web Services
    [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/06adbf03-0a01-0010-f386-d8e45561a3c4]
    Regards
    Raghu

  • How to use nested table types with XDK

    Im using Oracles XDK (xml development kit) to create xml-documents from data in database.4
    Problem: I need to use nested tables but when trying to create nested table types I get error: A Table type may not contain a nested table type or VARRAY.
    Hope I make myself clear! Are there any solutions or workarounds to this problem?
    Help appreciated, thanks!

    Jesper,
    I asked similar question last year (search for Tapsell, you will see my posting). Under 8.1.7 the "nesting" seems restricted to one level down. Thus you cannot create a type using another object that itself includes a nested table. Under Oracle 9, against which most current examples seem based, this limitation is removed making things easier. Under 8.1.7 the workaround I have used is to use the CAST syntax. This is not as neat, but it works.

  • How to call a php function from java...

    helllo fellow java developers!
    Im trying to figure out how I can call a php function from my java code.
    I know it sounds a bit unintiutive, seeing how java is a rich programming language, BUT java simply cannot do the task that the php script can do. It simply acts differently.
    So I am trying to call a php function, that returns a string object, and capture that string object....
    is this possible?
    something like....
    String strMyString = phpFunction( strVariable )
    ???????/ any ideaS?

    idea #1 - come up with a better plan that doesn't involve invoking php from java.
    Give one example of something php can do that java can't.
    idea #2 - forget java, and just write it in php.
    Involving multiple frameworks/languages/runtime environments is a recipe for an overcomplicated solution that will be impossible to maintain.
    I'd say keep it simple and stupid, and stick with one language.
    If you're still hooked on the idea, maybe try [this link|http://www.infoq.com/news/2007/10/php-java-stack]

  • How to call C/C++ - Code from Java?

    I would like to know if it is possible to call C or C++ - Code from Java and how to do.

    In short, yes you can do this.
    Have a look at http://java.sun.com/docs/books/tutorial/native1.1/concepts/index.html
    to see how...
    Good luck!

  • Referencing package table type from Java

    Hi,
    In my package spec, I have a table type defined. I just want to refer this from Java program in order to pass ARRAY object to a procedure inside the package. But I keep getting an errory saying "Invalid name pattern".
    But If I declare the type outside of the package, it works fine. Can anyone help me on this?
    Regards,
    Poornachandran R

    Hi,
    create or replace package msproot.spear$util as
    -- UUID table type
    type varchar32_t is table of varchar2(32) index by binary_integer;
    * Function name: getUUID
    * Desc: Retreive a unique id.
    * IN: maxNumOfUUID - integer, the quentity of UUID to generate, optional default 1.
    * OUT: UUID - an array of 32 characters string of UUID
    function getUUID(maxNumOfUUID number :=1 ) return varchar32_t;
    end spear$util;
    create or replace package body msproot.spear$util as
    -- get uuid - retun more the one UUID
    function getUUID(maxNumOfUUID number) return varchar32_t is
    uuidArr varchar32_t;
    begin
    -- generate the array of uuid up to maxNumOfUUID
    for i in 1..maxNumOfUUID loop
    select sys_guid into uuidArr(i) from dual;
    end loop;
    return (uuidArr);
    end getUUID;
    end spear$util;
    private String[] retrieveUuid(int maxNumOfUUID) throws Exception
    String[] arr = null;
    try {
    // generate a free spear ids array from the database
    // Use a PL/SQL block to open the stored procedure
    OracleCallableStatement ocstmt =
    (OracleCallableStatement) conn
    .prepareCall("begin ? := spear$util.getUUID(?); end;");
    // index-by table element type
    int elemSqlType = OracleTypes.CHAR;
    // index-by table element length in case the element type
    // is CHAR, VARCHAR or RAW. This value is ignored for other
    // types
    int elemMaxLen = 32;
    // register the return parameter
    ocstmt.registerIndexTableOutParameter(1, maxNumOfUUID, elemSqlType,
    elemMaxLen);
    // register the number of UUIDes to generate
    ocstmt.setInt(2, maxNumOfUUID);
    // run the stored procedure
    ocstmt.execute();
    // access the value using JDBC default mapping
    arr = (String[]) ocstmt.getPlsqlIndexTable(1);
    // close the cursor
    ocstmt.close();
    } catch (SQLException x) {
    System.out.println(errorMessage + x.toString());
    throw new Exception(errorMessage + x.getMessage());
    return arr;
    Best,
    EA

  • Calling nested Batch files from Java

    Hi,
    I have a java program which loops through a list of batch files, executing each one. This works fine. My problem is that each batch file I execute contains a call to execute a further batch file.
    The second(nested) batch file never gets run. The java program completes sucessfully though. Any ideas of a way around this?
    Code:
    while (batFileToken.hasMoreTokens()){
        String batFileName = batFileToken.nextToken();
        Process process = load.exec("cmd.exe /c "+batFileName);
        process.waitFor();
    }Each batFileName it executes contains the below command:
    call test.battest.bat never executes.

    Check this link..
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    the way to make sure process is completed.. is
    try{
    Process proc = Runtime.getRuntime().exec(optimizer.exe);
    StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR");
    StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), "OUTPUT");
    errorGobbler.start();
    outputGobbler.start();
    int exitVal = proc.waitFor();
    System.out.println("ExitValue: " + exitVal);
    catch (IOException ex1) {
    System.out.println("Error in Starting Optimizer");
    catch (Throwable t) {
    t.printStackTrace();
    class StreamGobbler extends Thread {
    InputStream is;
    String type;
    OutputStream os;
    StreamGobbler(InputStream is, String type) {
    this(is, type, null);
    StreamGobbler(InputStream is, String type, OutputStream redirect) {
    this.is = is;
    this.type = type;
    this.os = redirect;
    public void run() {
    try {
    PrintWriter pw = null;
    if (os != null)
    pw = new PrintWriter(os);
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line = null;
    while ( (line = br.readLine()) != null) {
    if (pw != null)
    pw.println(line);
    System.out.println(type + ">" + line);
    if (pw != null)
    pw.flush();
    catch (IOException ioe) {
    ioe.printStackTrace();
    }

  • How to Call a batch file from Java ?

    In my java application I have to call a .bat (Batch file) file.

    I found that already. Eventhough that is slightly differ from yours.
    .exec("cmd /c start x.bat");
    Anyhow
    Thanks yarr.
    My E-Mail ID is [email protected]

  • S'one tell me how to call Oracle Stored Proc from Java

    Hi,
    I have a problem in calling the Stored proc using callable statement.It looks like we are doing the same thing or no..
    Pl..let me know if you can correct me..Am enclosing the stored proc and java Code...
    CREATE OR REPLACE PROCEDURE StoreFTPAddress (FTP in FTPTYPE) is
    BEGIN
    INSERT INTO DES.FTPSERVICE(
    FTPID,
    COMPANYID,
    SERVERNAME,
    DIRECTORY,
    USERNAME,
    PASSWORD,
    INSTRUCTIONS)
    VALUES( FTPID.NEXTVAL,
    FTP.COMPANYID,
    FTP.SERVERNAME,
    FTP.DIRECTORY,
    FTP.USERNAME,
    FTP.PASSWORD,
    FTP.INSTRUCTIONS);
    END;
    JAVA CODE :;
    public String retrieveFormatExtension(String formatName)
    OracleResultSet rs_form = null;
    try
    conn = ConnectionDataObjectImpl.getConnection();
    Statement stmt = conn.createStatement();
    String sql_retrieve = "{call retrieveFormatExtension} " ;
    CallableStatement cst = conn.prepareCall(
    "{call retrieveFormatExtension(?,?)}");
    cst.setString(1," FName ");
    cst.registerOutParameter(1, OracleTypes.VARCHAR); // OUT Parameter
    cst.executeQuery();
    rs_form = (OracleResultSet) cst.getObject(1);
    cst.close();
    catch (SQLException ex)
    System.out.println("SQLException : " + ex.getMessage());
    return null;
    Regards
    Deepauk
    [email protected]
    null

    Syntactically it looks fine. Only thing is u r calling the proc with wrong name. Your procedure takes only one parameter and i.e
    IN type. I think u need to correct ur preparecall statement.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Ayappa:
    Hi,
    I have a problem in calling the Stored proc using callable statement.It looks like we are doing the same thing or no..
    Pl..let me know if you can correct me..Am enclosing the stored proc and java Code...
    CREATE OR REPLACE PROCEDURE StoreFTPAddress (FTP in FTPTYPE) is
    BEGIN
    INSERT INTO DES.FTPSERVICE(
    FTPID,
    COMPANYID,
    SERVERNAME,
    DIRECTORY,
    USERNAME,
    PASSWORD,
    INSTRUCTIONS)
    VALUES( FTPID.NEXTVAL,
    FTP.COMPANYID,
    FTP.SERVERNAME,
    FTP.DIRECTORY,
    FTP.USERNAME,
    FTP.PASSWORD,
    FTP.INSTRUCTIONS);
    END;
    JAVA CODE :;
    public String retrieveFormatExtension(String formatName)
    OracleResultSet rs_form = null;
    try
    conn = ConnectionDataObjectImpl.getConnection();
    Statement stmt = conn.createStatement();
    String sql_retrieve = "{call retrieveFormatExtension} " ;
    CallableStatement cst = conn.prepareCall(
    "{call retrieveFormatExtension(?,?)}");
    cst.setString(1," FName ");
    cst.registerOutParameter(1, OracleTypes.VARCHAR); // OUT Parameter
    cst.executeQuery();
    rs_form = (OracleResultSet) cst.getObject(1);
    cst.close();
    catch (SQLException ex)
    System.out.println("SQLException : " + ex.getMessage());
    return null;
    Regards
    Deepauk
    [email protected]
    <HR></BLOCKQUOTE>
    null

  • How to call a perl module from Java program.

    Hi,
    I create a simple java program as follows
    class test{
    public static void main(String args[])
    {try {                    
    Runtime r = Runtime.getRuntime();
    r.exec("perl test.pl");
    catch(Exception e)
    {e.printStackTrace();}
    and test.pl is located in the same directory as the java program. The program compiles but with no return as I execute it. I am not sure what is wrong.
    Thanks,

    I think the wrong line is here; r.exec("perl test.pl");
    Usually the JVM needs the full path.If the path for either the executable or the script was wrong then, given the code posted, it would not hang.
    >
    To automatticaly get the path (if the file is in the
    class path) use
    System.getProperty("java.class.path")
    That gets paths(plural).
    Try this:
    r.exec("perl " +
    System.getProperty("java.class.path") + "\test.pl");I am rather certain that that won't work on any standard operating system.

Maybe you are looking for