Bug Report: ResultSet.isLast() returns false when queries return zero rows

When calling the method isLast() on a resultset that contains zero (0) rows, false is returned. If a resultset contains no rows, isLast() should return true because returning false would indicate that there are more rows to be retrieved.
Try the following Java source:
import java.io.*;
import java.sql.*;
import java.util.*;
import oracle.jdbc.driver.*;
public class Test2 {
public static void main (String [] args) throws Exception {
Connection conn = null;
String jdbcURL = "jdbc:oracle:thin:@" +
"(DESCRIPTION=(ADDRESS=(HOST=<host computer>)"+
"(PROTOCOL=tcp)(PORT=<DB port number>))"+
"(CONNECT_DATA=(SID=<Oracle DB instance>)))";
String userId = "userid";
String password = "password";
try{
// Load the Oracle JDBC Driver and register it.
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// *** The following statement creates a database connection object
// using the DriverManager.getConnection method. The first parameter is
// the database URL which is constructed based on the connection parameters
// specified in ConnectionParams.java.
// The URL syntax is as follows:
// "jdbc:oracle:<driver>:@<db connection string>"
// <driver>, can be 'thin' or 'oci8'
// <db connect string>, is a Net8 name-value, denoting the TNSNAMES entry
conn = DriverManager.getConnection(jdbcURL, userId, password);
} catch(SQLException ex){ //Trap SQL errors
// catch error
//conn = new OracleDriver().defaultConnection(); // Connect to Oracle 8i (8.1.7), use Oracle thin client.
PreparedStatement ps = conn.prepareStatement("select 'a' from dual where ? = ?", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); // Use any query that will return zero rows.
ps.setInt(1, 1); // Set the params so that the query returns 0 rows.
ps.setInt(2, 2);
ResultSet rs = ps.executeQuery();
System.out.println("1. Last here? " + rs.isLast());
while (rs.next()) {
// do whatever
System.out.println("2. Last here? " + rs.isLast());
ps.close();
rs.close();
EXPECTED RESULT -
1. Last here? true
2. Last here? true
ACTUAL RESULT -
1. Last here? false
2. Last here? false
This happens to me on Oracle 9.2.0.1.0.

387561,
For your information, I discovered this problem from
running a query that did access an actual DB table.
Try it and let me know.I did say I was only guessing, and yes, I did try it (after I posted my reply, and before I read yours). And I did check the query plan for the queries I tried -- to verify that they were actually doing some database "gets".
In any case, the usual way that I determine whether a "ResultSet" is empty is when the very first invocation of method "next()" returns 'false'. Is that not sufficient for you?
Good Luck,
Avi.

Similar Messages

  • Crystal Report 2011 does not display when keyfigures are zero

    I am using Crystal report 2011 with BEX Queries as Data Source. I am not able to see some of the characteristics values when keyfigures are zero or null. In BEX query there is a costCenter Characterstic, few costcenter characteristics values are zero for some months but BEX Query is designed to show as spaces even if the keyfigures are zero for those costcenters. When I am using the same Bex Query with Crystal report 2011 all the costcenters with keyfigures as zero are not showing up on the report. Can anybody suggest how I can show the characterstics values even if all the keyfigures are zero. (I have not selected any kind of suppression in section expert in crystal report), (In Bex Query CostCenter- Properties-Advanced----Access Type for Result values are set to Master Data)

    Hi,
    Have you made sure the correct Transport files have been loaded on the SAP system? Since you're using CR 2011, you need to make sure the Transports that come with this version of CR are present on the SAP system.
    Could you see if the workaround mentioned in SAP Note: 1391673 works for you?
    Here's a snippet of the SAP Note:
    SAP Development team of BW BEX MDX Interface suggest the following implementation:
    Since Crystal Reports is not correctly interpreting the character used to represent NULL values (by default the value: X) please use the Customizing transaction: RSCUSTV4 to change the sent value.
    Please note, this is a Global setting, and will also modify the behaviour in BEx application.
    WORKAROUND: Create a formula field based on the selection that always returns a number - converting null to 0.
    Create a formula in BEx for the KF.
    Edit the Selection
    Edit the formula to behave like:
    COUNT ('KF') * 'KF' + 0
    ('RKF' + 0) * 1
    Not generally acceptable since it requires duplicating fields.
    Also, business may not accept 0,00 for a NULL result.
    Hope this helps!
    -Abhilash

  • Bug Report: Preview chrashes every time when it opens a specific pdf

    http://www.constantin-medien.de/dasat/images/8/100778-gb2008-d-290409-safe.pdf
    This pdf crashes everytime preview.app.
    You can only watch it via quickview or Safari.
    Printing out of Safari will even crash Safari as well.
    I reconstructed this bug on three different Macintoshs.
    Message was edited by: Jamsven

    Yup, crashes Preview here too. There's probably something wrong with the PDF, but that doesn't excuse a crash.
    That said, this isn't really the right place to report bugs. This is a user-to-user forum, not a way to communicate with Apple. Go here:
    http://www.apple.com/feedback/macosx.html

  • Bug Report : with iOS 5.1 when a call failed and we choose call again, the screen of iPhone4s becomes black (until touch Apple button)

    I have this bug when my call don't reach my receiver. iPhone offers choice to left the call or retry it. If I retry it, the screen is black but the call continues and I can talk with my receiver. I must click on Apple button to deblock the black screen and after i can close the call. This bug appears since the upgrade to iOS 5.1.

    There is no Apple button.
    There is a home button, power button, mute switch and volume up/down buttons.
    Which of those are you actually pressing?

  • Bug report: code editor shows false PHP error

    I'm using Dreamweaver CC on an iMac.  The problem is that the PHP line error indicates an error in the code when there is no error.  This happens regularly when adding new values to an arrays that's formatted across multiple lines.  Please see the attached screenshot.

    When uploading an image on this forum, it seems to dramatically reduce the quality of the upload.  Here is a zoomed in image.

  • Bug report: backspace acts as delete when at the beginning of the line.

    This occurs in Calendar Subject and also in the Android Slack app.
    To reproduce make some text and put your cursor in the middle.  I could understand if it worked as delete if the cursor STARTED at the beginning of the line however it's incredibly jarring to hold down delete to nuke only the first part only to eat up the rest of your text (especially because there's seemingly no UNDO).

    it has been this way with BlackBerry for many years and its a nice feature to be able to delete from the beginning of a line with out adding in another key
    Click here to Backup the data on your BlackBerry Device! It's important, and FREE!
    Click "Accept as Solution" if your problem is solved. To give thanks, click thumbs up
    Click to search the Knowledge Base at BTSC and click to Read The Fabulous Manuals
    BESAdmin's, please make a signature with your BES environment info.
    SIM Free BlackBerry Unlocking FAQ
    Follow me on Twitter @knottyrope
    Want to thank me? Buy my KnottyRope App here
    BES 12 and BES 5.0.4 with Exchange 2010 and SQL 2012 Hyper V

  • Appending results returned by multiple queries into 1 row?

    I have multiple select queries in a procedure. Each query processes different tables and returns one or two columns that need to be inserted to a staging table.
    The results of these queries should be appended to one row.
    select col1, col2 from table1 where......
    select col3, col4 from table2 where....
    Now the results of the above queries col1,col2, col3, col4 should be inserted to a temp table into one row as 4 columns.
    How would I achieve this?

    Thanks very much for everyone's help.
    I am little confused. How would this fit in my queries. Please help me figure out how should I put these queries together.
    SELECT
    o.outageid,
    et.Billlabor
    FROM
    emp_time et,
    job j,
    rate r,
    vend v,
    outage o,
    outage_emp oe
    where
    j.jobid = et.jobid
    and et.rateid = r.rateid
    and r.vendid = v.vendid
    and et.outage_empid = oe.outage_empid
    and oe.outageid = o.outageid
    group by
    j.outageid
    select
    o.outageid,
    count(e.empid) as empcount,
    decode(o.outage_hrs, 0, 1, 0),
    from
    employee e,
    outage_emp oe,
    outage o,
    outage_vend v
    WHERE
    e.empid = oe.outage_empid
    and oe.outageid = o.outageid
    and o.outageid = v.outageid
    group by
    o.outageid
    select
    o.outageid,
    et.INTLABOR
    from
    emp_time et,
    outage_emp oe,
    outage o,
    job j,
    rate r,
    vend v
    where
    j.jobid = et.jobid
    and et.rateid = r.rateid
    and r.vendid = v.vendid
    and et.outage_emp_id = oe.outage_empid
    and oe.outageid = o.outageid
    group by o.outageid

  • The ResultSet.next() returns false....

    Hai,
    I am working on jdbc. The connection credentials all correct, and its getting connected to the sybase without any problems. But I am not able to perform any 'select' or "update" statements...There are no exception or any errors...But the ResultSet.next() returns false and executeUpdate returns 0 . .
    I think you can help me.....Thanks...

    Yes the query is sameAs already pointed out, there are ONLY two possibilities.
    1. The query is not the same
    2. The database is not the same.
    You are making assumptions about what is going on and then drawing conclusions.
    You need to understand that you assumptions are wrong. So it doesn't matter what conclusion you draw.
    In terms of why the query isn't the same there could be any number of reasons but usually it is because you are passing in data and that data isn't what you think (assume) it is. It can also be that you are constructing the SQL and that construction is different. It could be that the environment that you use to test as settings which impact SQL.

  • 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");
    }

  • SelectInputMethod() method of InputContext always returning false in JWS

    Hi,
    I am setting the Locale on a textArea using the api:
    TextArea.getInputContext().selectInputMethod(Locale).
    This api is always returning false, when run on Java Web Start.
    However, it returns the correct value, when run on Java.
    Has any one faced such issue?
    Thanks,
    Charanjeet
    Message was edited by:
    jannyguy

    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. 

  • Bug Report iOS 7 iTunes. Since it is repeatable on 3 iPhones and 4 iPads here, I'm sure others are experiencing the same thing. Apple, might want to take a peek at this. When a tv show or movie is deleted from Videos, the Videos app shuts down.

    Bug Report iOS 7 iTunes. Since it is repeatable on 3 iPhones and 4 iPads here, I'm sure others are experiencing the same thing. Apple, might want to take a peek at this. When a tv show or movie is deleted from Videos, the Videos app shuts down instead of returning to video playlist.
    Restarting videos works and looks like video is getting deleted.
    Just a bug report

    You might want to report that to Apple instead of to the other users in this forum.
    http://www.apple.com/feedback/iphone.html

  • REP-1825: Before Report Trigger returned FALSE

    Is there any work around for this error...??
    I am running a report in a batch mode. I have an old version 3.0.5.14 for unix.
    There is logic on the Before Report Trigger and an email is sent. A blank email if nothing needs to be reported or with data if there is anything to be reported.
    I updated the report (a different program unit), recompiled it and now I am getting this error and no email.
    any ideas?
    thanks
    simona

    Hi Simona,
    Does this happen when you are not running in batch mode? It sounds like you will need to step through the report, possibly with some srw.message calls to output some of the data values to find out why the Before Report Trigger is now returning false. Without seeing the logic, it's difficult to say.
    Toby

  • Strange behavior when Popup LOVs has read-only condition and Bug Report

    Hi,
    I observed an inconsistent behavior of Popup LOVs when the read-only condition is true. In that case the defined lov query is used to map the internal value of the page item to the display value defined in the lov query.
    What is the reason for this behavior? Because if the Popup LOV is in "edit mode" the page item value is just displayed without looking up the display value. The display value is just used for the popup lov. Mapping the value is normally a behavior of the popup key lov.
    -> The result is that different values are displayed if the page item is in edit or read-only mode. That's not really the behavior someone would expect.
    BTW, there seems to be a bug with "Display Extra Values" set to "Yes" in the case read-only is true. If the lookup doesn't return a value it just displays [ ], but because the property is set to yes it should display the value. The Popup Key Lov has the same bug.
    Thanks for bringing some light into that behavior
    Patrick
    Oracle APEX Essentials: http://essentials.oracleapex.info/
    My Blog, APEX Builder Plugin, ApexLib Framework: http://www.oracleapex.info/

    Patrick,
    I've added your comments to a task already in our queue to examine all item types for correct behavior in read-only mode. I've noticed the quirks with display extra values also.
    By the way, still interested in your thoughts re: Re: Bug Report: Images broke when using get_blob_file_src and not authentic .
    Scott

  • Bug report: Screen times out when other side is no...

    Bug report: Screen times out when other side is not sharing video. The phone locks and of course the other party cannot see anything. Please fix.
    Using WP 8.1.1 Developers Preview.

    Hi and welcome to the Skype Community,
    Can you please share which platform and which device you are on?
    Also are you referring about a one-way video call here where only you are sending video, but the other party doesn't send their video back?
    Follow the latest Skype Community News
    ↓ Did my reply answer your question? Accept it as a solution to help others, Thanks. ↓

  • Bug report: ube_ipa: internal error when compiling with -xO5

    When compiling imlib2-1.1.2, one source file causes compilation to fail with the following error message:
    ube_ipa: internal error
    cc: ube_ipa failed for loader_tiff.c
    The command which fails is (probably wrapped):
    cc -DHAVE_CONFIG_H -I. -I. -I.. -I. -I.. -I../src -I../loaders -I../libltdl -I/usr/X11R6/include -I/usr/openwin/include -I/opt/csw/include -I/opt/csw/include -I/opt/csw/include -g -fast -xarch=386 -xstrconst -v -xildoff -xO5 -c loader_tiff.c -KPIC -DPIC -o .libs/loader_tiff.o
    Changing -xO5 to -xO4 works around the problem. The source file in question is imlib2-1.1.2/loaders/loader_tiff.c
    Patch 112756-10 has been applied, and doesn't correct the problem. GCC doesn't have any problem compiling the file.
    A quick note to any Sun employees reading this: it took me 45 minutes to find somewhere to submit this bug report. Searching sun.com for "submit bug report" turned up many forum postings where people asked "Where do I submit bug reports?", a bug report form for Sun One Java Studio, and not much else. It might be in your interest to make submitting bugs easier.

    Internal errors, such as the one you encountered, are generally considered compiler bugs. They indicate that the compiler reached an unexpected state and therefore bailed out. I opened bug 20703141: internal error: pic_relocs(): hh reltype? to investigate. I see the same error message emitted by the current Studio development release; I will update this thread if I find a work-around.
    Thanks,
    Mark

Maybe you are looking for