Select statement not returning correct data

I'm working on an application and I'm having a weird problem. The application connects to an Oracle database, pulls out some data, and does something with it. In the process of testing I've already read and dealt with some rows. On those rows the UPDATE_FLAG field was changed to a N so they wouldn't be selected again.
I do want to select those rows again, so with SQLPlus I changed the UPDATE_FLAG back to Y. Now here's the strange part. The same select statement run from SQLPlus is returning thoe row I modified, but my application does not.
Here's the select statement:
SELECT * FROM MY_TABLE WHERE UPDATE_FLAG = 'Y' and USER_ID like 'B%';
When I run this I get a row back called Brian.
In my application I do this:
try
               Class.forName("oracle.jdbc.driver.OracleDriver");               
               Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@server:port:sid", "username", "password");
               Statement st = conn.createStatement();
               ResultSet rec = st.executeQuery("SELECT * FROM MY_TABLE WHERE UPDATE_FLAG = 'Y' and USER_ID like 'B%'");
               System.out.println("SELECT * FROM MY_TABLE WHERE UPDATE_FLAG = 'Y' and USER_ID like 'B%'");
               while(rec.next())
                    System.out.println(rec.getString("USER_ID"));
               st.close();
          } catch (Exception e)
               System.out.println("Error -- " + e.toString());
               e.printStackTrace();
            }When this runs it doesn't return Brian and there are no exceptions caught. It's like it does not find it.
Assuming I explained this well enough, anyone have any ideas what the problem could be?
Thanks,
James

I do want to select those rows again, so with SQLPlus I changed the UPDATE_FLAG back to Y. Last time I ran SQLPlus I explicitly had to do a commit after modifications, because it was creating a transaction around the sqlplus session. Of course running a query in that session would work on the modified data rather than the actual data.

