Creating package-level associative array in java

风流意气都作罢 提交于 2019-12-01 05:10:58

问题


Is it possible to create a java representation of a package-level oracle associative array. For example, given the following:

CREATE OR REPLACE PACKAGE MyPackage AS
    TYPE t_numbers IS TABLE OF NUMBER INDEX BY PLS_INTEGER;

I find I cannot write the following java:

ArrayDescriptor descriptor =
    ArrayDescriptor.createDescriptor("MyPackage.t_numbers", connection);

(throws a SQLException "Invalid name pattern").

What is the correct syntax for an ArrayDescriptor referencing a package-level associative array? Does such a thing even exist?


回答1:


See http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:3696816290928 and especially http://download.oracle.com/docs/cd/B10501_01/java.920/a96654/oci_func.htm#1017512 .




回答2:


You can also use OracleConnection.createOracleArray()

Note that arrayTypeName should be the table of type.

Also, you may find my my answer on getArray() and writeArray() useful.



来源:https://stackoverflow.com/questions/457933/creating-package-level-associative-array-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!