What is the equivalent of HashTable of Java in PL/SQL

Hello

I write a java method that calls a pl/sql procedure. The procedure must accept a single input parameter and I actually pass the parameter of java as a hash table

    protected void doDML(int operation, TransactionEvent e) {
        // super.doDML(operation, e);
        Hashtable record = new Hashtable();  
        String columnName = null;
        if (operation == DML_INSERT) {       
         for (int i =0; i<getAttributeCount(); i++) {
               columnName = this.getEntityDef().getAttributeDef(i).getColumnName();
               System.out.println(columnName+ "=>"+this.getAttribute(i));             
               record.put(columnName, this.getAttribute(i));               
           }
            System.out.println(record.size());
         insertRow(record);
         
        }
        
    }


    public void insertRow(Hashtable table) {
        CallableStatement st = null;
        try {


            // 1. Define the PL/SQL block for the statement to invoke
            String stmt = "begin test_tab_pkg .insert_row(?,?); end;";
            // 2. Create the CallableStatement for the PL/SQL block
            st = getDBTransaction().createCallableStatement(stmt, 0);
            // 4. Set the bind values of the IN parameters
            st.setObject(1,table);


            // 3. Register the positions and types of the OUT parameters
            st.registerOutParameter(2, Types.VARCHAR); //P_REQ_AMT_BASE


            // 5. Execute the statement
            st.executeUpdate();
            //   setReqAmountBase(st.getString(8));
            setErrorMsg(st.getString(2));
            System.out.println(getErrorMsg());
        } catch (SQLException e) {
            throw new JboException(e);
        } finally {
            if (st != null) {
                try {
                    //Close the JDBC CallableStatement
                    st.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        }
    }

as see you in the code, the method "::InsertRow()" runs a procedure from pl/sql "test_tab_pkg.insert_row(?,?)".

the first parameter is IN, and the second was RELEASED.

The problem is that I don't know what type of data I use PL/SQL for parameter 1.I tried an array of records, but it fails. This is my code

CREATE OR REPLACE package HR.test_tab_pkg 
is
type ADF_ENTITY is table of VARCHAR2(30) index by binary_integer;


procedure insert_row  (prec in ADF_ENTITY , perror out varchar2 ) ;


end  ;
/

CREATE OR REPLACE package body HR.test_tab_pkg 
is
procedure insert_row  (prec  ADF_ENTITY , perror out varchar2 )
is


begin



insert into test_tab (tab_id  , description ,trx_date  ) 
values (prec(0)  , prec(1) ,SYSDATE ) ;
    
perror:='0';
    
exception 
when others
then perror:=sqlcode ;    
end insert_row;


end  ;
/

When I test my method this error occurs

java.sql.SQLException: invalid column type

I need to make the java method's hash table to a PL/SQL procedure. How to do this?

Thank you

Hi Tarek,

Associative arrays works similar to Java hash tables, it is a set of key-value pairs.

Look at this link:

Documents and Collections of PL/SQL

I hope that helps!

Concerning

Carlos

Tags: Oracle Development

Similar Questions

  • What is the equivalent of eth0 in Linux MS Windows?

    On Linux, we have eth0.

    What is the equivalent on Microsoft Windows OS platform?

    In a type of command window in ipconfig/all to display all of the current settings of the network. This will produce a number of entries. For a wired connection, the Ethernet connection to the Local network card will be the equivalent of eth0

  • I want to create images as Holger Lipman. What program and how I would do this. I learned to look at Processing.js and OpenProcessing. What is the equivalent to Adobe.

    I want to create images as Holger Lipman. What program and how I would do this. I learned to look at Processing.js and OpenProcessing. What is the equivalent to Adobe.

    [Duplicate message deleted... post the same question more than once is confusing... MOD]

    [This is an open forum, not a direct line to Adobe support... you have to wait a response]

    Hello

    Not really sure, please try to post the request in the community specific https://forums.adobe.com/welcome

    Kind regards

    Sheena

  • In Gimp, there is a command called "alpha to selection". Who selects the alpha channel only. What is the equivalent command in Photoshop?

    Untitled.jpeg In Gimp, there is a command called "alpha to selection" which automatically selects the alpha channel of the image or layer. What is the equivalent command that in Photoshop? I tried Googling it but everything that comes is tutorials on masks. I just want to know what to select the alpha automatically without using a 'magic wand' to select one by one.

    CMD (mac) or Ctrl (pc), click on everything that has transparency and that load a selection. This includes layers with transparency, masks layers, channels and paths. Also, there is a selection at the bottom of the layers, paths and channels Panel icon that looks like a dotted circle.

  • What is the equivalent of | operator using the Q-quote mechanism?

    Version: 11.2.0.3

    I started a thread on similar requirement last week. I didn't want to resurrect. So, I start a new thread.

    We have a stored procedure called generate_table_stats that meet the stats for tables with a few additional options.

    Usually, this procedure is performed as below

    generate_table_stats exec ('EMP_DTL', 'BASIC');

    We want to generate the exec above instructions dynamically for all tables.

    In the traditional method of quotations, we use the concatenation (|) operator to separate the column names whose values are retrieved dynamically from the table queried.

    Similarly, how can I get a column of values printed when you use the Q-quote mechanism?

    In my column in table_name attempt below must be retrieved from user_tables. But table_name and pipes that are treated as literal string (which is not surprising).

    What is the equivalent of | (concatenation operator) when you use the Q-quote mechanism?

    -Expected results

    generate_table_stats exec ('EMP_DTL', 'BASIC');

    generate_table_stats exec ('CUSTOMER_DTL', 'BASIC');

    .

    .

    .

    -My attempt using Q-quote

    -Using # as the quote delimiter

    SQL > select q'#exec generate_table_stats ('| table_name |', 'BASE'); #' From user_tables;

    Q' #EXECGENERATE_TABLE_STATS('||) TABLE_NAME |', 'BASE')

    -----------------------------------------------------

    generate_table_stats exec ('| table_name |', 'BASE');

    generate_table_stats exec ('| table_name |', 'BASE');

    generate_table_stats exec ('| table_name |', 'BASE');

    generate_table_stats exec ('| table_name |', 'BASE');

    .

    .

    .

    .

    Hello

    The concatenation operator. works the same with any string expression.

    x | There

    Returns a string that is the same as sting followed immediately the string x y, x is

    • a literal string with Q before the first single quote
    • a literal string without Q
    • a VARCHAR2 column
    • a function that returns a string, or
    • any string expression.

    The string can be everything above, too.

    If you concatenate strings of 3 or more, like this

    str1. str2. ... || Suro

    then each of the STRS can be any kind of expression, independent of others.

    If you want to concatenate strings of 3, the 1st and the 3rd being Q-literals and the 2nd being a column, you can do it like this:

    Select q' generate_table_stats #exec (#' | table_name)

    || q ' #, ' BASIC'); #'

    From user_tables;

    Each of literals has its own Q and her own pair of start and end markers (all the ' # s in the example above).

    Since the first string literal has no any single-quotation marks incorporated, it is unnecessary to use Q-rating, and it could be misleading; a person who bed the code might think the actaully string contains ' #'s.  I prefer wriite the query in the form

    Select ' generate_table_stats exec (' | table_name)

    || q ' #, ' BASIC'); #'

    From user_tables;

  • What is the equivalent of the Oracle of the FIRST of Microsoft Access function?

    Use: Oracle 10 g 2 RAC on SUSE Linux 9 (10.2.0.3)

    In the process of conversion of a Microsoft Access database to Oracle, an Access query uses the FIRST function.
    What is the equivalent of the Oracle of the FIRST of Microsoft Access function?

    In the conversion attempt, FIRST_VALUE Oracle has been used. However, the same results was not reached.
    Thank you
    (BLL)

    Query:
    H2. ACCESS:
    SELECT
    TRE. GCUSNO,
    UCASE ([DCUSNO]) AS DCUSNO_STD,
    * FIRST (UCASE ([DNAME])) AS DNAME_STD *.
    * FIRST (UCASE ([DADDR])) AS DADDR_STD *.
    * FIRST (UCASE ([DCITY])) AS DCITY_STD *.
    TRE. DSTATE,
    FIRST (TRE. DZIP) AS DZIP,.
    TRE. DREGN,
    TRE. DDIST,
    TRE. DSLSMN,
    TRE. DCHAIN,
    TRE. MARKET,
    TRE. MKTPGM,
    TRE. EUMKT
    Of
    TRE
    GROUP BY
    TRE. GCUSNO,
    UCASE ([DCUSNO]),
    TRE. DSTATE,
    TRE. DREGN,
    TRE. DDIST,
    TRE. DSLSMN,
    TRE. DCHAIN,
    TRE. MARKET,
    TRE. MKTPGM,
    TRE. EUMKT;



    H2. ORACLE:
    SELECT DISTINCT
    TRE. GCUSNO,
    SUPERIOR (TRIM (TRE. DCUSNO)) AS DCUSNO_STD,
    SUPERIOR (TRIM (TRE. DNAME)) AS DNAME_STD,
    SUPERIOR (TRIM (TRE. DADDR)) AS DADDR_STD,
    FIRST_VALUE (UPPER (TRIM (TRE. (DNAME)) IGNORE NULL VALUES) (TRE ORDER. GCUSNO) AS DNAME_STD,.
    FIRST_VALUE (UPPER (TRIM (TRE. (DADDR)) IGNORE NULL VALUES) (TRE ORDER. GCUSNO) AS DADDR_STD,.
    FIRST_VALUE (UPPER (TRIM (TRE. (DCITY)) IGNORE NULL VALUES) (TRE ORDER. GCUSNO) AS DCITY_STD,.
    TRE. DSTATE,
    TRE. DZIP,
    FIRST_VALUE (UPPER (TRIM (TRE. (DZIP)) IGNORE NULL VALUES) (TRE ORDER. DZIP ASC) AS DZIP,.
    TRE. DREGN,
    TRE. DDIST,
    TRE. DSLSMN,
    TRE. DCHAIN,
    TRE. MARKET,
    TRE. MKTPGM,
    TRE. EUMKT
    CRM. TREUP100R TRE
    GROUP BY
    TRE. GCUSNO,
    SUPERIOR (TRIM (TRE. DCUSNO)),
    TRE. DNAME,
    TRE. DADDR,
    TRE. DCITY,
    TRE. DSTATE,
    TRE. DZIP,
    TRE. DREGN,
    TRE. DDIST,
    TRE. DSLSMN,
    TRE. DCHAIN,
    TRE. MARKET,
    TRE. MKTPGM,
    TRE. EUMKT;

    A slight correction to the post of odie. I think you mean min max to replicate the primary function of access, but see below for sure. So:

    min(upper(trim(tre.dname))) keep (dense_rank first order by tre.gcusno) as dname_std
    

    user10860953 wrote: how it ignores null values?

    The min and max functions automatically ignores nulls, so if there is a null value in tre.dname, it will not be returned, unless all values are null. For example:

    SQL> WITH t AS (
      2     SELECT 65 id, 'ABCD' col FROM dual UNION ALL
      3     SELECT 37, 'DEFG' FROM dual UNION ALL
      4     SELECT 65, 'DEFG' FROM dual UNION ALL
      5     SELECT 65, null FROM dual UNION ALL
      6     SELECT 70, null FROM dual UNION ALL
      7     SELECT 70, null FROM dual UNION ALL
      8     SELECT 37, 'ABC' from dual)
      9  SELECT id,
     10         MIN(col) keep (DENSE_RANK FIRST ORDER BY id) min_dname_std,
     11         MAX(col) keep (DENSE_RANK FIRST ORDER BY id) max_dname_std
     12  FROM t
     13  GROUP BY id;
    
            ID MIN_ MAX_
    ---------- ---- ----
            37 ABC  DEFG
            65 ABCD DEFG
            70
    

    John

  • What is the equivalent of longbinary in oracle 11g?

    Hello

    I just want to now what is the equivalent of the LongBinary data type in oracle 11g.

    Thank you.

    BOO!

  • What is the equivalent of Adobe Air to CoreData iOS?

    I used CoreData on iOS and love it.  Can someone tell me what is the mobile equivalent of CoreData's Adobe Air?

    I use EncryptedLocalStore to store the user's preferences, but it uses iOS keychain and causes data to persist on the device iOS via an app removal & install.  This is no good, since I'm store preferences that is a little more appropriate for the use of the keyring.  AND I want the app data deleted off the unit once the application is deleted/uninstalled.

    Any ideas?

    My opinion:

    Shared local objects if you want to have your prefs in the form of key/value pairs. or by using E4X with readObject and writeObject file API if you want to have your prefs in XML format.

  • What is the equivalent of JavaFX from the constructors that accepts arguments?

    I'm sure that there are no constructors in JavaFX because I read somewhere that but how can I get a similar result?

    For example, the goal of the program that I do is simulate a really basic car race and I want to be able to use the code to be red or blue or something else. The equivalent of Java I think East:
    Car car = new Car(Color.RED);
    and the manufacturer of the car class to be:
    public Car(Color color)
    {
        this.color = color;
    }
    Any help would be greatly appreciated!
    Thanks in advance!

    JavaFX has no constructors, but has init and postinit constructions.
    In your case, you can do without these constructions:

    public class Car {
     var color:Color
    
    } 
    
    var car:Car  = Car {color:Color.RED};
    }
    
  • What is the right answer, is that this issue is sql?

    Hello.. Please I need a correct answer to this question...

    See the exhibition and examine the structure of the PRODUCTS table.

    Using the PRODUCTS table, you publish the following query to generate names, current list prices, and

    price list for all these products whose list price falls below $10 after that a discount of 25% reduced

    on this subject.

    SQL > SELECT prod_name, prod_list_price,.

    prod_list_price - (prod_list_price *. 25) "DISCOUNTED_PRICE".

    PRODUCTS

    WHERE discounted_price < 10;

    The query generates an error.

    What is the reason of the error?

    Has the parentheses should be added to frame the entire expression.

    B - double quotes should be removed from the column alias.

    Column alias C - replace it with the expression in the WHERE clause.

    Alias column D - The should be capitalized and closed with the double quotes in the WHERE clause.

    Took me 5 seconds to see that in Google: alias in where clause that exactly answers your question.

  • In Gimp, there is a command called "color to alpha". What is the equivalent of this command in Photoshop? [please?]

    Untitled.jpegUntitled2.jpeg

    Hi people. Another saltquestion related ection/transparency. Im making this transition from Gimp PS and Im trying to make the process faster by asking specific questions, because its still taking me by watching videos. At this point Im just trying to learn my way around the interface of the program rather than learning the science itself.


    Back to the question: in Gimp "color to alpha" removes a particular color of the image while keeping the other colors intact. Another way to do is to put the tool eraser to remove a particular color when you apply it. How do the exact equivalent or closed cela in Photoshop? Basically, my questions are:


    What command or option use to remove a particular color both in image? [Ex. There is the American flag and I want to turn red in alpha gradients]

    How to set the BRUSH tool to make it an ERASER tool, affecting only a particular color or how to configure the Eraser tool so that it affects only a specific color in the image?


    All your time and info is much appreciated.



    Short answer: No. even after all this time, Photoshop still doesn't offer such a handy tool. There is a Select statement--> the color range option, but it gives quite severe results and does not mix, alpha, etc. into account.

    Alternatively, the BlendIf option can also work in some cases.

    To remove the black (or white if you reverse the image first), the Unmultiply plugin can be used: http://www.ayatoweb.com/download/down04.html

    Although I'm not sure if it still works in the latest version. The developer has created a FilterForge version, which works very well (but requires a license FF).

    An older plugin can be downloaded here:

    http://www.Cybia.co.UK/TheWorks.html

    Only works on 32-bit hosts Photoshop compatible plugin, however. So no luck with a 64-bit Photoshop.

    It's really a shame: Photoline has a bright "color to transparency" no destructive layer (Stackable!) setting that does exactly what Gimp "color to alpha" does, but with a lot more control:

    Here again, no tool offers everything, including Photoshop.  Just run Gimp for these cases.

  • What is the use of activation of java temporary files of the Java Control Panel? (Appreciated detailed responses)

    In the Panel of Win XP, you will meet Java Control Panel. When the Insider that it prove temporary Internet files options. I would like to know the retail uses / threats of activation / deactivation of the parameters of the temporary Internet files of this Panel.

    This is download and another time applet download fastly and restore your settings. No problem to remove.

  • setProperty ("", FLF, Number (getProperty("",_y)) + Number (yStep) "); What is the equivalent as3 for this code?

    setProperty ("", FLF, Number (getProperty("",_y)) + Number (yStep) ");

    his as2. I need equivalent as3 code for this line. Thank you

    That's as1.  AS3:

    This.y += Number (yStep);

    and the same comments I made in your similar message, on which is attached to an object, the code applies.

  • What is the equivalent of the Cyan/red cursor?

    I'm so used to the color balance tool, but I like that camera raw is so easy to change a large folder of images quickly and without action.

    Balance whitle (it's like the blue/yellow slider) and hue, (which is like the magenta slider / green), there is no equivalent of the red cursor / cyan it?

    Idem, same question for white dots / black in the levels adjustment layer - is there an equivalent to that in camera Raw? So nice to be able to quickly click on a white spot and see it all becomes nuetral. Don't see this ability in Camera Raw, maybe I missed it. (assuming that you did not take a gray card for the tool white balance).

    Finally I remember, this lightroom if there are all these color sliders, very in depth, cannot locate that now! Thank you.

    This is the 4th tab: called HSL / grayscale. Shortcut Ctrl-Alt-4.

  • What is the equivalent of key() in php here?

    In actionscript which is equivalent to key in php which States that:

    Le Key() function simply returns the key of the array element that is currently being pointed to by the internal pointer. It does not move the pointer in some way. If internal pointer points beyond the end of the elements list or the array is empty, key() returns NULL .

    more can be seen here:

    http://PHP.net/manual/en/function.key.php

    for an array, you must use the indexOf() method.

    var int index = yourarray.indexOf (yourarrayelement);

    but for an associative array (= object), you can use:

    function keyF(obj:Object,e:*):String {}

    for (var s:String in obj) {}

    {if(obj[s]==e)}

    return s;

    }

    }

Maybe you are looking for

  • maximum bookmarks

    I'm new to Firefox. Before, I used IE and I recorded a lot of favorites with 24 records each one having one or more subfolders.At the same time, I'm migrating from XP to W7 on another PC.I copied all my favorites in C:/USER/Jacques/Favorites (IE arch

  • Port Sata is in 2119tx Dv6 is 2 sata or sata 3?

    Hi I can't seem to be able to find the version of sata port, if it is a 2 or 3 for sata 2119tx dv6 as wanting to get a SSD for her. Thank you

  • Touch screen on Satellite C660 - 1 M 0

    HelloCan I do my laptop screen a palpable screen?Because I noticed something called pen and touch

  • Y410p Graphics Card upgrade Question

    Last December, I bought a y410p and I am extremely satisfied with it, but I would like to ask in an another GT 755 m graphics card into the ultrabay slot, but I've been able to find a removable graphics for the y510p card. I was wondering if anyone k

  • Problem installing iTunes - error message "could not open key".

    Suddenly, I was unable to open ITunes error indicating that another file is in use, even if no other program has been opened.  I installed RegServ to clean the registry and uninstalled ITunes.  When I try to reinstall ITunes, I get the following erro