Similar Messages

  • Update form not returning correct data selection in dropdown menu

    Using CS3 DW along with SQL 2008 R2. I have a number of dropdown menus on an entry form (using VBScript/ASP) that are feed by SQL queries. All data is accepted in the entry form and writes to the table in the database without any issues. I created an Update form and based on a Rec ID clicked on from a list the Update form is presented with all the data in the correct fields except for one dropdown menu. All the other menus go to the correct selection except for the one. Spent 2 days attempting to resolve this. If I change the dropdown menu to a field the correct data is presented when the form comes up, but doesn't allow the user to make a selection from the menu. When I change it back to a dropdown menu the saved selection is not selected - just lists the entire list of items in the menu. Any help or ideas on this is greatly appreciated.

    Hello All,
    Once more thank you. I have sorted the issue out.
    I observed that I was selecting the wrong field. I selected the field matching the record set of the select instead of the field matching the record set of the table I am working as seen on the image belew
    I was selecting this - This is the record set of the table that hold values for the city select list
    Instead of this. This is the record set of the table behind the form I am working on
    My issue is now re-solved.
    Mike

  • Rtrim in where clause not returning correct data

    A select statement specifying
    where rtrim(field_name) <> ''
    is not returning any rows even though there is data on the table with field_name not blank.
    If this particular where clause is omitted the data is returned and rtrim(field_name) is populated correctly.
    This is occurring across different tables and in both 10.2.0.4 and 11.2.0.1 databases. I can't find any references to this being a bug.
    Has anyone else come across this ? Can anyone explain why this is happening please ?

    An empty VARCHAR2 is considered NULL by Oracle.
    sql> select 1 from dual where trim (' ') = '';
    no rows selected
    sql> select 1 from dual where trim (' ') != '';
    no rows selected
    sql> select 1 from dual where trim (' ') is null;
             1
             1

  • SELECT statement not returning NULL records

    I have the following SELECT statement:
    SELECT *
    FROM RPT_DS1_CNT_CAT
    WHERE DUPS_SAME <> 'N/A';
    I also tried:
    SELECT *
    FROM RPT_DS1_CNT_CAT
    WHERE DUPS_SAME != 'N/A';
    Same results - There ARE Null DUPS_SAME values
    which are not being selected. I get NO results.
    When I execute this, I do get NULL values.
    SELECT *
    FROM RPT_DS1_CNT_CAT
    WHERE DUPS_SAME IS NULL;
    How can I ensure that I get all non - 'N/A' records
    if it won't pick up the nulls? Is there a function
    I can use or a different wording? I do want to use
    != or <> because there may be other values besides
    'N/A' such as 'YES' or 'NO' and they may be null or
    filled with spaces.

    The expression
    NVL(DUPS_SAME,'') is meaningless. You're saying "If DUPS_SAME is NULL, return the empty string, which is NULL, otherwise return DUPS_SAME." If you're going to use NVL, the string that gets returned if the column is NULL should be non-NULL, i.e.
    NVL(DUPS_SAME,'DUPS_SAME was NULL') Your query should, as others have pointed out, either be
    SELECT *
      FROM rpt_ds1_cnt_cat
    WHERE dups_same <> 'N/A' OR dups_same IS NULLor
    SELECT *
      FROM rpt_ds1_cnt_cat
    WHERE NVL(dups_same, 'DUPS_SAME is NULL') <> 'N/A' Either of these return the same results as your query but they're going to be far clearer for whoever needs to maintain the code. There may be performance differences as well if DUPS_SAME is indexed depending on the data distribution...
    Justin

  • 0SM_CCLM Queries do not return correct data

    Hi
    I've been testing my queries on various cubes and not having much success. The ATC ones work ok, The UPL ones tend to show no data or time out and the 0SM_CCLM queries show a 0 count always.
    On researching the 0CM_CCLM ones a bit more with a colleague, he suggested that the 0SM_CCLRC key figure should have a count in it. I found out that previously that was in error in SP07 and it was amended via note 1779251 - Key Figure 0SM_CCLRC does not exist in the Cube 0SM_CCL and noticed that when the key figure was added, it was done so with a constant value of 1.
    My question therefore is whether there is a problem with this cube also and the 0SM_CCLRC key figure does not have a constant value of 1 making the summation impossible and hence all my totals are 0 for all queries on this cube.
    Thanks
    Ian

    Hi Alexander
    0SM_CCLM/0SM_CCM_CREATED_OBJECTS_YEAR is one example.

  • Discoverer Viewer not showing correct data when scheduled

    Hi All,
    I have a bit of an ongoing issue and cannot find an answer through Oracle.
    We have an issue that when a cross-tab workbook is run manually in Desktop this returns correct data, when scheduled in desktop it returns correct data in desktop, but when opening the scheduled workbook in viewer, incorrect and irrelevant data is returned
    Here is a little information on the field that is not returning correct data;
    The field is based on a calculation, the calculation (lets call BOB) contains PL/SQL function concatenated with an NVL calculation, this other calculation is a DECODE. I have been playing with changing the content of the BOB calculation, by removing the PL/SQL function and the DECODE calc from BOB and scheduling the report, the data is returned in viewer, in fact i've attempted one without the other and this still does not return the correct data.
    This version of discoverer that is not returning data is V 10.1.2.50.05. I've tested this on a later environment with Discoverer V 10.1.55.26 and the data is returning correctly through the sceduled report in viewer.
    My questions;
    1. Has anyone ever come across something similar to this in version 10.1.2.50.05
    2. Is there any detail available regarding what upgrading to 10.1.55.26 offers?
    3. Know any workaround for using PL/SQL calculations in a scheduled workbook? I am aware that not aggregable items will not be returned in v11 when scheduling workbooks.
    Many thanks in advance for any help.
    Simon

    Bumping this thread
    Thanks
    Si

  • Ibots not returning any data

    Hi,
    I have some ibots that I scheduled to run on a daily basis and which were working perfectly.
    Suddenly the same ibots, they run but the content of the attachment says "The specified criteria did not return any data".
    I checked the log files and could not see any relavant error.
    If I go back in the report that I am sending through the ibot, it runs without any problem.
    I tried to send it in different formats and run as different users, but the results are still the same!
    Any idea what else I could check?
    Type: Warning
    Severity: 50
    Time: Wed May 15 14:10:19 2013
    File: project/webodbcaccess/odbcconnectionimpl.cpp Line: 199
    Properties: RptPath-/shared/MICROS/giuliano/cube_build_verification;SID-btilnnapkfo2omg91a71b9m6n2;bindID-1;connID-31;ThreadID-4640;statementID-364;RSP-o:go~r:report
    Location:
         saw.odbc.statement.fetch
         saw.subsystem.portal.pdf
         saw.delivers.rpc.getDeviceContent
         saw.rpc.server.responder
         saw.rpc.server
         saw.rpc.server.handleConnection
         saw.rpc.server.dispatch
         saw.threadPool
         saw.threads
    SQLFetchScroll returned code SQL_NO_DATA_FOUND

    Thanks it solved the issue.
    But One more thing Now I have placed the parameters in the where clause of the query
    Query-
    select field1,field2,field3,field4,field5,job_name,candidate_name,interview_date from etc.ethr_irc_int_details
    where field1 is not null
    and job_name = :1
    and candidate_name = :2
    and interview_date = :3
    in the VO I am executing
    public void iniQuery(String S1, String S2,String S3)
    System.out.println("insdie ini query of the VO");
    System.out.println("S1 "+S1);
    System.out.println("S2 "+S2);
    System.out.println("S3 "+S3);
    this.setWhereClauseParams(null);
    this.setWhereClauseParam(0,S1);
    this.setWhereClauseParam(1,S2);
    this.setWhereClauseParam(2,S2);
    executeQuery();
    and in AM
    ETHRIntDetailsVOImpl IDVO = (ETHRIntDetailsVOImpl)this.getETHRIntDetailsVO();
    // IDVO.executeQuery();
    // OAViewObject IDVO = (OAViewObject)findViewObject("ETHRIntDetailsVO");
    IDVO.iniQuery(S1,S2,S3);
    Row row = IDVO.first();
    again I am not getting any data in the row??
    Any idea if I am doing any thing wrong..
    Please help urgently.
    Thanks
    Ashish

  • I want a select statement to return two values, sum of one column and customer number

    I have two columns one called invoice_number and the other invoice_amount. I want a select statement to return two columns.... invoice_number and then the sum of the invoice_amount(s) for each unique invoice number.
    SELECT sum(invoice_amount) AS Totalinvoice_amount FROM InvoiceTB where invoice_number = 'INV102'
    This is where I've started, which returns:
    Totalinvoice_amount
    500.00
    Any help is appreciated.
    Please mark my post as helpful or the answer or better yet.... both! :) Thanks!

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
    use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • BC4J - ViewObject not returning latest data

    BC4J - ViewObject not returning latest data. Some kind of EO/VO Cache Latency Issue.
    I have an edit page that presents a drop-down list which is suppose to display * un-assigned * messages, but does not. The drop-down list is using an <jbo:InputSelect> tag that gets values from a ViewObject (UnAssignedMessageView ) which issues the query listed below. Note, the ViewObject is not based on an Entity Object.
    (Query in UnAssignedMessageView)
    select      message.message_desc_short, message.message_id
    from     fmm.message
    where      message.message_id not in (select cardmessage.message_id from fmm.card_message)
    and message.message_id != 0     
    (from the edit.jsp)
    <jbo:ApplicationModule id="am" configname="com.maxmcbyte.fmm.model.ModelModule.ModelModuleLocal" releasemode="Reserved" />
    <jbo:DataSource id="ds" appid="am" viewobject="CardMessageView1" />           <<****** The VO where the inserts/updates are recorded.
    <jbo:DataSource id="ds2" appid="am" viewobject="MessageUnAssignedView" />     <<****** The VO for the unassigned message drop-down-list.
    The problem is at step 3.
    Starting with 3 Unassigned Messages.
    Step 1: enter new record AND select a MESSAGE_ID from the drop-down list.
    Step 2: commit the transaction.
    Step 3: enter another record AND select a MESSAGE_ID from the drop-down list.     <<****** the list should now be displaying 2 unassigned messages but is displaying 3.
    Note, if I check the database after step 3 using the same query as in the UnAssignedMessageView I get the correct result. I guess I'm not understanding how BC4J ViewObject Caching is working. It is strange that even after I commit the record that the cache is not updated.
    I have read the docs and will have to re-read them again * but * it would be REAL NICE to see an illustration of "A DAY IN THE LIFETIME OF DATA IN BC4J" for dummies like me.
    Can anyone tell me what I'm missing here AND what specifically needs to be done?
    Thanks All,
    Bill G...

    Well, I figured it out * BUT * this is the sort of thing that I'll bet stumps a lot of new users * AND * should be posted to a "Gotch-Ya" list.
    I'd still like to see an illustration of "A DAY IN THE LIFE OF DATA IN BC4J"
    Bill G...
    <jbo:ApplicationModule id="am" configname="com.maxmcbyte.fmm.model.ModelModule.ModelModuleLocal" releasemode="Reserved" />
    <jbo:DataSource id="ds1" appid="am" viewobject="CardMessageView1" />
    <jbo:DataSource id="ds2" appid="am" viewobject="MessageUnAssignedView" />
    <%-- adding this did the trick --%>
    <%
    ViewObject view2 = ds2.getRowSet().getViewObject();
    view2.executeQuery();
    view2.first();
    %>

  • Binocular search for Cost Center is not returning any data

    Hi Gurus,
    When clicking on the SRM-Shooping Cart-Cost Assignment- Account Assignment Overview- Cost center Binocular search icon,  it is not returning any data.  However,  when drilling down in the Account Assignment Overview, you will see another Binocular search icon for Cost Center which is working fine.
    Any idea of how you troubleshoot it.
    Thanks in advace for your help.
    HA

    Not sure about the cost assignment drill down, but after we applied SP13 to SRM server 550 the binoculars for cost center stopped working. the following note corrected this.
    Note 1259735 - Search help of generic account does not work
    If it has never worked, then probably need to setup a RFC dialog user for the F4 search help, Multiple threads on here around the dialog user for F4 with details on configuration and use.
    JF

  • Select statement not working

    hi to all,
    I am trying to write use inner joining . here is code
    DATA:tabname LIKE dd02L-tabname,
         table_disc LIKE dd02t-ddtext.
      SELECT  dd02ltabname dd02tddtext INTO (tabname,table_disc)
        FROM dd02l INNER JOIN dd02t on dd02ltabname = dd02ttabname
              WHERE dd02tddlanguage = 'E' AND dd02ltabclass = 'TRANSP'
                                AND dd02L~tabname = 'ZANKI*'.
        endselect.
          write : tabname.
    I also checked in tables dd02t and dd02l for the table zanki* and data available in both table . but here select statement not working .do u have any idea about this. thank you

    Hi,
    I executed the ur inner join conditin by commenting 'z*' it's working fine.
    I think  where condition is not getting satisfied so u r not getting any data.
    Please conform in where condition you need * 'AND'* or OR
    I change decalration as below.
    DATA:tabname    type TABNAME,
          table_disc type AS4TEXT.
    SELECT dd02l~tabname
           dd02t~ddtext  INTO (tabname, table_disc)
    FROM dd02l  INNER JOIN dd02t on dd02l~tabname = dd02t~tabname
    WHERE dd02t~ddlanguage = 'E' AND
          dd02l~tabclass = 'TRANSP'AND
        dd02L~tabname = 'ZANKI*'.
    endselect.
    write : tabname.
    Regards,
    Pravin

  • Howto create 'select statement' that returns first row? (simple table)

    quick question that drives me crazy:
    Say I have the following table:
    ID....car_model....point_A....total
    1........333.............NY..........54
    2........333.............NJ..........42
    3........333.............NH...........63
    4........555.............NJ...........34
    5........555.............PA...........55
    I would like to create a select statement that return car_model which the starting point is NJ - in this example it's only 555.
    thanks for any tips

    fair enough.
    the problem is this: given the table below, I need to create a report that reflects car rentals from specific location. you can rent a car from different locations; a car has a starting point (like a flight itinerary) so consider this:
    Mark rent a car with the following itinerary:
    NY--> NJ
    NJ--> PA
    PA-->FL
    FL-->LA
    the end user would like to see all car that were rented between X and Y and start point was NJ, so in the example above, the starting point is NY so it doesn't match the end users' criteria.
    The table is organized in the following manner: ID....car_model....point_A....total
    * I don't know whey the someone choose point_A as a column description as it just suppose to be 'location'
    so, back to my first example:
    ID....car_model....point_A....total
    1........333.............NY..........54
    2........333.............NJ..........42
    3........333.............NH...........63
    4........555.............NJ...........34
    5........555.............PA...........55
    if I do this:
    Select car_model from myTable where point_A='NJ'
    the return result will be 333 and 555 but that is in correct because 333 starting point is NY.
    I hope I provided enough information, thanks

  • Case Statement Not returning resutlset Varbinary

    Declare @val varbinary
    set @val = cast('123456789' as varbinary) 
    select @val as value -- Varbinary Value Result
    Declare @check bit
    set @check= 1
    --THis Case Statement Not returning Result set in Varbinary  . 
    select case @check when 1 then @val else 1 end as value

    See the below part from MSDN documentation reg return type
    Returns the highest precedence
    type from the set of types in result_expressions and
    the optional else_result_expression. 
    http://msdn.microsoft.com/en-IN/library/ms181765.aspx
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • In PDF to Excel conversion dates like 03/12/15 convert to Dec 3rd 2015 not the correct date of Mar 12th 2015 whereas date 03/13/2015 converts correctly as March 13th 2015

    In PDF to Excel conversion dates like 03/12/15 convert to Dec 3rd 2015 not the correct date of Mar 12th 2015 whereas date 03/13/2015 converts correctly as March 13th 2015

    Hi DirTech,
    Are both of these dates in the same Excel file? If they're in different files, are you choosing the same language for OCR (optical character recognition)?
    If they are in the same PDF file, how was that PDF file created? Was it created from a third-party application (rather than an Adobe application)? If it was created by a third-party application, it could be that it wasn't written to spec, and that's why you're seeing some oddities in the PDF > Excel conversion.  (See Will Adobe ExportPDF convert both text and form... | Adobe Community.)
    Best,
    Sara

  • TS3579 I found this useful because I did not know about the effect of typing in data and that you could only drag to rearrange the data.  I had typed in data before and this had caused problems but restoring defaults did not cause correct dates to show up

    I found this  (TS3579: If the wrong date or time is displayed in some apps on your Mac Learn about If the wrong date or time is displayed in some apps on your Mac) useful because I did not know about the effect of typing in data and that you could only drag to rearrange the data.  I had typed in data before and this had caused problems but restoring defaults did not cause correct dates to show up in Finder. 

    It sounds like there are a couple things going on here.  First check if you have a successful install of SQL Server, then we'll figure out the connection issues.
    Can you launch SQL Server Configuration Manager and check for SQL Server (MSSQLSERVER) if default instance or SQL Server (other name) if you've configured your instance as a named instance.  Once you find this, make sure the service is started. 
    If not started, try to start it and see if it throws an error.  If you get an error, post the error message your hitting.  If the service starts, you can then launch SSMS and try to connect.  If you have a default instance, you can use the machine
    name in the connection dialog.  Ex:  "COWBOYS" where Cowboys is the machine name.  However, if you named the SQL Server instance during install, you'll need to connect using the machine\instance format.  Ex:  COWBOYS\Romo (where Romo
    is the instance name you set during install).
    You can also look at the summary.txt file in the SQL Server setup error logs to see what happened on the most recent install.  Past install history is archived in the log folder if you need to dig those up to help troubleshoot, but the most
    recent one may help get to the bottom of it if there is an issue with setup detecting a prior instance that needs to be repaired.
    Thanks,
    Sam Lester (MSFT)
    http://blogs.msdn.com/b/samlester
    This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click
    "Mark as Answer" and
    "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.

Maybe you are looking for