Compare 2 numbers with different precision

Hi all,
Using DB 10.2.0.5, I've encountered a strange behaviour today while trying to compare ORA_ROWSCN with a previous SCN sored in a column.
SELECT
  h.id HID,
  h.ora_rowscn HSCN,
  o.id OID,
  o.scn OSCN,
  h.ora_rowscn-o.scn DIFF
FROM
  har@REMOTE h LEFT JOIN other o ON (h.id=o.id)
WHERE
  h.ORA_ROWSCN > o.scn
ORDER BY 5 desc ;
       HID       HSCN        OID       OSCN       DIFF
...{snip}...
      4213 5093868663       4213 5092916724     951939
1157 rowsWhile casting o.scn to a number gives me another resultset (this one is correct):
SELECT
  h.id HID,
  h.ora_rowscn HSCN,
  o.id OID,
  o.scn OSCN,
  h.ora_rowscn-o.scn DIFF
FROM
  har@REMOTE h LEFT JOIN other o ON (h.id=o.id)
WHERE
  h.ORA_ROWSCN > to_number(o.scn)
ORDER BY 5 desc ;
       HID       HSCN        OID       OSCN       DIFF
...{snip}...
     70949 5093865558      70949 5093847070      18488
2114 rowsI got the same result if I use NVL(o.scn,0) rather than TO_NUMBER(o.scn).
I can't find out why this happens. Obviously, the ">" condition doesn't match when the difference is too small.
AFAIK, ora_rowscn is a NUMBER while my "scn" column is a NUMBER(12) (which should be sufficient to store my DB or remote DB's SCN).
Does anyone has an explanation?
Thanks!

Thank you, I've marked both of your message Helpful.
@Solomon, maybe you are right, I'll get a try with Materialized Views.
About my comparison problem, I think I haven't targeted the right spot. Maybe it is an index+ora_rowscn problem. Here is my execution plan:
SQL>  SELECT h.id hid, h.ora_rowscn hscn, o.id oid, o.scn oscn, h.ora_rowscn-o.scn diff
FROM har@REMOTE h, other o
WHERE
   h.id=o.id(+) AND
   h.ORA_ROWSCN > o.scn
ORDER BY 5 desc ;
| Id  | Operation                | Name             | Rows  | Bytes | Cost (%CPU)| Time     | Inst   |IN-OUT|
|   0 | SELECT STATEMENT         |                  |   683 | 17075 |    94   (4)| 00:00:02 |        |      |
|   1 |  SORT ORDER BY           |                  |   683 | 17075 |    94   (4)| 00:00:02 |        |      |
|*  2 |   HASH JOIN              |                  |   683 | 17075 |    93   (3)| 00:00:02 |        |      |
|   3 |    REMOTE                | HAR              | 13658 |   173K|    46   (0)| 00:00:01 | REMOTE | R->S |
|   4 |    VIEW                  | index$_join$_002 | 14024 |   164K|    46   (3)| 00:00:01 |        |      |
|*  5 |     HASH JOIN            |                  |       |       |            |          |        |      |
|*  6 |      INDEX RANGE SCAN    | IDX_OTHER_SCN    | 14024 |   164K|     3  (34)| 00:00:01 |        |      |
|   7 |      INDEX FAST FULL SCAN| SYS_C006381      | 14024 |   164K|    54   (0)| 00:00:01 |        |      |
Predicate Information (identified by operation id):
   2 - access("H"."ID"="O"."ID")
       filter("O"."SCN"<"H"."ORA_ROWSCN")
   5 - access(ROWID=ROWID)
   6 - access("O"."SCN"<"H"."ORA_ROWSCN")
Remote SQL Information (identified by operation id):
   3 - SELECT "ID","ORA_ROWSCN" FROM "HAR" "H" (accessing 'REMOTE' )Where SYS_C006381 is an index on OTHER.ID and IDX_OTHER_SCN is an index on OTHER.SCN column.
As soon as I drop the latter index, I get the correct resultset:
SQL> drop index IDX_OTHER_SCN ;
| Id  | Operation           | Name     | Rows  | Bytes | Cost (%CPU)| Time     | Inst   |IN-OUT|
|   0 | SELECT STATEMENT    |          |   683 | 17075 |   117   (3)| 00:00:02 |        |      |
|   1 |  SORT ORDER BY      |          |   683 | 17075 |   117   (3)| 00:00:02 |        |      |
|*  2 |   HASH JOIN         |          |   683 | 17075 |   116   (2)| 00:00:02 |        |      |
|   3 |    REMOTE           | HAR      | 13658 |   173K|    46   (0)| 00:00:01 | REMOTE | R->S |
|   4 |    TABLE ACCESS FULL| OTHER    | 14024 |   164K|    69   (2)| 00:00:01 |        |      |
Predicate Information (identified by operation id):
   2 - access("H"."ID"="O"."ID")
       filter("O"."SCN"<"H"."ORA_ROWSCN")
Remote SQL Information (identified by operation id):
   3 - SELECT "ID","ORA_ROWSCN" FROM "HAR" "H" (accessing 'REMOTE' )Well, I can't figure out what's wrong, but the solution is here. Maybe a limitation of ORA_ROWSCN pseudocolumn...

Similar Messages

  • Comparing two numbers with different formats

    Dear Java developers
    I am trying to compare two numbers but they have different formats. long x = 8981261369, Object obj = "8,981,261,369".
    I am trying to see if this two values are equal which is the case in the example above except one has a thousand separator but not sure how to do that.
    How can I lose the thousand separator and just compare them as two long values.
    Your input will be much appreciated
    Thanks

    iu433 wrote:
    I need a generic way of doing this. Because sometimes the Object does not have a thousand separator. Can i use some kind of NumberFormat to do this.You'll need to know what formats the string (not the number--as already mentioned, numbers don't have formats) can have, and then try them one by one.
    Of course, there can be some ambiguity. Does "123,456" represent one hundred twenty three thousand four hundred fifty six, or is that comma a decimal separator, and it represents one hundred twenty three and four hundred fifty six thousandths?
    The point is, you have to have a clear definition of what formats are allowed and how to determine which one it is. There's no magic way for Java to do that for you.

  • HT3529 My iPhone wont let me send text message to numbers with different area code how do I fix this?

    My iPhone wont let me send text messages to numbers with a different area code. How do I fix this so I can send texts to these numbers?

    If it shows up in iTunes and you can sync the phone, could be that the docking port is damaged.
    You should get it serviced or looked at by visiting an Apple Store or contacting Apple:
    Apple - Support - Service Answer Center

  • How to compare 2 arrays with different operator options using parameters in Teststand

    Pls let me know how to compare 2 arrays using different operators like <= or >= or ==......

     I am using TS 2010. FYI
    ex:
    Array XX [ A_Temp,
                   B_Temp,
                   C_Oil Pressure,
                   D_Oilpressure,
    Note : A_Temp, B_Temp,C_Oil Pressure,D_Oilpressure all these parameters will be getting  numerical values (dynamically) from the simulink models and also in future I may need to add parameters to this array.
    Array YY [A_Temp_1,
                   B_Temp_2,
                   C_Oil Pressure_3,
                   D_Oilpressure_4,
    Note : A_Temp_1, B_Temp_2,C_Oil Pressure_3,D_Oilpressure_4 all these parameters will be getting  numerical values (dynamically) from the simulink models
    So my question :
    I would like to verify A_Temp >= A_Temp_1
                                B_Temp >= B_Temp_2
                                C_Oil Pressure  >= C_Oil Pressure_3  etc

  • How do you create a graph in numbers with different x-values?

    For my chemistry class I have to create one scatter plot with three different sets of "x" and "y" values. I have done it before but it is not working. What is an easy way to accomplish this?

    All X and Y data has to be in regular cells, nothing in header rows or header columns. It should be organized as X1,Y1,X2,Y2, etc.
    Select all the data
    Choose to make a scatter chart
    At the bottom left of the Numbers window there is a little text box that probably says "Plot Columns as Series". Click on it and unselect "Share X Values"
    It is beyond me why Apple put that control in the bottom left corner in a place where you wouldn't think to look because it is far from the chart and far from the table and far from all the other controls you will be using to create and format the chart..

  • Compare two dateTime with different timezone

    HI, All,
    I found a strange thing when compare two dateTime in BPEL;
    In my BPEL process, client passed a date time to the process , and the process compare the date time with current data time.
    1.client pass cutoffDate to process
    2. in a switch activity, I compare cutoffDate with current date. code:
    bpws:getVariableData('cutoffDate')<=xpath20:add-dayTimeDuration-to-dateTime()
    but seems this compare ignored the timezone information.
    For example:
    cutoffDate=2010-03-05T06:17:38.838+00:00
    currentDate=2010-03-05T14:10:38.838+08:00 this time =2010-03-05T06:10:38.838+00:00
    but cutoffDate<currentDate == true... seems it ignored the timezone info..
    This is a bug or I used a wrong compare function?
    Thanks.
    Edited by: Colin Song on Mar 5, 2010 3:28 PM

    Hi Colin,
    Please go through below link, there is topic about calculating difference between dates. Hope you find solution.
    http://blogs.oracle.com/reynolds/2007/07/19/
    Please let me know, if still not successful.
    Thx,

  • Trying to compare date columns with differing formats...

    I have an app that created a series of tables via ODBC using ANSI standard datatypes. For most, this isn't a problem, but one in particular is driving me crazy: TIMESTAMP. In Oracle, it shows up as a TIMESTAMP(6). I don't want to mess with the app's tables, so every time there is an insert to their tables, I have a trigger which creates records in corresponding tables I build using standard Oracle datatypes (DATE).
    I have one function that gets called by several of the triggers that retrieves me a specific row to update, and it uses the value from this TIMESTAMP field in the WHERE clause like this (the value is passed into the function as a parmeter):
    SELECT TIMECARD_ID INTO tc_id FROM TS_TIMECARD_MAIN
    WHERE EMP_ID = e_id AND VEHICLE_ID = v_id
    AND IN_TIME <= logout AND OUT_TIME IS NULL; <----
    I seem to have a formatting issue, because unless the "logout" date is a full day later than IN_TIME, it doesn't pull the record (my code does a check to verify there is only one record matching the criteria but I haven't posted it all here for simplicity). I need it to be able to select the correct record with a one second difference.
    I have NLS_TIMESTAMP_FORMAT set to 'YYYY-MM-DD HH24.MI.SS.FF' and NLS_DATE_FORMAT set to 'YYYY-MM-DD HH24:MI:SS'. The relevant describes are included below. Can anyone suggest how to format my query (I expect to use the TO_DATE and TO_CHAR to compensate, but haven't found the right set) so that it resolves properly? Date math is a pain, but it is critical to my purposes.
    Vendor's table
    FIELD3_DATETIME TIMESTAMP(6)
    My table
    TIMECARD_ID NOT NULL NUMBER(10)
    EMP_ID NOT NULL NUMBER(10)
    IN_TIME DATE
    OUT_TIME DATE
    VEHICLE_ID NUMBER(10)
    Also, some sample default output from each table - not sure why formatting is wierd on my table.
    Vendor's table
    UNIQKEY STATUS FORM_ID VEHICLE_NUMBER CREATED_DATETIME
    11515780978071234994451 0 21423 24005 28-JUN-06 05.10.14.000000 PM
    CHECK_DVIR NEW_DVIR SERVICEABLE DETAILS
    1 1 1 everything ok
    INSPECTION_TIME ODOMETER LATITUDE LONGITUDE
    28-JUN-06 05.12.12.000000 PM 119885.1 44.7889490425587 -95.2167677879333
    My table
    TIMECARD_ID EMP_ID IN_TIME OUT_TIME VEHICLE_ID
    5 20044 28-JUN-06 24005

    That sounds a bit complicated. If you post your query I'm sure there will be a simpler approach, perhaps something like
    where  date_timestamp between cast(sysdate -30 as timestamp) and systimestampor if you prefer
    where  date_timestamp between systimestamp - interval '30' day and systimestampas discussed on Re: convert timestamp to date.

  • HT204053 I have two iphones with different numbers that I use my apple ID for purchases, etc.  How do I get my second iphone setup on icloud?  I would like to use the features of icloud for both of my iphones.  Thank you

    I have two iphones with different phone numbers that I use.  I have one of them set up on icloud now, but do not know how to set up my second device on icloud.  Both of my iphones use my same Apple ID for purchases, etc.  Is there a simple way to add a device to my icloud account?  Thank you in advance for any help someone may be able to give me.

    To move one of the phones to a different iCloud account (if that's what you want to do), go to Settings>iCloud and turn all synced data to Off.  When prompted, choose to keep the data on your iPhone.  After everything is off, scroll to the bottom and tap Delete Account.  This will delete the account from the phone but not from iCloud so the other phone will not be effected.  Then set up a new iCloud account with a different Apple ID and turn iCloud syncing in Settings>iCloud back to On.  When prompted, choose Merge.  This will upload the data to the new iCloud account.
    You will then have to go to icloud.com and sign into each iCloud account separately and delete any unwanted data that you don't want on the phone syncing with each account.

  • HT4528 Can I put the same information on two different i-phones with different numbers and different ID's?

    Can I put the same information on two different i-phones with different numbers and different ID's?

    Yes and no it really depends on what information you are putting on the devices.

  • How can i compare two excel files with different no. of records.

    Hi
    I am on to a small project that involves us to compare two excel files. i am able to do it but am struck up at a point. When i compare 2 different .csv files with different no. of lines i am only able to compare upto a point till when the number of lines is same in both the files.
    Eg. if source file has 8 lines and target file has 12 lines. The difference is displayed only till 8 lines and the remaining 4 lines in source lines are not shown.
    Can you help me in displaying those extra 4 lines in source file. I am attaching my code snippet below..
    while (((strLine = br.readLine()) != null) && ((strLine1 = br1.readLine())) != null)
                     String delims = "[;,\t,,,|]";
                    String[] tokens = strLine.split(delims);
                    String[] tokens1 = strLine1.split(delims);
                   if (tokens.length > tokens1.length)
                    for (int i = 0; i < tokens.length; i++) {
                        try {
                            if (!tokens.equals(tokens1[i])) {
    System.out.println(tokens[i] + "<----->" + tokens1[i]);
    out.write(sno + " \t" + lineNo1 + " \t\t" + tokens[i] + "\t\t\t\t" + tokens1[i]);
    out.println();
    sno++;
    } catch (Exception exception)
    out.write(sno + " \t" + lineNo1 + " \t\t" + tokens[i] + "\t\t\t\t" + "");
    out.println();
    Thanks & Regards                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    A CSV file is not an Excel file.
    But apart from that your logic makes no sense.
    If the 2 files are of different sizes the files are different by definition, so further comparison isn't needed, you're done.
    If you want to compare individual records, you need to compare all records from one file with all records from the other, unless the order of records is important in which case your current system might work.
    That system however is overly complicated for comparing CSV files.
    As you assume a single record per line, and if one can assume those records to have identical layout (so no leading or trailing whitespace in or between columns in one file that's not in the other) comparing records is simply a matter of comparing the entire lines.

  • Open a Document with different versions of Numbers on different devices?

    Hello!
    I'm a beginner with Numbers application.
    I work with Numbers 3.1 version on my Mac, and Numbers 1.7.3 version on my IPad.
    Documents created on my Mac is shared via Iclous, but cannot be opened on my Ipad.
    What can i do?
    Thanks for your help!

    Hi meludwig,
    Unfortunately, LabVIEW keeps track of the different VIs in memory using the VI's name. Therefore, if you want to load multiple executables that use the same VIs but with different code, you will want to rename those VIs. LabVIEW cannot distinguish between 2 VIs with the same name but with different code. Dynamically calling the VIs using VI Server, like you mentioned, will also potentially cause problems because the executables might try to load same VI name into LabVIEW memory at a time and this will still causes problems.
    My suggestion would therefore to be to rename the utility VIs to another name and save it as a custom subVI in that program. Then, make sure to include that custom subVI in the App Builder executable and you should b
    e golden.
    Kileen C.
    NI

  • Numbers point to a cell with different formatting to create conditional format

    Hi all, not sure if this has been brought up but my search efforts haven't found anything. I know conditional formatting is not supported in IOS numbers but I saw a buddy do a little trick a while ago and I've been trying to replicate it. On his iPad, he created a numbers spreadsheet that had a logic function (=if). And if that function was true it pointed to another cell with different formatting. The result was, the cell would become the same format as the cell it was pointing too. This created the effect of a conditional format in a sense. I can get this to work with limited effect, only if the cell is a "text" cell and not a formula. As well the background colour doesn't get picked up, only the format of the cell text itself. I'm trying to get in touch with him for help but in the mean time does anyone have any experience in this kind of method?
    Cheers

    As an example:
    If A > B, then A-B, otherwise make it equal this other cell (D1 for example)
    {=if(a1>b1,a1-b1,d1)}
    And in that d1 cell I would make another formula that also does the same subtraction (a1-b1) however knowing it will be a negative number this time, I paint the cell bright red and hopefully the original cell will then look the same since it is now equal to this one.
    Unfortunately it looks like this wont work. The closest thing to doing this trick I have found is pointing to a cell formatted as text, such as a blank cell. Then the original cell takes on the formatting characteristics of the text cell.  The problem is the text cell is useless since it can't do any sort of math. I can't even set the cell to simply equal another one and format it as text only. So far it looks like the only conditional type of trickery I can do is make the numbers disappear by pointing to a blank text cell.
    I hope that helps describe it a little better.

  • HT4061 3GS stuck on connect to iTunes screen and keep getting error 29 at restore tried 5 different batteries all with different apn numbers what apn should my batterie have

    Keep getting error 29 I have tried 5 batteries now all with different apn numbers which is the correct batterie to use in my 3GS

    Error 20, 21, 23, 26, 28, 29, 34, 37
    These errors typically occur when security software interferes with the restore and update process. FollowTroubleshooting security software issues to resolve this issue. In rare cases, these errors may be a hardware issue. If the errors persist on another computer, the device may need service

  • Creating Cells with differing heights in Numbers '09

    In any given Row is it possible to have different cells with different heights because I've found that if I set the cell height to be e.g. 1cm then all the cells in the whole row are 1cm which isn't always the desired effect.
    Thanks

    S,
    A Row is a unit with a singular height value. All cells in that row will have the same height in a Numbers Table. Adjacent rows can be made to appear to have cells with differing heights by manipulating the Cell Border characteristics. You also have the option to combine individual tables in such a way that they appear to be a single table with different row heights.
    Jerry

  • How to handle same product with different part numbers and pricing in SAP.

    I am a new user and want to learn if the following scenario can be handled by SAP.
    Our business buys a product from a supplier which has 2 different part numbers and prices. It is the same product. One is the primary product whilst the other is available only as an upgrade option with a different part number to a mainline product at a cheaper price .
    Our issue is that we sometimes buy the upgrade option with a mainline product to get the better price even though these go into stock. Basically we need to have the items linked with both part numbers in SAP at different prices but inventory both in and out only going against the primary part number. Any ideas?

    Thanks Jitin
    I did give them different part numbers and then attached a Bom containing the primary part number against the upgrade option however I really need to have the secondary item as a sales and purchase item but non inventory so the stock comes from the primary part. Ideally  if we receipt the goods in as the secondary number the inventory goes to the primary part. If the second number is an inventory item then I have the issue of the same part with different part numbers sitting in stock at different prices and having to rely on employees understanding the difference.
    Sorry to be so confusing. I will do some more testing over the weekend and see if I can find a suitable solution.
    Thanks
    Martin

Maybe you are looking for

  • Creation of Custom service

    Hi All, I have created a custom component(ZipBulkDownload) in the content server, and created a resource(service) in the component. I am not able to call the service "No Service found for ZipBulkDownload" and in the backend (in the server log file) i

  • It's old but my favorite Power Mac G5 OSX 10.5.8

    How can i get and use iCloud for my Power Mac G5 OSx 10.5.8 ?  Since Mobile Me no longer exist now my system needs access to Mobile Me in order for the DVD drive to operate. To date what resources I have keeps telling me that since my G5 Apple is so

  • New mac mini system will not recognize wireless keyboard and trackpad.

    My brand new mac mini system will not initialize properly.  The return on the track pad are not being recognized, although scrolling is. Any others find this?  Support could not figure this out on the phone.  They sent me out to get new batteries and

  • How to make the entire project in the project server 2013 reschedule؟

    How to make the entire project in the project server 2013 reschedule ? Because item %compelet related to reschedule In this photo it is known there are no items update project

  • NAVS not getting picked up on a PO

    Hello, Whilst trying to create a PO; we've observed that condition type NAVS is not getting defaulted.  We've checked that the condition records have been maintained/plant & material master indicator has been maintained. Anyone of you has had this ex