Problems returning VARRAY (or  TABLE) / method  on _IOraDatabase failure

I am trying to return a VARRAY through OO4O (currently using VB6) but am getting an error back that I don't seem to be able to resolve.
The SQL procedure is declared as:
PROCEDURE "RD_GET_TOPOAREAS2_SIZED" (
minX IN NUMBER, minY IN NUMBER, maxX IN NUMBER, maxY IN NUMBER,
maxArea IN NUMBER, dt IN DATE, timing OUT NUMBER,
IDLIST OUT v_numArray, RETDATA OUT NOCOPY t_cursor
types are defined in the package spec as:
TYPE t_cursor IS REF CURSOR ;
TYPE v_numArray IS VARRAY(20000) OF NUMBER;
TYPE nt_numArray IS TABLE OF NUMBER;
The calling code is:
Dim odb As OraDatabase
Dim oparams As OraParameters
Dim odyn As OraDynaset
Set oparams = odb.Parameters
oparams.Add "minx", 406000, ORAPARM_INPUT, ORATYPE_NUMBER
oparams.Add "miny", 259000, ORAPARM_INPUT, ORATYPE_NUMBER
oparams.Add "maxx", 410000, ORAPARM_INPUT, ORATYPE_NUMBER
oparams.Add "maxy", 261000, ORAPARM_INPUT, ORATYPE_NUMBER
oparams.Add "maxarea", 100, ORAPARM_INPUT, ORATYPE_NUMBER
oparams.Add "dt", Null, ORAPARM_INPUT, ORATYPE_DATE
oparams.Add "time", 0, ORAPARM_OUTPUT, ORATYPE_NUMBER
oparams.Add "IDLIST", Null, ORAPARM_OUTPUT,
ORATYPE_VARRAY, "V_NUMARRAY"
oparams.Add "RETDATA", Null, ORAPARM_OUTPUT, ORATYPE_CURSOR
Set odyn = odb.CreatePlsqlDynaset(sql, "RETDATA", 8)
Calling the sql gives me the following error message:
Run-time error: '-2147417848 (80010108)':
Method 'CreatePlsqlDynaset' of object '_IOraDatabase' failed
I have also tried passing the parameter as:
oparams.AddTable "IDLIST", ORAPARM_OUTPUT, ORATYPE_NUMBER, 20000
but this gives me a parameter type mismatch.
Ideally, I would prefer to return the data in a nested table (type nt_numArray),
but I can't get the call to work with that either (same error).
I've seen the other couple of posts on this subject, and the fact that a bug giving the same error message was supposed to have been fixed in v 4.3.
I am currently using the version that came with 11.1.0.6.20 which is v 5.0 I think.
What's going wrong, and how can I fix it?
Richard

Forgot to add the calling sql:
sql = "begin rd_get_topoareas2_sized " + _
(:minx,:miny,:maxx,:maxy,:maxarea,:dt,:time,:IDLIST,:R
ETDATA); end;"
RichardThat is, I forgot to add that line to the problem, NOT that that was what was causing it!

Similar Messages

  • How to return an internal table with methods ?

    Hi,
    I am an Java programmer and very new to ABAP.
    How do I return a internal table with a method? I have the table GP1_PRODUCTS and want to return a copy of this table as an internal table called PRODUCTS.
    Here is my code that does not work:
    class PRODUCTS definition
      public
      final
      create public .
    public section.
    *"* public components of class PRODUCTS
    *"* do not include other source files here!!!
      methods GET_PRODUCT_LIST
        returning
          value(PRODUCTS) type GP1_PRODUCTS .
    protected section.
    *"* protected components of class PRODUCTS
    *"* do not include other source files here!!!
    private section.
    *"* private components of class PRODUCTS
    *"* do not include other source files here!!!
    ENDCLASS.
    CLASS PRODUCTS IMPLEMENTATION.
    * <SIGNATURE>---------------------------------------------------------------------------------------+
    * | Instance Public Method PRODUCTS->GET_PRODUCT_LIST
    * +-------------------------------------------------------------------------------------------------+
    * | [<-()] PRODUCTS                       TYPE        GP1_PRODUCTS
    * +--------------------------------------------------------------------------------------</SIGNATURE>
    method GET_PRODUCT_LIST.
    DATA: it_products TYPE STANDARD TABLE OF GP1_PRODUCTS.
    select * from GP1_PRODUCTS into table it_products.
    PRODUCTS = it_products.
    endmethod.
    ENDCLASS.

    You have to create a table type for your table GP1_PRODUCTS.
    If you use global class (created in SE24), than:
    Create a Table Type in SE11
    Go to SE11, Enter a name like ZPRODUCTS in the Data Type
    There will be popup when you press the Create button to decide a type. Select the Table Type
    Enter  GP1_PRODUCTS  in the Line Type.
    * method declaration
      methods GET_PRODUCT_LIST
        returning
          value(PRODUCTS) type ZPRODUCTS.
    If you use local class:
    TYPES: ty_products type standard table of GP1_PRODUCTS..
    * method declaration
      methods GET_PRODUCT_LIST
        returning
          value(PRODUCTS) type ty_products
    Regards,
    Naimesh Patel

  • Problems with a hash table

    hi, i have a CountryTable class which i want to implement as a hash table:
    import java.util.*;
    class CountryTable {
         static int count = 0;
         private HashMap table = new HashMap();
         public void addEntry(Colour key, Country country) {
              table.put(key, country);
              count++;
         public Country getCountry(Colour key) {
              return (Country)table.get(key);
         static int getCount() {
              return count;
    The object which are returned from this table is Country:
    class Country {
         //static variables
         static int count = 0;
         //instance variables
         private String name;
         private Colour base;
         //constructor
         Country(String name, Colour base) {
              this.name = name;
              this.base = base;
              count++;
         //return the number of objects created
         static int getCount() {
              return count;
         //return the name
         public String getName() {
              return name;
         public Colour getColour() {
              return base;
    The key for the has table is the class Colour, which includes a hashCode() method:
    class Colour {
         public int rgb;
         Colour(int rgb) {
              this.rgb = rgb;
         public int hashCode() {
              return rgb * -1;
    I implement these classes in a program as follows:
    CountryTable index = new CountryTable();
              Colour colour1 = new Colour(-3473408);
              Country argentina = new Country("Argentina", colour1);
              index.addEntry(colour1, argentina);
              Colour colour2 = new Colour(-131072);
              Country brazil = new Country("Brazil", colour2);
              index.addEntry(colour2, brazil);
                        Colour col = new Colour(or);
                        Country coun = index.getCountry(col);
                        System.out.println(coun.getName());
    I have a list of many countries which i set up, with their relevant countires with which they are associated.
    The variable 'or' contains an RGB value which has been returned elsewhere in the program. The problem that i have is that when a colour is passed into the getCountry() method, nothing is returned and a "nullPointerException" is thrown, even though a colour with which i set up a country was passed in???
    Anyone got any ideas where im going wrong?
    Many thanks Cath

    keeping the other two files same you change the CountryTable to this
    import java.util.*;
    class CountryTable {
    static int count = 0;
    private HashMap table = new HashMap();
    public void addEntry(Colour key, Country country) {
    table.put(key.rgb+"" ,country.getName());
    count++;
    public String getCountry(Colour key) {
    return (String)table.get(key.rgb+"");
    static int getCount() {
    return count;
    public static void main (String args[]){
         CountryTable index = new CountryTable();
    Colour colour1 = new Colour(-3473408);
    Country argentina = new Country("Argentina",colour1);
    index.addEntry(colour1, argentina);
    Colour colour2 = new Colour(-131072);
    Country brazil = new Country("Brazil",colour2);
    index.addEntry(colour2, brazil);
    System.out.println(index.table);
    String coun = index.getCountry(colour2);
    System.out.println(coun);
    }and now try

  • Help: problem with OS/2 table

    I try programmicaly read OS/2 table.
    First part of table I read without problems, but with the second there are some problems. For example, I want obtain fsSelection value, and for any font this value equal 32(bold). When I obtain macStyle from HEAD table, all right. But values of macStyle and fsSelection must be identical! In what there can be a problem?

    My Code:
    But in panose and vendor information is right. And method of working with tables is the same. But problems only with this table, and I don't know why :(
    typedef struct _tagTT_OFFSET_TABLE{
    USHORT uMajorVersion;
    USHORT uMinorVersion;
    USHORT uNumOfTables;
    USHORT uSearchRange;
    USHORT uEntrySelector;
    USHORT uRangeShift;
    }TT_OFFSET_TABLE;
    typedef struct _tagTT_TABLE_DIRECTORY{
    char szTag[4]; //table name
    ULONG uCheckSum; //Check sum
    ULONG uOffset; //Offset from beginning of file
    ULONG uLength; //length of the table in bytes
    }TT_TABLE_DIRECTORY;
    typedef struct _tagTT_OS_RECORD{
    USHORT version;
    SHORT xAvgCharWidth;
    USHORT usWeightClass;
    USHORT usWidthClass;
    SHORT fsType;
    SHORT ySubscriptXSize;
    SHORT ySubscriptYSize;
    SHORT ySubscriptXOffset;
    SHORT ySubscriptYOffset;
    SHORT ySuperscriptXSize;
    SHORT ySuperscriptYSize;
    SHORT ySuperscriptXOffset;
    SHORT ySuperscriptYOffset;
    SHORT yStrikeoutSize;
    SHORT yStrikeoutPosition;
    SHORT sFamilyClass;
    PANOSE panose;
    ULONG ulUnicodeRange1;
    ULONG ulUnicodeRange2;
    ULONG ulUnicodeRange3;
    ULONG ulUnicodeRange4;
    CHAR achVendID[4];
    USHORT fsSelection;
    USHORT usFirstCharIndex;
    USHORT usLastCharIndex;
    USHORT sTypoAscender;
    USHORT sTypoDescender;
    USHORT sTypoLineGap;
    USHORT usWinAscent;
    USHORT usWinDescent;
    ULONG ulCodePageRange[2];
    }TT_OS_RECORD;
    // structure for writing results
    typedef struct _tagFONT_PROPERTIES{
    CString csName;
    USHORT Weight;
    USHORT Width;
    BOOL bItalic;
    BOOL bUnderline;
    BOOL bStrikeOut;
    USHORT uFamily;
    }FONT_PROPERTIES, *LPFONT_PROPERTIES;
    // from Big Endian to Little Endian
    #define SWAPWORD(x) MAKEWORD(HIBYTE(x), LOBYTE(x))
    #define SWAPLONG(x) MAKELONG(SWAPWORD(HIWORD(x)), SWAPWORD(LOWORD(x)))
    LPFONT_PROPERTIES lpFontProps = new FONT_PROPERTIES;
    CString pstrName = "C:\\WINDOWS\\Fonts\\ANTQUABI.TTF";
    lpFontProps->csName = "";
    GetFontPropertiesFromOS(pstrName, lpFontProps);
    BOOL CMyDlg::GetFontPropertiesFromOS(LPCTSTR lpszFilePath, LPFONT_PROPERTIES lpFontProps)
    CFile f;
    BOOL bRetVal = FALSE;
    if(f.Open(lpszFilePath, CFile::modeRead|CFile::shareDenyWrite)){
    TT_OFFSET_TABLE ttOffsetTable;
    f.Read(&ttOffsetTable, sizeof(TT_OFFSET_TABLE));
    ttOffsetTable.uNumOfTables = SWAPWORD(ttOffsetTable.uNumOfTables);
    ttOffsetTable.uMajorVersion = SWAPWORD(ttOffsetTable.uMajorVersion);
    ttOffsetTable.uMinorVersion = SWAPWORD(ttOffsetTable.uMinorVersion);
    //check is this is a true type font and the version is 1.0
    if(ttOffsetTable.uMajorVersion != 1 || ttOffsetTable.uMinorVersion != 0)
    return bRetVal;
    TT_TABLE_DIRECTORY tblDir;
    BOOL bFoundOS = FALSE;
    CString csTemp;
    for(int i=0; i< ttOffsetTable.uNumOfTables; i++){
    f.Read(&tblDir, sizeof(TT_TABLE_DIRECTORY));
    strncpy(csTemp.GetBuffer(5), tblDir.szTag, 4);
    csTemp.ReleaseBuffer(4);
    if(csTemp.CompareNoCase(_T("OS/2")) == 0){
    bFoundOS = TRUE;
    tblDir.uLength = SWAPLONG(tblDir.uLength);
    tblDir.uOffset = SWAPLONG(tblDir.uOffset);
    break;
    else if(csTemp.IsEmpty())
    break;
    if(bFoundOS)
    int nPos = f.GetPosition();
    f.Seek(tblDir.uOffset, CFile::begin);
    TT_OS_RECORD ttOSRecord;
    bFoundOS = FALSE;
    if(lpFontProps->csName.IsEmpty())
    f.Read(&ttOSRecord, sizeof(TT_OS_RECORD));
    ttOSRecord.version = SWAPWORD(ttOSRecord.version);
    lpFontProps->Weight = SWAPWORD(ttOSRecord.usWeightClass);
    lpFontProps->Width = SWAPWORD(ttOSRecord.usWidthClass);
    ttOSRecord.sFamilyClass = SWAPWORD(ttOSRecord.sFamilyClass);
    // high byte of this field contains the family class
    BYTE hb = HIBYTE(ttOSRecord.sFamilyClass);
    // low byte contains the family subclass
    BYTE lb = LOBYTE(ttOSRecord.sFamilyClass);
    ttOSRecord.fsSelection = SWAPWORD(ttOSRecord.fsSelection); // this is always 32
    lpFontProps->uFamily = ttOSRecord.panose.bFamilyType;
    ttOSRecord.usFirstCharIndex = SWAPWORD(ttOSRecord.usFirstCharIndex);
    bRetVal = TRUE;
    f.Close();
    return bRetVal;

  • Problem w/ Oracle Spread Table Control Properties -

    Dear Contributors:
    I'm using Developer 6i. In an attempt to use Oracle Spread Table Control, I've inserted the right ActiveX in my Form and imported associated OLE library interfaces. However, when I went to inspect and change properties 2 of the tab pages titled
    1) Special and
    2) User Actions
    showed 'MMTX32' Caution Alert w/ a message of:
    "An ussupported operation was attempted."
    Any suggestion friends?

    Yes it have a connection method, the problem here is that this control returns a SCODE value, and i don't know where it is specified to return variables.
    Database Methods
    SCODE Connect(BSTR* database, BSTR* user, BSTR* password, long options);
         Connect to the given database as the given user. options determines
         the type of database connection. See Appendix A: Database Connection Types
         for more information. If the connection fails, Connect will return S_FALSE

  • Unique Problem: Returning SOAP+ Attachment using a class based webservice

    Hi everyone,
    Im trying to return a Soap+ attachment response back using the following:
    attachDoc(byte[] bdoc, String sTransactionNumber,
                   String sRequestedType)
    Where byte[] is the attachment and the 2 string parameters are soap message contents.
    The attachment is attached successfully to the message and i can send a response back to the clients console using :
    message.writeTo(System.out);
    My problem is that i dont know how to return this soapmessage+attachment back to the client.
    Ive tried using the return type of the method as :
    public SOAPMessage attachDoc(byte[] bdoc, String sTransactionNumber,
                   String sRequestedType)
    but i cant return a SOAPMessage return type in axis.
    Does anyone have any clues how i should sort this out so that the client gets the SOAPMessage and attachment when the method is called ?
    Please help :S
    Thanks,

    I dunno if this is what you asked for....
    Hope this helps a bit
    You may want to check this link out
    http://www-unix.globus.org/mail_archive/discuss/2007/02/msg00037.html
    MessageContext msgContext = MessageContext.getCurrentContext();
    File file = new File("filename.txt");
    org.apache.axis.attachments.AttachmentPart replyPart=
    new org.apache.axis.attachments.AttachmentPart(new DataHandler(new
    FileDataSource(file)));
    Message rspMsg= msgContext.getResponseMessage();
    rspMsg.addAttachmentPart(replyPart);
    so ur basically adding the file to the reply message.
    The link i gave has a better description, it has the entire process of sending file to server and downloading file from server codes.

  • How to know that a method has been called and returning value of a method

    Hi, everyone! I have two questions. One is about making judgment about whether a method has been called or not; another one is about how to return "String value+newline character+String value" with a return statement.
    Here are the two original problems that I tried to solve.
    Write a class definition of a class named 'Value' with the following:
    a boolean instance variable named 'modified', initialized to false
    an integer instance variable named 'val'
    a constructor accepting a single paramter whose value is assigned to the instance variable 'val'
    a method 'getVal' that returns the current value of the instance variable 'val'
    a method 'setVal' that accepts a single parameter, assigns its value to 'val', and sets the 'modified' instance variable to true, and
    a boolean method, 'wasModified' that returns true if setVal was ever called.
    And I wrote my code this way:
    public class Value
    boolean modified=false;
    int val;
    public Value(int x)
    {val=x;}
      public int getVal()
      {return val;}
       public void setVal(int y)
        val = y;
        modified = true;
         public boolean wasModified()
          if(val==y&&modified==true)
          return true;
    }I tried to let the "wasModified" method know that the "setVal" has been called by writing:
    if(val==y&&modified==true)
    or
    if(x.setVal(y))
    I supposed that only when the "setVal" is called, the "modified" variable will be true(it's false by default) and val=y, don't either of this two conditions can prove that the method "setVal" has been called?
    I also have some questions about the feedback I got
    class Value is public, should be declared in a file named Value.java
    public class Value
    cannot find symbol
    symbol  : variable y
    location: class Value
    if(val==y&&modified==true)
    *^*
    *2 errors*
    I gave the class a name Value, doesn't that mean the class has been declared in a file named Value.java*?
    I have declared the variable y, why the compiler cann't find it? is it because y has been out of scale?
    The other problem is:
    Write a class named  Book containing:
    Two instance variables named  title and  author of type String.
    A constructor that accepts two String parameters. The value of the first is used to initialize the value of  title and the value of the second is used to initialize  author .
    A method named  toString that accepts no parameters.  toString returns a String consisting of the value of  title , followed by a newline character, followed by the value of  author .
    And this is my response:
    public class Book
    String title;
    String author;
      public Book(String x, String y)
       { title=x; author=y; }
       public String toString()
       {return title;
        return author;
    }I want to know that is it ok to have two return statements in a single method? Because when I add the return author; to the method toString, the compiler returns a complain which says it's an unreachable statement.
    Thank you very much!

    Lets take this slow and easy. First of all, you need to learn how to format your code for readability. Read and take to heart
    {color:0000ff}http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html{color}
    Now as to your first exercise, most of it is OK but not this:   public boolean wasModified()
          if (val == y && modified == true)
                return true;
    y being a parmeter to the setValue method exists only within the scope of that method. And why would you want to test that anyways? If modified evaluates to true, that's all you need to know that the value has been modified. So you could have   public boolean wasModified()
          if (modified == true)
                return true;
       }But even that is unnecessarily verbose, as the if condition evaluates to true, and the same is returned. So in the final analysis, all you need is   public boolean wasModified()
          return modified;
       }And a public class has to be declared in a file named for the class, yes.
    As for your second assignment, NO you cannot "return" two variables fom a method. return means just that: when the return statement is encountered, control returns to the calling routine. That's why the compiler is complaining that the statement following the (first) return statement is unreachable.
    Do you know how to string Strings together? (it's called concatenation.) And how to represent a newline in a String literal?
    db

  • Problem returning a two-dimensional array in web service

    Hello. I'm having problems returning a two dimensional array in my web service. The service returns a MyClass[][] correctly, but the client receives a different one.
    I've done a test that returns a MyClass[1][1] an the client shows a MyClass[1][20]. All the MyClass objects returned in the array are the same and all it's fields are null. There's even an element of the array containing null instead of the object. As I say, the service creates the array ok, but the client gets other thing.
    I have other methods returning one-dimensional arrays MyClass[] and I have no problem.
    My system:
    WindowsXP
    Tomcat 5.5 (Axis 1.3?)
    JDK 1.5
    Eclipse 3.3
    My wsdl is generated with eclipse, although I've had to update my wsdd manually.
    Any Ideas?
    Thanks.

    Does it have to be stored in an array?
    Because you could use the java.awt.Point class, and a
    java.util.Set to create random points until you have
    the correct number of unique points.Of course it is no must to store it in an array. it was just my first thought of approaching the problem. I will try the Point.class. Thanks for that hint.

  • Problem with MixingFloatAudioInputStream.java available() method

    I've always been under the impression that the available() method for an AudioInputStream +returns the maximum number of bytes that can be read (or skipped over) from this audio input stream without blocking+.
    Unfortunately, this doesn't seem to be the case for the available() method in the MixingFloatAudioInputStream class (found on jsresources).
          * The minimum of available() of all input stream is calculated and
          * returned.
         public int available() throws IOException {
              int nAvailable = 0;
              Iterator streamIterator = audioInputStreamList.iterator();
              while (streamIterator.hasNext()) {
                   AudioInputStream stream = (AudioInputStream) streamIterator.next();
                   nAvailable = Math.min(nAvailable, stream.available());
              return nAvailable;
         }Is there a reason why this specific method returns the minimum as opposed to the maximum number of bytes? Can I simply just modify the Math.min function to Math.max to revert it back to its normal behavior?

    Once again, great explanation.
    Like you noticed, I thought that the available() method implied total length minus amount processed so far... Because of this, I decided to use it to measure the length of an InputStream, used in an audio fade class (I've started another thread on this topic with more details).
    public FadeFilterInputStream(InputStream inputStream){
            super(inputStream);
            try {
                streamLength = super.available();
            } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(0);
            fadeLengthBegin = (int) ((0.8)*streamLength);
            fadeLengthEnd = (int) ((0.15)*streamLength);
    } Seeing that FadeFilterInputStream extends FilterInputStream, I can only use an InputStream. Unfortunately, unlike the AudioInputStream, it doesn't have a getFrameLength() method to measure the length of the stream. I tried getting creative with the "available()" method instead.
    What got me thinking that the available() method implied total length minus amount processed so far was the following output from my code:
    available():317520000  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317515904  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317511808  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317507712  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317503616  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317499520  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317495424  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317491328  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317487232  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317483136  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317479040  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317474944  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317470848  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317466752  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317462656  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317458560  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317454464  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317450368  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    available():317446272  length_read:4096  streamLength:317520000  fadeLengthBegin:254016000  fadeLengthEnd:47628000
    ...Like you mentioned, seeing that the combined AudioInputStreams were all the same length, it didn't cause me any problems when I modified the method to find the maximum length of the longest stream. From your explanation, this might not be the case if I decide to combine streams of different lengths.
    Using the available() method to measure the total length of the InputStream is probably not the best way to approach this problem. Any ideas?
    +On a side note, according to your example, shouldn't the available() method be returning the same value until the end (in this case 2 seconds worth of bytes)? That doesn't seem to be the case from my output.+

  • How to return a entire table from a Function in Oracle?

    Can anyone pls let me know if there is some way to return an entire table from a function which is called from a stored procedure?
    Thanks

    > Can anyone pls let me know if there is some way to return an entire table from a function which
    is called from a stored procedure?
    For what purpose?
    Do you realise that this means pulling Megabytes (or even many Gugabytes) of data from disk, into the buffer cache, and then copying that data into PL/SQL memory (using a function) in order to give a stored proc that data?
    This is just plain crazy.. resource wise, performance wise, scalability wise.. this is exactly how NOT to use Oracle.
    Why don't you instead tell us what problem you want to solve. Forget for the moment what you think the solution should be. (and asking us how to get a potentially flawed solution, to work)
    Let's get an accurate problem definition so that we can provide you with suggestions and recommendation on what Oracle features can be used to address that problem.

  • Varray, Nested Table and Object types in OWB r2

    Requirement:
    Flat file with repeating groups of nested content need to move into Object Relational ORACLE table (using varray or nested tables - no preference). The data will be loaded, then mapped/transformed into a richer O-R output to directly produce XML outputs.
    Problem:
    Generated PL/SQL "seems" to do the correct thing, but deployment errors show failures on mapping of collections (varrays, NTs or OTs) and in sqlplus recompiling the PKB still gives the errors. Is this a PL/SQL generator error, or is there a more meaningful example of using CONSTRUCT OBJECT operator than the embedded odcumentation - it is a simple type (single instance) and not a variable repeating group of nested data.
    Anyone had any success with these, or know of any collateral to assist in the process. Thanks.

    The process we are following is very simple. We are talking 10 columns from a source flat file table and wish to map this into a Varray/Nested table, with one column of Varchar2(10).
    When you create your map in OWB, select the construct object, you have to choose an object type - it does not allow you to select a VARAAY or NESTED table.
    I have then created an object defined in the same structure as the VARRAY/NESTED table - I have then made the VARRAY/NESTED table of this TYPE.
    Example:
    CREATE OR REPLACE TYPE "O_REL_PUB_INDEX" AS OBJECT (
    X_REL_PUB_INDEX_1 VARCHAR2(10))
    CREATE OR REPLACE TYPE "V_REL_PUB_INDEX" AS VARRAY(15) OF O_REL_PUB_INDEX
    In OWB you can then select O_REL_PUB_INDEX when creating the 'Contruct Object'.
    The problem I have is that when I map to my target column of type V_REL_PUB_INDEX and DEPLOY my map I get the following errors taken from OWB control centre
    Name
    Action
    Status
    Log
    TEST
    Create
    Warning
    ORA-06550: line 2931, column 9:
    PL/SQL: SQL Statement ignored
    TEST
    Create
    Warning
    ORA-06550: line 3174, column 11:
    PL/SQL: ORA-00932: inconsistent datatypes: expected OWB_USER.O_REL_PUB_INDEX got OWB_USER.V_REL_PUB_INDEX
    TEST
    Create
    Warning
    ORA-06550: line 401, column 7:
    PL/SQL: SQL Statement ignored
    TEST
    Create
    Warning
    ORA-06550: line 643, column 13:
    PL/SQL: ORA-00932: inconsistent datatypes: expected OWB_USER.O_REL_PUB_INDEX got OWB_USER.V_REL_PUB_INDEX
    TEST
    Create
    Warning
    ORA-06550: line 7221, column 9:
    PL/SQL: SQL Statement ignored
    TEST
    Create
    Warning
    ORA-06550: line 7464, column 11:
    PL/SQL: ORA-00932: inconsistent datatypes: expected OWB_USER.O_REL_PUB_INDEX got OWB_USER.V_REL_PUB_INDEX
    Any ideas? anyone succesfully mapped to either a VARRAY or an NESTED TABLE target column?

  • Using sql functions (min, max, avg) on varray or table collection

    Hi,
    I would like to know if there is a way to use sql function or oracle sql function like Min,Max, Avg or percentile_cont on varray or table collection ?
    Does anyone encountered this type of problem ?
    Thanks

    Yes you can apply Min,Max, Avg... if varray or table collection type is SQL (created in the databaase) UDF, not PL/SQL declared type:
    SQL> set serveroutput on
    SQL> declare
      2      type str_tbl_type is table of varchar2(4000);
      3      str_tbl str_tbl_type := str_tbl_type('X','A','D','ZZZ');
      4      max_val varchar2(4000);
      5  begin
      6      select max(column_value)
      7        into max_val
      8        from table(str_tbl);
      9      dbms_output.put_line('Max value is "' || max_val || '"');
    10  end;
    11  /
          from table(str_tbl);
    ERROR at line 8:
    ORA-06550: line 8, column 18:
    PLS-00642: local collection types not allowed in SQL statements
    ORA-06550: line 8, column 12:
    PL/SQL: ORA-22905: cannot access rows from a non-nested table item
    ORA-06550: line 6, column 5:
    PL/SQL: SQL Statement ignored
    SQL> create or replace type str_tbl_type is table of varchar2(4000);
      2  /
    Type created.
    SQL> declare
      2      str_tbl str_tbl_type := str_tbl_type('X','A','D','ZZZ');
      3      max_val varchar2(4000);
      4  begin
      5      select max(column_value)
      6        into max_val
      7        from table(str_tbl);
      8      dbms_output.put_line('Max value is "' || max_val || '"');
      9  end;
    10  /
    Max value is "ZZZ"
    PL/SQL procedure successfully completed.
    SQL> SY.

  • Getting return value of a method in an interface

    Hello! I have a problem. I have an interface called I. One of the declared method in this interface is M. And I have a class called C. Class C declares Interface I. I want to get the return value of the method M. I used invoke method. M.invoke(anInstance, arg[]). You can't take the instance of interfaces or abstract classes. If I use a class instead of instance for anInstance variable, i get "java.lang.IllegalArgumentException: object is not an instance of declaring class" error. If I use an instance, i get "java.lang.IllegalAccessException: Can not call newInstance() on the Class for java.lang.Class" error. This is because of getting an instance of an interface. if you can help me. i will be greatfully happy.

    Thanks for the feedback Tom although you should rethink what you said.
    I did not trash your suggestion, nor did I make any reference to it.
    Perhaps you should read the OP to see where you went wrong.
    OP wants to know return type of Interface's methodNo, the OP wants to obtain the return value.
    AND OP knows that instantiation won't work.He was trying to instantiate an Interface, which is not possible. In order for him invoke a Method he needs a concrete implementation. I was simply pointing out what he needs to do in order to acheive his aim.
    b) there may be no known implementing classes at
    runtimeIf there is no implementing class provided then he will not be able to invoke a method on its instance.
    c) even if there were such a class, instantiating it
    may have unwanted side effects, takes unnecessary
    timeWhy is that a problem? One reason for invoking M is to see what happens.
    the class may have N methods while the interface
    has only one, so you might look for the correct method
    too longIf you bothered to study the code I supplied I obtain a Method from the Interface class so there is no problem in "looking" for a method, besides which there can be exactly 1 method with a given signature in any class so there is no searching involved.
    On a personal note, such negative replies are neither helpful to the OP and can cause a credibility problem caused by being labelled a Troll.

  • Global Class that returns an internal table

    Hello,
       Is it possible to create a global class (under class builder) that returns an internal table like we used to do in a function module?
        e.g. call function '<Function module name>'
                        tables = i_tab.
    Thanks,
    Jeffrey

    Hi Jeffrey,
      Yeah u can do that by specifying importing parameters
      to method.You can give table type for the parameters.
    Thanks&Regards,
    Siri.

  • Returning Varrays to Client Technologies

    A lot of functions in my PL/SQL API return varrays.
    I've been getting some grief from programmer/users who call the APIs from various client technologies (PERL, Java). Their argument is that they are unable to work with the varray return type. When I point out that we frequently do so within the PL/SQL API's, they note that it is not possible outside PL/SQL.
    Do the complainers have a point? What's the best practice?

    I think (but am not positive) that if you use the thick JDBC driver you can use some of the Oracle-specific parameter types in Java. I know that you can access PL/SQL tables this way and I think I have seen references to varrays as well. You cannot access varrays using perl, ODBC, etc.
    The answer depends on how database-independant your client app needs to be and which client side code you are using. If it is perl you have no choice - either change the procedure calls or create a small wrapper procedure that will convert the varrays to/from something the perl code can use.
    If your are using JDBC you will need to determine if the thick driver is an option. If so (and you verify that you really CAN use varrays) it would probably be better to use them in cases where a result set is overkill or as a way to send batches of data to the server. This is where I have been PL/SQL tables; I pass in one table for each column and do a FOR EACH to insert them all at once.
    The JDBC Developer's Guide would tell you if varrays will work with Java.

Maybe you are looking for