Record Collection Count = 1, but Exists is return false?

Hi All,
OracleDB: 10g
I have a collection record I am using to store information in a sproc. Before I do any work with it I check if any data exists in the record (l_tab_cost_rec.EXISTS(1)).
What is strange is l_tab_cost_rec.EXISTS(1) is returning false, but l_tab_cost_rec.Count is returning a count = 1?
Why is Exists returning false, but the count is returning 1?
Record Definition:
TYPE type_cost_rec IS RECORD
(item_id NUMBER
,item_cost NUMBER
,org_id NUMBER
TYPE tab_cost_rec IS TABLE OF type_cost_rec INDEX BY BINARY_INTEGER;
l_tab_cost_rec tab_cost_rec;

Becaues exists(1) checks if an element exists that has index 1:
SQL> declare
  2  type t is table of number index by binary_integer;
  3  v t;
  4  begin
  5   v(0):=0;
  6   dbms_output.put_line('count='||v.count);
  7   if v.exists(1) then
  8      dbms_output.put_line('1 exists!');
  9   else
10      dbms_output.put_line('1 doesn''t exist!');
11   end if;
12   if v.exists(0) then
13      dbms_output.put_line('0 exists!');
14   else
15      dbms_output.put_line('0 doesn''t exist!');
16   end if;
17  end;
18  /
count=1
1 doesn't exist!
0 exists!
PL/SQL procedure successfully completed.Max
http://oracleitalia.wordpress.com

Similar Messages

  • Iam Using Gridview Cell Click Event to Check the Checkbox Status of the GridViewCheckboxCell. But It Always Return False Even it is Checked

      private void GridViewRoom_CellClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
                  if (e.ColumnIndex==19)
                       bool isChecked = Convert.ToBoolean(GridViewRoom.CurrentRow.Cells[e.ColumnIndex].Value);   // It Return False only, Even If it is Checked

    Telerik is a 3rd party company, please use their forums if you need help with using their controls:
    http://www.telerik.com/forums

  • File Exists Always returning false

    I am using the File.applicationStorageDirectory.resolvePath("myData.db") to reference the location of my SQLite DB file. When I browse to the folder in question I can see that the file is in fact there, however and traces I implement of dbfile.exists is false. It only ever returns true should I use my defaultdb and CopyTo the file of the myData.
    What seems to be the issue here?

    When I trace the nativePath of the file I am trying to find it shows "C:\Users\User\AppData\Roaming\Arakaron.debug\Local Store". This is the exact path I am following in Explorer. Now, instead of applicationStorageDirectory I can do documentsDirectory and it reads that the file is in fact there. With the applicationStorageDirectory it only registers that the file exists after I copy from the embedded db file. 

  • Regex: how can Matcher.matches return true, but Matcher.find return false?

    Consider the class below:
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    public class RegexBugDemo {
         private static final Pattern numberPattern;
         static {
                   // The BigDecimal grammar below was adapted from the BigDecimal(String) constructor.
                   // See also p. 46 of http://www.javaregex.com/RegexRecipesV1.pdf for a regex that matches Java floating point literals; uses similar techniques as below.
              String Sign = "[+-]";
              String Sign_opt = "(?:" + Sign + ")" + "?";     // Note: the "(?:" causes this to be a non-capturing group
              String Digits = "\\p{Digit}+";
              String IntegerPart = Digits;
              String FractionPart = Digits;
              String FractionPart_opt = "(?:" + FractionPart + ")" + "?";
              String Significand = "(?:" + IntegerPart + "\\." + FractionPart_opt + ")|(?:" + "\\." + FractionPart + ")|(?:" + IntegerPart + ")";
              String ExponentIndicator = "[eE]";
              String SignedInteger = Sign_opt + Digits;
              String Exponent = ExponentIndicator + SignedInteger;
              String Exponent_opt = "(?:" +Exponent + ")" + "?";
              numberPattern = Pattern.compile(Sign_opt + Significand + Exponent_opt);
    //     private static final Pattern numberPattern = Pattern.compile("\\p{Digit}+");
         public static void main(String[] args) throws Exception {
              String s = "0";
    //          String s = "01";
              Matcher m1 = numberPattern.matcher(s);
              System.out.println("m1.matches() = " + m1.matches());
              Matcher m2 = numberPattern.matcher(s);
              if (m2.find()) {
                   int i0 = m2.start();
                   int i1 = m2.end();
                   System.out.println("m2 found this substring: \"" + s.substring(i0, i1) + "\"");
              else {
                   System.out.println("m2 NOT find");
              System.exit(0);
    }Look at the main method: it constructs Matchers from numberPattern for the String "0" (a single zero). It then reports whether or not Matcher.matches works as well as Matcher.find works. When I ran this code on my box just now, I get:
    m1.matches() = true
    m2 NOT findHow the heck can matches work and find NOT work? matches has to match the entire input sequence, whereas find can back off if need be! I am really pulling my hair out over this one--is it a bug with the JDK regex engine? Did not seem to turn up anything in the bug database...
    There are at least 2 things that you can do to get Matcher.find to work.
    First, you can change s to more than 1 digit, for example, using the (originaly commented out) line
              String s = "01";yields
    m1.matches() = true
    m2 found this substring: "01"Second, I found that this simpler regex for numberPattern
         private static final Pattern numberPattern = Pattern.compile("\\p{Digit}+");yields
    m1.matches() = true
    m2 found this substring: "0"So, the problem seems to be triggered by a short source String and a complicated regex. But I need the complicated regex for my actual application, and cannot see why it is a problem.
    Here is a version of main which has a lot more diagnostic printouts:
         public static void main(String[] args) throws Exception {
              String s = "0";
              Matcher m1 = numberPattern.matcher(s);
              System.out.println("m1.regionStart() = " + m1.regionStart());
              System.out.println("m1.regionEnd() = " + m1.regionEnd());
              System.out.println("m1.matches() = " + m1.matches());
              System.out.println("m1.hitEnd() = " + m1.hitEnd());
              m1.reset();
              System.out.println("m1.regionStart() = " + m1.regionStart());
              System.out.println("m1.regionEnd() = " + m1.regionEnd());
              System.out.println("m1.lookingAt() = " + m1.lookingAt());
              System.out.println("m1.hitEnd() = " + m1.hitEnd());
              Matcher m2 = numberPattern.matcher(s);
              System.out.println("m2.regionStart() = " + m2.regionStart());
              System.out.println("m2.regionEnd() = " + m2.regionEnd());
              if (m2.find()) {
                   int i0 = m2.start();
                   int i1 = m2.end();
                   System.out.println("m2 found this substring: \"" + s.substring(i0, i1) + "\"");
              else {
                   System.out.println("m2 NOT find");
                   System.out.println("m2.hitEnd() = " + m2.hitEnd());
              System.out.println("m2.regionStart() = " + m2.regionStart());
              System.out.println("m2.regionEnd() = " + m2.regionEnd());
              System.out.println("m1 == m2: " + (m1 == m2));
              System.out.println("m1.equals(m2): " + m1.equals(m2));
              System.exit(0);
         }Unfortunately, the output gave me no insights into what is wrong.
    I looked at the source code of Matcher. find ends up calling
    boolean search(int from)and it executes with NOANCHOR. In contrast, matches ends up calling
    boolean match(int from, int anchor)and executes almost the exact same code but with ENDANCHOR. Unfortunately, this too makes sense to me, and gives me no insight into solving my problem.

    bbatman wrote:
    I -think- that my originally posted regex is correct, albeit possibly a bit verbose, No, there's a (small) mistake. The optional sign is always part of the first OR-ed part (A) and the exponent is always part of the last part (C). Let me explain.
    This is your regex:
    (?:[+-])?(?:\p{Digit}+\.(?:\p{Digit}+)?)|(?:\.\p{Digit}+)|(?:\p{Digit}+)(?:[eE](?:[+-])?\p{Digit}+)?which can be read as:
    (?:[+-])?(?:\p{Digit}+\.(?:\p{Digit}+)?)        # A
    |                                               # or
    (?:\.\p{Digit}+)                                # B
    |                                               # or
    (?:\p{Digit}+)(?:[eE](?:[+-])?\p{Digit}+)?      # COnly one of A, B or C is matched of course. So B can never have a exponent or sign (and A cannot have an exponent and C cannot have a sign).
    What you probably meant is this:
    (?:[+-])?                                   # sign       
        (?:\p{Digit}+\.(?:\p{Digit}+)?)         #   A
        |                                       #   or
        (?:\.\p{Digit}+)                        #   B
        |                                       #   or
        (?:\p{Digit}+)                          #   C
    (?:[eE](?:[+-])?\p{Digit}+)?                # exponent
    and that this must be a sun regex engine bug, but would love to be educated otherwise. Yes, it looks like a bug to me too.
    A simplified version of this behavior (in case you want to file a bug report) would look like this:
    When `test` is a single digit, m.find() returns _false_ but matches() returns true.
    When `test` is two or more digits, both return true, as expected.
    public class Test {
        public static void main(String[] args) {
            String test = "0";
            String regex = "(?:[+-])?(?:\\p{Digit}+\\.(?:\\p{Digit}+)?)|(?:\\.\\p{Digit}+)|(?:\\p{Digit}+)(?:[eE](?:[+-])?\\p{Digit}+)?";
            java.util.regex.Matcher m = java.util.regex.Pattern.compile(regex).matcher(test);
            System.out.println("matches() -> "+test.matches(regex));
            if(m.find()) {
                System.out.println("find()    -> true");
            } else {
                System.out.println("find()    -> false");
    }

  • File.exists() returns false for existing file, help :)

    Hi all,
    I'm having the STRANGEST behavior... I'm working on a simple DNS management system, and before I overwrite a zone file, I want to check if it exists... but exists() is returning false even when the file exists.
    Here is my code snippet:
    finest( "Checking the existance of "+filename ) ;
    File zoneFile = new File( filename ) ;
    if ( zoneFile.exists() ) {
        finest( "Zone File "+zoneFile+" already exists." ) ;
        throw( new ZoneFileExistsException( fqdn ) ) ;
    else {
        finest( "Creating Zone File "+zoneFile ) ;
        ...It's producing this in the log (I cut off the timestamp parts):
    Checking the existance of /opt/DNS/db.testingbutler222.com
    Creating Zone File /opt/DNS/db.testingbutler222.com
    but...
    # ls -l /opt/DNS/db.testingbutler222.com
    -rw-r--r-- 1 root other 733 Aug 27 19:23 /opt/DNS/db.testingbutler222.com
    So... as you can see, the file CLEARLY exists... what the heck am I doing wrong or misunderstanding? This can't really be a bug in File, can it?
    Kenny Smith

    Hi,
    Thanks for your response, but as I showed in my first post, I'm using absolute paths. My log file contains this:
    Checking the existance of /opt/DNS/db.testbutler222.com...
    Existance of /opt/DNS/db.testbutler222.com=false
    # ls -l /opt/DNS/db.testbutler222.com
    -rw-r--r-- 1 root other 695 Aug 29 12:17 /opt/DNS/db.testbutler222.com
    I don't understand what is happening... I wrote a separate class that just tests the existance of a file, and that one is reporting the existance correctly.... (the source code is found in the second post above) I don't understand why my servlet code can see the file.
    I have jakarta-tomcat running as root, and the file I'm checking was created by the same servlet. I've double checked permissions and such, just to make sure it wasn't that.. but it's still not working.
    I even added code to create a FileReader from the file, that way if it throws a FileNotFoundException, I would know the file doesn't exist... and even though the file does exist, it throws the exception. :(
    Kenny

  • BufferedReader.ready() keeps returning false using JSSE 1.0.2/jdk 1.2.2

    I'm running into difficulties reading a response data stream from a server via HTTPS. The SSL sets up fine (I can see both the client side and server side certificate chains, and the two sides can handshake and agree on a cipher (SSL_RSA_WITH_RC4_128_SHA in this case)). I get no errors getting the output or input streams from the socket, and the GET request seems to work (no errors reported by the PrintWriter), but in.ready() returns false, and the while loop exits immediately. But I know there is data available (I can paste the printed url into Netscape and get data back). Since this should not be all that complex once the SSL session is established, I'm probably missing something silly, Can someone tell me what it is please?
    Thanks
    Doug
    // code excerpt
    // just finished printing the cipher suite, cert chains, etc
    try{
    out = new PrintWriter(
    new BufferedWriter(
    new outputStreamWriter(socket.getOutputStream() )));
    } catch(Exception e) {
    System.out.println("Error getting input and output streams from socket ");
    System.out.println(e.getMessage());
    e.printStackTrace();
    throw(e);
    try{   // time to submit the request and get the data
    // build the URL to get
    // tried constructing it here and nailing it up at declaration time - no difference
    // path = "https://" + dlp.host + ":" + Integer.toString(dlp.port) + "/" +
    // dlp.basePath + "?StartDate=" + longDateFmtURL.format(dlp.startDate) +
    // "&EndDate=" + longDateFmtURL.format(dlp.endDate);
    System.out.println("Sending request for URL" );
    System.out.println(path);
    out.println("GET " + path );
    out.println();
    out.flush();
    * Make sure there were no errors
    if (out.checkError()){
    System.out.println("Error sending request to server");
    throw(new IOException("Error sending request to server")
    try{
         in = new BufferedReader(
              new InputStreamReader(
              socket.getInputStream() ));
    } catch(Exception e) {
    System.out.println("Error getting input stream from socket ");
    System.out.println(e.getMessage());
    e.printStackTrace();
    //System.exit(3);
    throw(e);
    if (!in.ready()) {   //  in.ready() keeps returning false
    System.out.println("Error - socket input stream not ready for reading");
    while ((inputLine = in.readLine()) != null) {
    // loop over and process lines if it was ever not null
    }

    Never mind.
    The problem seems to be related to the development/debugging enviroment (Oracle JDeveloper 3.2.3), When I run things outside of that eviroment using the "plain" runtime, it works as expected (back to System.out.println() for debugging). That said, I usually find it to be a nice development/debugging enviroment for Java.

  • CanInvoke returning false while downloading attachment

    Hi,
    I have code which sends a file to a client & on another side I'm receiving it using ContentAdded event. That event gets raised but CanInvoke is returning false. Where I'm getting wrong?
    How to give download priviledges to all participants in the conversation?
    void _sharingModality_ContentAdded(object sender, ContentCollectionChangedEventArgs e)
    if (e.Item.Type == ShareableContentType.NativeFile)
    int hr;
    if (e.Item.CanInvoke(ShareableContentAction.DownloadFile, out hr))
    MessageBox.Show("download event raised");
    else
    MessageBox.Show("u cannot invoke download");
    Thanks!
    (Note: I'm using Lync client 2013)

    For Lync client development, it is more appropriate to post in the following forum:
    http://social.msdn.microsoft.com/Forums/lync/en-US/home?forum=communicatorsdk.
    You can get a better response there.
    Lisa Zheng
    TechNet Community Support

  • Connect by Level using count value from record collection

    Hello:
    PROBLEM:
    ) y,(select rownum MonthNo from dual connect by level <= Cnt)
    Causes ORA-00904 Invalid identifier. Why can’t I use “Cnt” from my main query as using a constant works?
    The count value is determined for each date range in How can I return the records I need?
    Thanks, Sidney
    BACKGROUND:
    I need to be able to display a list of tax returns to my users and the status of those returns. Physical returns do not exist so it is necessary to create the data records dynamically using appropriate selects. This is not difficult and I thought I could then just use a connect by level to give me the date information so I could calculate and display the individual returns. However oracle is giving me an ORA-00904 when I try to send the “Cnt” value to connect by level. Everything works fine when I provide a constant instead of “CNT”. The “CNT” value is determined by a complex process that computes the start and stop dates for multiple return types, etc. as well as the number of periods and filing frequency. The data has to be dynamically generated using a master record which then yields the coding history from which my basic record collection is selected. Here is the result of that process:
    TaxpayerNo,TaxClass,TaxCode,FilingFequency,StartDate,StopDate,Cnt,Frequency
    10 S 1 M 6/1/2007 11/30/2008 18 12
    10 S 2 M 11/30/2008 9/30/2009 10 12
    10 S 2 Q 11/30/2010 8/18/2011 3 4
    10 L 8 A 6/1/2007 9/30/2009 3 1
    10 L 8 A 11/30/2010 8/18/2011 1 1
    From this data, I need a record for each individual month,quarter,etc. ie:
    10 S 1 M 6/1/2007 11/30/2008 18 12 6/1/2007
    10 S 1 M 6/1/2007 11/30/2008 18 12 7/1/2007
    10 S 1 M 6/1/2007 11/30/2008 18 12 8/1/2007
    10 S 1 M 6/1/2007 11/30/2008 18 12 9/1/2007
    10 S 2 M 11/30/2008 9/30/2009 10 12 11/30/2008
    10 S 2 M 11/30/2008 9/30/2009 10 12 12/30/2008
    etc.
    DOES NOT WORK
    select y.*,MonthNo,Add_Months(StartDate,MonthNo*Frequency) from (
    select x.*,
    (case when FilingFrequency = 'M' then Ceil(Months_Between(StopDate,StartDate))
    when FilingFrequency = 'Q' then Ceil(Months_Between(StopDate,StartDate)/3)
    when FilingFrequency = 'A' then Ceil(Months_Between(StopDate,StartDate)/12)
    else 0
    end) Cnt,
    (case when FilingFrequency = 'M' then 1
    when FilingFrequency = 'Q' then 3
    when FilingFrequency = 'A' then 12
    end) Frequency
    from (
    ... complex code to calculate the values of the start and stop dates needed above...
    ) x
    ) y,(select rownum MonthNo from dual connect by level <= Cnt)
    ERROR MESSAGE
    This returns ORA-00904: "CNT": Invalid Identifier. I don't get an error if I use a constant:
    WORKS USING A CONSTANT BUT MUST HAVE THE ACTUAL CNT VALUE
    ... Same code to generate data ...
    ) y,(select rownum MonthNo from dual connect by level <= 3)
    How can I get this to work using the "CNT" value instead of a constant?

    A technique like this should fix your problem.
    TUBBY_TUBBZ?with data (col1, cnt) as
      2  (
      3    select 1, 3 from dual
      4      union all
      5    select 2, 2 from dual
      6  )
      7  select
      8    d.col1,
      9    t.column_value
    10  from
    11    data  d,
    12    table(cast(multiset(select level from dual connect by level <= d.cnt) as sys.OdciNumberList)) t;
                  COL1       COLUMN_VALUE
                     1                  1
                     1                  2
                     1                  3
                     2                  1
                     2                  2
    5 rows selected.
    Elapsed: 00:00:00.00
    TUBBY_TUBBZ?As opposed to what you have now, which is basically this
    TUBBY_TUBBZ?with data (col1, cnt) as
      2  (
      3    select 1, 3 from dual
      4      union all
      5    select 2, 2 from dual
      6  )
      7  select
      8    d.col1,
      9    level
    10  from
    11    data  d
    12  connect by level <= d.cnt;
                  COL1              LEVEL
                     1                  1
                     1                  2
                     1                  3
                     2                  2
                     1                  3
                     2                  1
                     1                  2
                     1                  3
                     2                  2
                     1                  3
    10 rows selected.
    Elapsed: 00:00:00.00
    TUBBY_TUBBZ?

  • Query returns record in SQL Developer but not in iSQLPlus

    ... back in a minute, I may not have done a commit at the end of the insert.
    The problem I was having was I hadnt commited the record in SQL Developer but the queries where returning records in this environment but not in iSQLPlus or Apex and it was confusing me.
    Message was edited by:
    Benton
    Message was edited by:
    Benton

    Finally got to know the reason why Timezone Abbr woudn't show up in SQL Plus.
    I ran below query in SQL PLUS
    SELECT SESSIONTIMEZONE, CURRENT_TIMESTAMP, systimestamp, LOCALTIMESTAMP FROM DUAL;
    SESSIONTIMEZONE CURRENT_TIMESTAMP SYSTIMESTAMP LOCALTIMESTAMP
    -05:00 08-SEP-12 12.00.31.575228 AM -05:00 08-SEP-12 12.00.31.575223 AM -05:00 08-SEP-12 12.00.31.575228 AM
    Now executed the same query in SQL Developer:
    SESSIONTIMEZONE CURRENT_TIMESTAMP SYSTIMESTAMP LOCALTIMESTAMP
    America/Chicago     08-SEP-12 12.08.32.072424000 AM AMERICA/CHICAGO     08-SEP-12 12.08.32.072420000 AM -05:00     08-SEP-12 12.08.32.072424000 AM
    The difference between the 2 outputs is the way in which time_zones were respresented. In SQL PLUS, it is shown as an offset whereas in SQL Developer as a time zone region name. Now there are many "time sone regions" that follow an offset of -5:00. This confuses Oracle and a "UNK"(Unknown) for a query like the one below when trying to execute in SQL PLUS:
    select extract(timezone_abbr from from_tz(cast(sysdate as timestamp),SESSIONTIMEZONE)) from dual;
    EXTRACT(TI
    UNK
    Therefore we need to specify the exact Time Zone Region(TZR) in order to obtain the corresponding TZD(Daylight Savings Format i.e. CDT or CST). This we do by altering the session environment vaiable time_zone
    alter session set time_zone='America/Chicago';
    Now executing the queries to find the abbreviated time zone( in TZD format) will finally work to return a non-null char value.
    select extract(timezone_abbr from from_tz(cast(sysdate as timestamp),SESSIONTIMEZONE)) from dual;
    EXTRACT(TI
    CDT
    select to_char(CURRENT_TIMESTAMP, 'TZD') from dual;
    TO_CHA
    CDT

  • OracleBulkCopy have memory leak  if BatchSize is less than record's count.

    OracleBulkCopy::WriteToServer(IDataReader reader) have memory leak if BatchSize property is less than amount of record which were retrieved from IDataReader.
    We know workaround for that, but when this problem will be fixed?
    Code source at the bottom:
    *****************File::Program.cs*****************
    using System;
    using System.Configuration;
    using System.Data;
    using System.Diagnostics;
    using Oracle.DataAccess.Client;
    namespace WindowsApplication
    static class Program
    private static DataTable _testTable = new DataTable("TestData");
    private static int _batchSize = 10000;
    private static int _totalRecordForTest = 100000;
    private static int _bulkTimeOut = 600;
    private static string _targetConnectionString;
    private static string _targetTableName;
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main()
    _testTable.ReadXmlSchema("tmp.data.schema");
    _testTable.ReadXml("tmp.data");
    _targetConnectionString = ConfigurationManager.AppSettings["targetConnectionString"];
    _targetTableName = ConfigurationManager.AppSettings["targetTableName"];
    _batchSize = int.Parse(ConfigurationManager.AppSettings["batchSize"]);
    _totalRecordForTest = int.Parse(ConfigurationManager.AppSettings["totalRecordForTest"]);
    _bulkTimeOut = int.Parse(ConfigurationManager.AppSettings["bulkTimeOut"]);
    PerformCorrectTest();
    Console.WriteLine("Do you want to perform memory leak test?(If no then click cancel key)");
    if (Console.ReadKey().Key != ConsoleKey.Escape)
    PerformMemoryLeakTest();
    Console.ReadKey();
    _testTable =null;
    public static void PerformCorrectTest()
    Console.WriteLine("Managed memory usage: {0}, unmanaged: {1}", GC.GetTotalMemory(false),
    Process.GetCurrentProcess().WorkingSet64);
    using (VirtualSourceReader wrapper = new VirtualSourceReader(new DataTableReader(_testTable), batchSize, totalRecordForTest))
    wrapper.RowsCopied += RowsCopied;
    using (OracleConnection targetConnection = new OracleConnection(_targetConnectionString))
    targetConnection.Open();
    Console.WriteLine("Bulk insert started at {0}", DateTime.Now);
    OracleBulkCopy bc = null;
    try
    bc = new OracleBulkCopy(targetConnection)
    DestinationTableName = _targetTableName,
    BulkCopyTimeout = _bulkTimeOut,
    BatchSize = _batchSize
    do
    bc.WriteToServer(wrapper);
    } while (wrapper.ResetState());
    finally
    if (null != bc)
    bc.Close();
    bc.Dispose();
    targetConnection.Clone();
    Console.WriteLine("Bulk insert completed at {0}", DateTime.Now);
    wrapper.Close();
    Console.WriteLine("Managed memory usage: {0}, unmanaged: {1}", GC.GetTotalMemory(false),
    Process.GetCurrentProcess().WorkingSet64);
    public static void PerformMemoryLeakTest()
    Console.WriteLine("Managed memory usage: {0}, unmanaged: {1}", GC.GetTotalMemory(false),
    Process.GetCurrentProcess().WorkingSet64);
    using (VirtualSourceReader wrapper = new VirtualSourceReader(new DataTableReader(_testTable), totalRecordForTest, totalRecordForTest))
    using (OracleConnection targetConnection = new OracleConnection(_targetConnectionString))
    targetConnection.Open();
    Console.WriteLine("Bulk insert started at {0}", DateTime.Now);
    OracleBulkCopy bc = null;
    try
    bc = new OracleBulkCopy(targetConnection)
    DestinationTableName = _targetTableName,
    BulkCopyTimeout = _bulkTimeOut,
    BatchSize = _batchSize,
    NotifyAfter = _batchSize,
    bc.OracleRowsCopied += OracleRowsCopied;
    bc.WriteToServer(wrapper);
    finally
    if (null != bc)
    bc.Close();
    bc.Dispose();
    targetConnection.Clone();
    Console.WriteLine("Bulk insert completed at {0}", DateTime.Now);
    wrapper.Close();
    Console.WriteLine("Managed memory usage: {0}, unmanaged: {1}", GC.GetTotalMemory(false),
    Process.GetCurrentProcess().WorkingSet64);
    private static void RowsCopied(object sender, long eventArgs)
    Console.WriteLine("Row Processed {0}. Current time is {1}", eventArgs, DateTime.Now);
    private static void OracleRowsCopied(object sender, OracleRowsCopiedEventArgs eventArgs)
    RowsCopied(sender, eventArgs.RowsCopied);
    *****************File::SourceDataReaderWrap.cs*****************
    using System;
    using System.Collections.Generic;
    using System.Data;
    using Oracle.DataAccess.Client;
    namespace WindowsFormsApplication1
    public delegate void OnRowProcessed(object sender, long rowCount);
    public class SourceDataReaderWrap:IDataReader
    protected IDataReader _originalReader;
    protected readonly int _batchSize;
    protected int _currentSessionRows;
    protected long _rowCount;
    public event OnRowProcessed RowsCopied;
    public SourceDataReaderWrap(IDataReader originalReader, int batchSize)
    _originalReader = originalReader;
    _batchSize = batchSize;
    _rowCount = 0;
    #region Implementation of IDisposable
    /// <summary>
    /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
    /// </summary>
    /// <filterpriority>2</filterpriority>
    public void Dispose()
    _originalReader.Dispose();
    _originalReader = null;
    if (RowsCopied != null)
    foreach (OnRowProcessed @delegate in new List<Delegate>(RowsCopied.GetInvocationList()))
    RowsCopied -= @delegate;
    #endregion
    #region Implementation of IDataRecord
    /// <summary>
    /// Gets the name for the field to find.
    /// </summary>
    /// <returns>
    /// The name of the field or the empty string (""), if there is no value to return.
    /// </returns>
    /// <param name="i">The index of the field to find.
    /// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
    /// </exception><filterpriority>2</filterpriority>
    public string GetName(int i)
    return _originalReader.GetName(i);
    /// <summary>
    /// Gets the data type information for the specified field.
    /// </summary>
    /// <returns>
    /// The data type information for the specified field.
    /// </returns>
    /// <param name="i">The index of the field to find.
    /// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
    /// </exception><filterpriority>2</filterpriority>
    public string GetDataTypeName(int i)
    return _originalReader.GetDataTypeName(i);
    /// <summary>
    /// Gets the <see cref="T:System.Type"/> information corresponding to the type of <see cref="T:System.Object"/> that would be returned from <see cref="M:System.Data.IDataRecord.GetValue(System.Int32)"/>.
    /// </summary>
    /// <returns>
    /// The <see cref="T:System.Type"/> information corresponding to the type of <see cref="T:System.Object"/> that would be returned from <see cref="M:System.Data.IDataRecord.GetValue(System.Int32)"/>.
    /// </returns>
    /// <param name="i">The index of the field to find.
    /// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
    /// </exception><filterpriority>2</filterpriority>
    public Type GetFieldType(int i)
    return _originalReader.GetFieldType(i);
    /// <summary>
    /// Return the value of the specified field.
    /// </summary>
    /// <returns>
    /// The <see cref="T:System.Object"/> which will contain the field value upon return.
    /// </returns>
    /// <param name="i">The index of the field to find.
    /// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
    /// </exception><filterpriority>2</filterpriority>
    public object GetValue(int i)
    return _originalReader.GetValue(i);
    /// <summary>
    /// Gets all the attribute fields in the collection for the current record.
    /// </summary>
    /// <returns>
    /// The number of instances of <see cref="T:System.Object"/> in the array.
    /// </returns>
    /// <param name="values">An array of <see cref="T:System.Object"/> to copy the attribute fields into.
    /// </param><filterpriority>2</filterpriority>
    public int GetValues(object[] values)
    return _originalReader.GetValues(values);
    /// <summary>
    /// Return the index of the named field.
    /// </summary>
    /// <returns>
    /// The index of the named field.
    /// </returns>
    /// <param name="name">The name of the field to find.
    /// </param><filterpriority>2</filterpriority>
    public int GetOrdinal(string name)
    return _originalReader.GetOrdinal(name);
    /// <summary>
    /// Gets the value of the specified column as a Boolean.
    /// </summary>
    /// <returns>
    /// The value of the column.
    /// </returns>
    /// <param name="i">The zero-based column ordinal.
    /// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
    /// </exception><filterpriority>2</filterpriority>
    public bool GetBoolean(int i)
    return _originalReader.GetBoolean(i);
    /// <summary>
    /// Gets the 8-bit unsigned integer value of the specified column.
    /// </summary>
    /// <returns>
    /// The 8-bit unsigned integer value of the specified column.
    /// </returns>
    /// <param name="i">The zero-based column ordinal.
    /// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
    /// </exception><filterpriority>2</filterpriority>
    public byte GetByte(int i)
    return _originalReader.GetByte(i);
    /// <summary>
    /// Reads a stream of bytes from the specified column offset into the buffer as an array, starting at the given buffer offset.
    /// </summary>
    /// <returns>
    /// The actual number of bytes read.
    /// </returns>
    /// <param name="i">The zero-based column ordinal.
    /// </param><param name="fieldOffset">The index within the field from which to start the read operation.
    /// </param><param name="buffer">The buffer into which to read the stream of bytes.
    /// </param><param name="bufferoffset">The index for <paramref name="buffer"/> to start the read operation.
    /// </param><param name="length">The number of bytes to read.
    /// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
    /// </exception><filterpriority>2</filterpriority>
    public long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length)
    return _originalReader.GetBytes(i, fieldOffset, buffer, bufferoffset, length);
    /// <summary>
    /// Gets the character value of the specified column.
    /// </summary>
    /// <returns>
    /// The character value of the specified column.
    /// </returns>
    /// <param name="i">The zero-based column ordinal.
    /// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
    /// </exception><filterpriority>2</filterpriority>
    public char GetChar(int i)
    return _originalReader.GetChar(i);
    /// <summary>
    /// Reads a stream of characters from the specified column offset into the buffer as an array, starting at the given buffer offset.
    /// </summary>
    /// <returns>
    /// The actual number of characters read.
    /// </returns>
    /// <param name="i">The zero-based column ordinal.
    /// </param><param name="fieldoffset">The index within the row from which to start the read operation.
    /// </param><param name="buffer">The buffer into which to read the stream of bytes.
    /// </param><param name="bufferoffset">The index for <paramref name="buffer"/> to start the read operation.
    /// </param><param name="length">The number of bytes to read.
    /// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
    /// </exception><filterpriority>2</filterpriority>
    public long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length)
    return _originalReader.GetChars(i, fieldoffset, buffer, bufferoffset, length);
    /// <summary>
    /// Returns the GUID value of the specified field.
    /// </summary>
    /// <returns>
    /// The GUID value of the specified field.
    /// </returns>
    /// <param name="i">The index of the field to find.
    /// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
    /// </exception><filterpriority>2</filterpriority>
    public Guid GetGuid(int i)
    return _originalReader.GetGuid(i);
    /// <summary>
    /// Gets the 16-bit signed integer value of the specified field.
    /// </summary>
    /// <returns>
    /// The 16-bit signed integer value of the specified field.
    /// </returns>
    /// <param name="i">The index of the field to find.
    /// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
    /// </exception><filterpriority>2</filterpriority>
    public short GetInt16(int i)
    return _originalReader.GetInt16(i);
    /// <summary>
    /// Gets the 32-bit signed integer value of the specified field.
    /// </summary>
    /// <returns>
    /// The 32-bit signed integer value of the specified field.
    /// </returns>
    /// <param name="i">The index of the field to find.
    /// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
    /// </exception><filterpriority>2</filterpriority>
    public int GetInt32(int i)
    return _originalReader.GetInt32(i);
    /// <summary>
    /// Gets the 64-bit signed integer value of the specified field.
    /// </summary>
    /// <returns>
    /// The 64-bit signed integer value of the specified field.
    /// </returns>
    /// <param name="i">The index of the field to find.
    /// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
    /// </exception><filterpriority>2</filterpriority>
    public long GetInt64(int i)
    return _originalReader.GetInt64(i);
    /// <summary>
    /// Gets the single-precision floating point number of the specified field.
    /// </summary>
    /// <returns>
    /// The single-precision floating point number of the specified field.
    /// </returns>
    /// <param name="i">The index of the field to find.
    /// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
    /// </exception><filterpriority>2</filterpriority>
    public float GetFloat(int i)
    return _originalReader.GetFloat(i);
    /// <summary>
    /// Gets the double-precision floating point number of the specified field.
    /// </summary>
    /// <returns>
    /// The double-precision floating point number of the specified field.
    /// </returns>
    /// <param name="i">The index of the field to find.
    /// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
    /// </exception><filterpriority>2</filterpriority>
    public double GetDouble(int i)
    return _originalReader.GetDouble(i);
    /// <summary>
    /// Gets the string value of the specified field.
    /// </summary>
    /// <returns>
    /// The string value of the specified field.
    /// </returns>
    /// <param name="i">The index of the field to find.
    /// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
    /// </exception><filterpriority>2</filterpriority>
    public string GetString(int i)
    return _originalReader.GetString(i);
    /// <summary>
    /// Gets the fixed-position numeric value of the specified field.
    /// </summary>
    /// <returns>
    /// The fixed-position numeric value of the specified field.
    /// </returns>
    /// <param name="i">The index of the field to find.
    /// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
    /// </exception><filterpriority>2</filterpriority>
    public decimal GetDecimal(int i)
    return _originalReader.GetDecimal(i);
    /// <summary>
    /// Gets the date and time data value of the specified field.
    /// </summary>
    /// <returns>
    /// The date and time data value of the specified field.
    /// </returns>
    /// <param name="i">The index of the field to find.
    /// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
    /// </exception><filterpriority>2</filterpriority>
    public DateTime GetDateTime(int i)
    return _originalReader.GetDateTime(i);
    /// <summary>
    /// Returns an <see cref="T:System.Data.IDataReader"/> for the specified column ordinal.
    /// </summary>
    /// <returns>
    /// An <see cref="T:System.Data.IDataReader"/>.
    /// </returns>
    /// <param name="i">The index of the field to find.
    /// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
    /// </exception><filterpriority>2</filterpriority>
    public IDataReader GetData(int i)
    return _originalReader.GetData(i);
    /// <summary>
    /// Return whether the specified field is set to null.
    /// </summary>
    /// <returns>
    /// true if the specified field is set to null; otherwise, false.
    /// </returns>
    /// <param name="i">The index of the field to find.
    /// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
    /// </exception><filterpriority>2</filterpriority>
    public bool IsDBNull(int i)
    return _originalReader.IsDBNull(i);
    /// <summary>
    /// Gets the number of columns in the current row.
    /// </summary>
    /// <returns>
    /// When not positioned in a valid recordset, 0; otherwise, the number of columns in the current record. The default is -1.
    /// </returns>
    /// <filterpriority>2</filterpriority>
    public int FieldCount
    get { return _originalReader.FieldCount; }
    /// <summary>
    /// Gets the column located at the specified index.
    /// </summary>
    /// <returns>
    /// The column located at the specified index as an <see cref="T:System.Object"/>.
    /// </returns>
    /// <param name="i">The zero-based index of the column to get.
    /// </param><exception cref="T:System.IndexOutOfRangeException">The index passed was outside the range of 0 through <see cref="P:System.Data.IDataRecord.FieldCount"/>.
    /// </exception><filterpriority>2</filterpriority>
    object IDataRecord.this[int i]
    get { return _originalReader[i]; }
    /// <summary>
    /// Gets the column with the specified name.
    /// </summary>
    /// <returns>
    /// The column with the specified name as an <see cref="T:System.Object"/>.
    /// </returns>
    /// <param name="name">The name of the column to find.
    /// </param><exception cref="T:System.IndexOutOfRangeException">No column with the specified name was found.
    /// </exception><filterpriority>2</filterpriority>
    object IDataRecord.this[string name]
    get { return _originalReader[name]; }
    #endregion
    #region Implementation of IDataReader
    /// <summary>
    /// Closes the <see cref="T:System.Data.IDataReader"/> Object.
    /// </summary>
    /// <filterpriority>2</filterpriority>
    public void Close()
    _originalReader.Close();
    /// <summary>
    /// Returns a <see cref="T:System.Data.DataTable"/> that describes the column metadata of the <see cref="T:System.Data.IDataReader"/>.
    /// </summary>
    /// <returns>
    /// A <see cref="T:System.Data.DataTable"/> that describes the column metadata.
    /// </returns>
    /// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Data.IDataReader"/> is closed.
    /// </exception><filterpriority>2</filterpriority>
    public DataTable GetSchemaTable()
    return _originalReader.GetSchemaTable();
    /// <summary>
    /// Gets a value indicating the depth of nesting for the current row.
    /// </summary>
    /// <returns>
    /// The level of nesting.
    /// </returns>
    /// <filterpriority>2</filterpriority>
    public int Depth
    get { return _originalReader.Depth; }
    /// <summary>
    /// Gets a value indicating whether the data reader is closed.
    /// </summary>
    /// <returns>
    /// true if the data reader is closed; otherwise, false.
    /// </returns>
    /// <filterpriority>2</filterpriority>
    public bool IsClosed
    get { return _originalReader.IsClosed; }
    #endregion
    /// <summary>
    /// Advances the data reader to the next result, when reading the results of batch SQL statements.
    /// </summary>
    /// <returns>
    /// true if there are more rows; otherwise, false.
    /// </returns>
    /// <filterpriority>2</filterpriority>
    public bool NextResult()
    throw new NotImplementedException();
    /// <summary>
    /// Advances the <see cref="T:System.Data.IDataReader"/> to the next record.
    /// </summary>
    /// <returns>
    /// true if there are more rows; otherwise, false.
    /// </returns>
    /// <filterpriority>2</filterpriority>
    public virtual bool Read()
    if (_batchSize == (_currentSessionRows))
    return false;
    if(_originalReader.Read())
    _currentSessionRows++;
    _rowCount++;
    return true;
    return false;
    /// <summary>
    /// Gets the number of rows changed, inserted, or deleted by execution of the SQL statement.
    /// </summary>
    /// <returns>
    /// The number of rows changed, inserted, or deleted; 0 if no rows were affected or the statement failed; and -1 for SELECT statements.
    /// </returns>
    /// <filterpriority>2</filterpriority>
    public int RecordsAffected
    get { throw new NotImplementedException(); }
    public virtual bool ResetState()
    bool result = _currentSessionRows != 0;
    if (result && RowsCopied != null)
    RowsCopied(this, _rowCount);
    _currentSessionRows = 0;
    return result;
    public class VirtualSourceReader:SourceDataReaderWrap
    private readonly int _totalRecordCount;
    public VirtualSourceReader(IDataReader reader, int batchSize, int totalRecordCount)
    :base(reader, batchSize)
    _totalRecordCount = totalRecordCount;
    public override bool Read()
    if (_rowCount >= totalRecordCount || totalRecordCount <= 0)
    return false;
    if (_rowCount == 0)
    return base.Read();
    if (_batchSize == _currentSessionRows)
    return false;
    _currentSessionRows++;
    _rowCount++;
    return true;
    *****************File::tmp.data**********

    You have problem because the batch size property has value *10000* and amount of records(*50000*) bigger than this value.
    You can retrieve workaround from my post (OracleBulkCopy have memory leak  if BatchSize is less than record's count.

  • RA-20102: Application collection PLSQL_OBJECT_SOURCE does not exist

    Hi,
    I have written a trigger and it was working fine before in APEX. I have amended update statement inside the trigger and trying to compile. It was throwing me error as below and not being to save the trigger. Also i have taken out the update satement, it is not being compile. I have done many excercise that drop the trigger and re-create the trigger with new name, and same name. It gives me the same error.
    RA-20102: Application collection PLSQL_OBJECT_SOURCE does not exist
    I have no idea to move further. I have already search similar thread in this forum and tried their suggest. I have no luck to get compile.
    Please help me.
    Thank you,
    - Thilip

    Hi Scott,
    Thanks for your help.
    Currently am using APEX 3.1 and XE 10.2..0.1.0 DB.
    Please find below is my actual trigger. This trigger is working fine without any issue
    create or replace trigger "OPNS_STOCK_INBOUND_TRN_TRG"
    BEFORE
    insert on "OPNS_STOCK_INBOUND_TRN"
    for each row
    declare
    l_open_stock number(13,3);
    l_close_stock number(13,3);
    l_trn_id number ;
    l_max_id number ;
    l_max_id1 number ;
    begin
    if inserting then
    if :NEW.OUTBOUND_TRN_GAGES <> 0 then
    -- Get the last record of ID in opns_stock_inbound_trn table
    select nvl(max(trn_id),-1) into l_max_id from opns_mixing_inbound_trn;
    select nvl(max(trn_id),-1) into l_max_id1 from opns_stock_inbound_trn;
    -- There is no record, get -1 then Openning stock always zero
    if l_max_id < 0 then
    l_open_stock := 0;
    else
    -- Get the openning stock as previous record's closing stock
    select nvl(close_stock,0) into l_open_stock from opns_mixing_inbound_trn where trn_id = l_max_id;
    end if ;
    -- There is no record, get -1 then Openning stock always zero
    if l_max_id1 < 0 then
    :NEW.open_stock := 0;
    else
    -- Get the openning stock as previous record's closing stock
    select nvl(close_stock,0) into :NEW.open_stock from opns_stock_inbound_trn where trn_id = l_max_id1;
    end if ;
    -- calculate inbound gages for stock
    l_close_stock := l_open_stock + :NEW.outbound_trn_gages ;
    -- Deducting outgoing gages in open stock and update as close stock
    :NEW.close_stock := :NEW.open_stock - :NEW.outbound_trn_gages ;
    -- Get the trn_id from table to update the opns_mixing_inbound table
    select max(trn_id) into l_trn_id from opns_mixing_inbound_trn;
    :NEW.OUT_MIX_TRN_ID := l_trn_id ;
    -- trn_id=1 for Inbound in overall
    update opns_overall_trn set trn_date=:NEW.trn_date, open_stock=:NEW.open_stock,
    close_stock=:NEW.close_stock, remarks='OPNS_STOCK_INBOUND_TRN_TRG', update_date=sysdate
    where trn_id=1;
    end if ;
    end if;
    end;
    I am trying to add below insert statement to the above trigger.
    -- inserting a entry in transaction table for mixing
    insert into opns_mixing_inbound_trn (trn_id, trn_date, open_stock, inbound_trn_gages, outbound_trn_gages, close_stock)
    values (opns_mixing_inbound_trn_seq.nextval, trn_date, l_open_stock, 0, :NEW.outbound_trn_gages, l_close_stock);
    I am firing this trigger when i insert a record in OPNS_STOCK_INBOUND_TRN table, the trigger should update OPNS_OVERALL_TRN table and insert another record to OPNS_MIXING_INBOUND_TRN table.
    Please update me the right solution.
    Thank you,
    Regards
    - Thilip

  • Infotype 2001 Record 00000000           000000000000000000000000000 does not exist Message no. PG225

    Hi,
    I am trying to  create a record in infotype 2001 but getting error
    Record 00000000           000000000000000000000000000 does not exist
    Message no. PG225
    This error not come before.  I have created many records for the last few months.
    Please suggest how to resolve.
    Regards,
    Pathi

    Hi Pathi,
    I guess this is because of Activity Allocation and Cost Assignment. Plz check the Number range assignment:
    PA05 for Number range assignment for additional time data
    PT12 for HR document posting
    Thanks'
    Gautam

  • How can I sort photos within an event? When I follow the Help instructions, I can sort manually in Photo format, but when I return to Event format, the original order is restored.

    How can I sort photos within an event? When I follow the Help instructions, I can sort manually in Photo format, but when I return to Event format, the original order is restored.

    Events are organisation for those who can't really be bothered. They are automatic - based entirely on Date and Time the camera records the photos as taken.
    You can move photos between Events, you can Merge Events, you can Rename them and sort them in various ways except one: You cannot manually sort in an Event as Events are all automated.
    If you want to manually sort in an Event then you've outgrown Events as an organising tool. Now it's time to look at albums (Where you can manually sort) which are much more flexible than Events as an organising tool.

  • Spatial query inside the exists clause return ora-13226

    The following does not work:
    select b.state, b.county from counties b where exists
    (select 's' from states a where a.state = 'New Jersey'
    and mdsys.sdo_relate (b.geom, a.geom, 'mask=INSIDE querytype=WINDOW' ) = 'TRUE');
    ERROR at line 1:
    ORA-13226: interface not supported without a spatial index
    ORA-06512: at "MDSYS.MD", line 1723
    ORA-06512: at "MDSYS.MDERR", line 8
    ORA-06512: at "MDSYS.SDO_3GL", line 302
    ORA-06512: at line 1
    The following does work:
    select b.* from states a,
    counties b where a.state = 'New Jersey'
    and mdsys.sdo_relate (b.geom, a.geom, 'mask=INSIDE querytype=WINDOW') = 'TRUE';
    I found bug 1243095 telling that this is not a bug but a limitation of the spatial operator. It cannot be invoked on a table that is not spatially indexed. In fact, the table is indexed but oracle cannot find the spatial index because table b(counties) is declared outside the EXISTS clause.
    In my case, I use object table. I cannot use the workaround specified above because I should use the DISTINCT clause but I cannot define the MAP and ORDER function (this is a general query).
    I've found another workaround :
    select b.state, b.county from counties b where exists
    (select 's' from states a where a.state = 'New Jersey'
    and mdsys.sdo_relate (a.geom, b.geom, 'mask=CONTAINS querytype=WINDOW') = 'TRUE');
    but sdo_relate still doesn't use the spatial index of table b (even if I specify it explicitely in the operator) and the query is very slow (more than 15 minutes).
    Is there a better workaround ?

    OK but I work in object model.
    And if I don't use the EXISTS clause, I must use the distinct clause.(I used the exists because of that)
    If I will to retrieve all the country that have at least a state beginning with the C letter, I will wrote :
    select c.* from country c, table(c.states) s where s.column_value.name like 'C%';
    (It is a simplified request to express the problem)
    In this case, I must use the distinct clause to select one occurence of each country objet (one country may contains more than one state beginning with C).
    select distinct c.* from country c, table(c.states) s where s.column_value.name like 'C%';
    For that, I must define a MAP or ORDER function for EACH type used in the country object.
    My first question is : I must retrieve all different country objects. Why the request doesn't use the MAP or ORDER function of the country type to distinct them ? Is there another syntax (or a hint) to express that ?
    In this case, it will make an ORA-00932 : incoherent datatype because the type of the nested table column cannot contain map or order method.
    Any suggestion ?
    Thanks in advance.

  • File.exists() returns false even when the file exists

    hi,
    the exists() function of java.io.File function returns false even when the file exists on the file system. why is this? i checked the path of the file which gives me the correct path, but exists returns false. can anyone help?

    post some of the code you�re using - then maybe I can help you out
    //Anders

Maybe you are looking for