Need a unique timestamp

Hi,
I'm inserting new values in a table that has as primary key a "long" field. To create a unique value I usually get the value with System.currentTimeMillis(), the problem is that I'm running a data migration program and sometimes the value I get is the same for two different records (I thought this was impossible). I would fiz this problem by changing table structure but I'm not allowed.
Any thoughts?
Thanks!

doesn't collide with you or vice versa? Again,
it's the database's job to do this.Agreed, but if you aren't prepared to shell out big $$$ bucks for Oracle and don't have access to triggers or sequences, then how does one at least get as close as possible? Or do we give up? Also, on the ejb server, the code generating the next id is executing on the server side, so it will easily block all but one client at a time through the grabbing of the next id.
For that matter, I've even used the concept in VB with Access, where you can't even synchronize code or do anyhting with the DB regarding concurrency protection, and the sheer nature of performing the select and then the insert as close together as possible has at least 'helped' keep issues at bay. The world is full of imperfect solutions ...particularly with the $$$ of Oracle. Sometimes next best thing is worthy of discussion too.
Actually, I tested the nested select nextId + 1 from ... nested right inside the update statement, and then right away selected the new val afterward, (subtracting one from it to use it) ...and found that because the first update call locks the row, then the next select is performed in the next line of code ...that any concurrent calls would wait for the row to be able to be locked again before other calls would proceed with thier initial update statement ...so I was never able to create a failure in the vb unsynchronized version ...it was tight. If ever the 'practically impossible' where to occur, the db will throw a primary key exception anyway, which was anticipated in the prog also as a guard.
So far, no one has ever called me to say they have received this error ...and I'm sure they would have. All seems sturdy enough to me ...although yes ...from a purely technical stndpoint, yes ...only the db could guarantee the value was truly unique. But that sounds like to much of a pitch for making Oracle rich to satisfy me.
Anyhow ...generate your keys with a lava lamp for all I care.

Similar Messages

  • Why is serial# needed for unique session info

    hello everybody,
    as you know, a session is unique with 2 fields, SID and SERIAL# which exist on v$session view.
    my question is why is serial# needed and for which case serial# is changing.
    now, you can say that, "only oracle developers know this, that is the design" but what i mean is, for ex: if i wanted to find a session which is blocked by another session, I use this:
    select * from v$session where blocking_session is not null;in blocking_Session field, oracle gives me the session id (SID) which is blocking a session. so i can use this SID and i can kill it for instance but SID is not unique for a session I can find more than one session with same SID which one is the blocking one ?
    in real life i didnt see an example of that, there is no same sid in system like my blocking session example. so I believe that serial# is assigning for another purpose, I mean, i thougth that it could be for autonomous transaction, maybe they user same sid but differen serial# but when i tested it, i saw that i was wrong.
    so, why serial# is exists. if this is a design issue, how can i find a blocking session by just using SID info ?
    thanks a lot.

    Not surprisingly, an explanation may already be found in the documentation (and copied in Rene's reply above):
    See http://docs.oracle.com/cd/E11882_01/server.112/e25513/dynviews_3016.htm (column description).
    Or search:
    http://www.oracle.com/pls/db112/search?word=sid+serial%23&partno=
    Besides for terminating sessions, serial# may be relevant when e.g. tracing sessions (SQL Trace).
    Not sure what type of example you were looking for, but I came up with this in about five seconds:
    C:\Users>sqlplus blocker_user
    Enter password:
    Connected to:
    Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production
    SQL> select sid,serial# from v$session where sid=(select sid from v$mystat where rownum=1);
           SID    SERIAL#
           136         27
    SQL> conn other_user
    Enter password:
    Connected.
    SQL> select sid,serial# from v$session where sid=(select sid from v$mystat where rownum=1);
           SID    SERIAL#
           136         29Edited by: orafad on Feb 1, 2012 12:18 AM

  • Your opinion needed - generating unique ID from a URL

    I am currently making a web crawler type program and before rushing straight in and coding something I thought i'd gather a few "expert" opinions so to speak ;)
    A crawler obviously takes a URL, downloads it and saves it in a database somewhere. However I need to keep a record of which URLs have been previously crawled - as not to crawl and recrawl the same URL.
    Ideally I need to make an algorithm which takes a String URL and outputs a unique ID for that URL - no other URL would be assigned the same ID.
    After a while researching I have ran into base64 which could take a URL and output a long String of characters. I have a question here though:
    1. Is base64 always going to output UNIQUE IDs for every URL or is there a slight offchance you could have duplicates?
    However even if base64 worked and it gave me the ID:
    aHR0cDovL3d3dy5qYXZhLmNvbQ==
    For the URL:
    http://www.java.com
    I still have to record it in a database and search for its prescence to determine if the URL has been crawled before.
    So my question is:
    Is there a way to construct a unique NUMERICAL ID for a URL?
    This way, it would be much easier to find the record if all were sorted by their numerical ID number.
    Hope I havent confused you, if I have just tell me!
    Thanks
    -Myles

    I need a numerical representation of a URL as it would reduce the time to search for a URl to check if it had been previously crawled.BUNKUM! Sorry, but it is... you're talking about saving pooftenths of second on each database seek... but if you're web-crawler isn't inherently I/O bound (say what 2 to 5 seconds a page) then who's your ISP? and how much do they charge.
    IE: Your barking up the wrong tree. Just use an MD5's, keep your "current site" in a hashset... for instance if was crawling http://forum.java.sun.com I'd load a hashset from the DB of that domain... crawl within it, and save the whole shebang back to the DB in one hit, delaying any external links until the end.. then load each of those "sites" and crawl and save them, again delaying any external links... and so on until the end of time in all probability.
    And, sorry, you're reinventing the square wheel again... ever heard of jackrabbit?
    http://mail-archives.apache.org/mod_mbox/jackrabbit-commits/200502.mbox/%[email protected]%3E
    (I love google)
    PS: Someone once told me that the internet has a higher probability of surviving a nuclear war than the human race... and if your solar power station also survives then maybe in about a 1,000,000 one cocker-roach might turn to the other cocker-roach and say, "Dad it's finally finished. Can I play Toad Killer 3 now?" ;-)
    keith.

  • Need help: unique constraint

    Hey please tell How to add unique constraint on two columns on a table say
    Name and id
    Name should be case independent unique
    something like
    alter table xyz. add unique constraint on (upper(name),id )
    Thnx

    SQL> create table xyz
      2  ( name varchar2(10)
      3  , id number(4)
      4  )
      5  /
    Tabel is aangemaakt.
    SQL> alter table xyz. add unique constraint on (upper(name),id )
      2  /
    alter table xyz. add unique constraint on (upper(name),id )
    FOUT in regel 1:
    .ORA-00903: invalid table name
    SQL> create unique index i1 on xyz (upper(name),id)
      2  /
    Index is aangemaakt.
    SQL> insert into xyz values ('abc',1)
      2  /
    1 rij is aangemaakt.
    SQL> insert into xyz values ('def',1)
      2  /
    1 rij is aangemaakt.
    SQL> insert into xyz values ('DEF',1)
      2  /
    insert into xyz values ('DEF',1)
    FOUT in regel 1:
    .ORA-00001: unique constraint (RWK.I1) violatedRegards,
    Rob.

  • Need help on timestamp in oracle....

    hi
    in my web application i hav oracle as backend. Through web page i m suppose
    to make entry in the database. The table contains 2 entries for datatype TIMESTAMP(6) out of these one is compulsory (i.e not null) and other is not compulsory. here is what i m doing in coding:
    in java servlet
    long q = System.currentTimeMillis();
    query = "INSERT INTO TABL(field1,field2,field3,field4,field5,field_timestamp) VALUES(" val1 ",'" + val2 + "','" + val3 + "','"+val4+"','"+val5+"',to_timestamp("+q+"))";
    int r=stmt.executeUpdate(query);
    but this code gives me error that column does not exists ....
    can anyone help me i want to store timestamp value in the table....

    Probably one of those things that you are concatenating in there appears to be a column name (instead of a literal) in your SQL. When you got an error message suggesting there was a problem with your SQL, did it not occur to you that you should look at the SQL? What you posted there is just some rubbish code that generates the SQL.
    I call it rubbish code because it would be much easier, not to mention more practical, to use a PreparedStatement.

  • Need PlSQL code to find out the column/combination of columns from a given table which will be unique values

    Given a table with some columns and data associated with that. Need to find out a column or a combination of some columns, so that the values or combination of values will be unique in the table.
    The table and number of columns and the columns will be dynamic.
    Can you please help me with the solution?

    f8d0dcea-cdf0-4935-8734-632fe021456c wrote:
    No key is defined in the table.
    Suppose a table contains 20 columns then I need the unique combinations of all columns.
    Example: A table 'Employee' has 4 columns: Emp_No, Emp_Name,Passport_No,Emp_Designation. No key is defined for Employee table. Need to find out which column(single column and combination if columns) have unique values. Like, First check if Emp_No is unique then check Emp_No+Emp_Name is unique, then check if Emp_No+Emp_Name+Passport_No is unique, then check Emp_No+Emp_Name+Passport_No+Emp_Designation is unique.
    Then again try with the combination of Emp_No+Passport_No and so on. In this way I need to find out all the combinations having unique values.
    As Paul says, that will be a waste of time, as it will taken a lot of processing for all the possibilities, checking all the data each time to determine which combinations of columns provide uniqueness.  What happens if someone inserts or deletes some data whilst your doing it?
    You'd be quicker to manually look at the tables, and make an educated guess and then test for uniqueness with a quick query on that guess.

  • ORACLE TIMESTAMP DataType support in Toplink ?

    Currently we have an application that need to create timestamps with precision up to thousands of a second.
    Do you know of any other customer that have similar requirements and how they solve this problem ?
    We try changing the SQL DDL to change datatype from DATE to TIMESTAMP(3) which can support a timestamp of 1/1000 seconds precision.
    We find that if our Oracle column is defined as Oracle DATE, the last 3 digit will be drop and cause us some duplicate key exception for records that
    Get inserted within 1 second because the timestamp is part of the primary key.
    ts '2004-03-12 17:13:27.792'
    So we change the ORACLE column from DATE to TIMESTAMP(3)
    What we find is that Toplink produce this exception
    Exception [TOPLINK-3001] (OracleAS TopLink - 10g (9.0.4) (Build 031126)): oracle.toplink.exceptions.ConversionException
    Exception Description: The object [oracle.sql.TIMESTAMP@321b5e39], of class [class oracle.sql.TIMESTAMP], could not be converted to [class java.util.Date].
    at oracle.toplink.exceptions.ConversionException.couldNotBeConverted(ConversionException.java:35)
    at oracle.toplink.internal.helper.ConversionManager.convertObjectToUtilDate(ConversionManager.java:679)
    at oracle.toplink.internal.helper.ConversionManager.convertObject(ConversionManager.java:97)
    at oracle.toplink.internal.databaseaccess.DatabasePlatform.convertObject(DatabasePlatform.java:55
    Than we try to change our java code and modify the java instance variable type from java.util.Date to java.sql.Timestamp
    And we get the following error
    Exception [TOPLINK-3001] (OracleAS TopLink - 10g (9.0.4) (Build 031126)): oracle.toplink.exceptions.ConversionException
    Exception Description: The object [oracle.sql.TIMESTAMP@731de027], of class [class oracle.sql.TIMESTAMP], could not be converted to [class java.sql.Timestamp].
    at org.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBinder.java:650)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1011)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1564)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:335)
    We cannot seems to find in toplink mapping workbench how to specify timestamp
    ========================================================================================================
    The TIMESTAMP Datatype
    The new TIMESTAMP datatype is almost identical to DATE and differs in only one way:
    TIMESTAMPs can represent fractional seconds.
    The granularity of a TIMESTAMP value can be as little as a billionth of a second, whereas
    DATE variables can only resolve time to the second.
    When you declare a TIMESTAMP variable, you can optionally specify the precision that you wish to use for fractional seconds. The default precision is to the millisecond (six decimal digits); the maximum precision is to the billionth of a second (nine decimal digits).
    ===========================================================================================================
    -----Original Message-----
    From: Cheung, Ka-Kit
    Sent: Friday, March 12, 2004 6:20 PM
    To: Burr, Tim; Julian, Robert; Matthiesen, Sean
    Cc: Tsounis, George; Del Rosso, Peter; Cham, Mei
    Subject: Problem identified : AddressDetail duplicate key problem
    If we look at the exact of the insert statement.
    We see that the last address detail insert have key of
    Address ID = '5a052407-dac6-42ad-bbbf-29edc94488c1', and
    TransactionStartDate = {ts '2004-03-12 17:13:27.792'},
    While in the database, we look like we have an entry of
    Address ID = '5a052407-dac6-42ad-bbbf-29edc94488c1', and
    TransactionStartDate = {ts '2004-03-12 17:13:27.229'},
    If my memory served me right, while
    {ts '2004-03-12 17:13:27.792'}, is different than {ts '2004-03-12 17:13:27.229'},
    because are Java timestamps that have precison up to MicroSeconds, therefore 229 is different than 792.
    However, when this timestamp is saved to Oracle, I believe (have to check with Mei) that oracle only takes
    Up to '2004-03-12 17:13:27’ and discard the 229 or 792 because that is the maximum precision of timestamp for oracle.
    So we have the second insert have the same '2004-03-12 17:13:27’ after stripping off the 792 and we have a same record with the same same '2004-03-12 17:13:27’ in the database and
    Therefore causing duplicate key exception.
    That is why this is happen only once in a while when 2 rapid fire inserts happen in less than 1 second of each other.
    The solution actually is in the ESS code itselfs.
    The current ESS code will send addDependentToClient multiple times, one for each dependent added
    On the screen.
    The right way is to add all the dependent on the screen all at once.
    To have “course grain” method like addDependentsToClient, and have a collection or array of dependents as input parameter.
    This way we are not causing the participant to create history of themselves multiple times within a very short period of time. It save disk space, conform to a single UOW per submit and that is what I proposed
    To solve this problem from the root cause is by enhancing the method to save multiple dependents in one shot rather than a loop of multiple calls.
    KK
    and
    INSERT INTO PTTCBSI.ADDRESS_DETAIL
    (LINE_3_AD, ADR_TRAN_UNTIL_DT, MODIFY_DT, CITY_NM, POSTAL_CD, VER_ID, POSTAL_EXT_CD, LINE_2_AD, ADR_TRAN_START_DT, CREATE_DT, AUTHOR_ID, ADDRESS_ID, LINE_1_AD, COUNTY_NM, LINE_4_AD, COUNTRY_ID, STATE_ID)
    VALUES ('Block 5, Apt. 6', {ts '9999-12-31 00:00:00.0'},
    {ts '2004-03-12 17:13:26.385'},
    'Oakwood', '61043', 1, '1234', 'Mailstop 820',
    {ts '2004-03-12 17:13:26.385'},
    {ts '2004-03-12 16:50:12.0'}, 'dataLoad',
    '5a052407-dac6-42ad-bbbf-29edc94488c1',
    'IBM Corp.', NULL, '140 Main Street', 'US', 'NJ')
    UnitOfWork(1238222885)--Connection(2102560837)--
    UPDATE PTTCBSI.ADDRESS_DETAIL
    SET ADR_TRAN_UNTIL_DT = {ts '2004-03-12 17:13:26.385'}, VER_ID = 2 WHERE
    (((ADDRESS_ID = '5a052407-dac6-42ad-bbbf-29edc94488c1') AND
    (ADR_TRAN_START_DT = {ts '2004-03-12 16:52:29.0'})) AND (VER_ID = 1))
    UPDATE PTTCBSI.ADDRESS_DETAIL SET
    ADR_TRAN_UNTIL_DT = {ts '2004-03-12 17:13:27.229'}, VER_ID = 2
    WHERE (((ADDRESS_ID = '5a052407-dac6-42ad-bbbf-29edc94488c1') AND (ADR_TRAN_START_DT = {ts '2004-03-12 17:13:26.0'})) AND (VER_ID = 1))
    UnitOfWork(102762535)--Connection(2102560837)--
    INSERT INTO PTTCBSI.ADDRESS_DETAIL
    (LINE_3_AD, ADR_TRAN_UNTIL_DT, MODIFY_DT, CITY_NM, POSTAL_CD, VER_ID, POSTAL_EXT_CD, LINE_2_AD, ADR_TRAN_START_DT, CREATE_DT, AUTHOR_ID, ADDRESS_ID, LINE_1_AD, COUNTY_NM, LINE_4_AD, COUNTRY_ID, STATE_ID) VALUES
    ('Block 5, Apt. 6', {ts '9999-12-31 00:00:00.0'}, {ts '2004-03-12 17:13:27.229'}, 'Oakwood', '61043', 1, '1234', 'Mailstop 820',
    {ts '2004-03-12 17:13:27.229'},
    {ts '2004-03-12 16:50:12.0'}, 'dataLoad',
    '5a052407-dac6-42ad-bbbf-29edc94488c1',
    'IBM Corp.', NULL, '140 Main Street', 'US', 'NJ')
    INSERT INTO PTTCBSI.ADDRESS_DETAIL
    (LINE_3_AD,
    ADR_TRAN_UNTIL_DT,
    MODIFY_DT,
    CITY_NM, POSTAL_CD, VER_ID, POSTAL_EXT_CD, LINE_2_AD,
    ADR_TRAN_START_DT,
    CREATE_DT,
    AUTHOR_ID,
    ADDRESS_ID,
    LINE_1_AD, COUNTY_NM, LINE_4_AD, COUNTRY_ID, STATE_ID) VALUES
    ('Block 5, Apt. 6', {ts '9999-12-31 00:00:00.0'},
    {ts '2004-03-12 17:13:27.792'},
    'Oakwood', '61043', 1, '1234',
    'Mailstop 820',
    {ts '2004-03-12 17:13:27.792'},
    {ts '2004-03-12 16:50:12.0'},
    'dataLoad',
    '5a052407-dac6-42ad-bbbf-29edc94488c1',
    'IBM Corp.', NULL, '140 Main Street', 'US', 'NJ')
    ClientSession(790235177)--Connection(2102560837)--rollback transaction
    ORA-00001: unique constraint (PTTCBSI.PK_ADDRESS_DETAIL) violated

    KK,
    We are back-porting the support for oracle.sql.TIMESTAMP to 9.0.4 in an upcoming patch-set. It is possible to enhance TopLink using a customer conversion manager or database platform to add this support if required in the short term.
    Doug

  • Timestamp generated by javascript turning the time to zeroes

    Hello,
    I'm trialing Adobe Acrobat XI for my company and am trying to create a form with a unique timestamp using this script:
    var f = this.getField("UniqueID");
    f.value = util.printd("mmddyyyyHHMMss", new Date());
    However the HHMMss part of the output keeps turning to zeroes so it will look like:
    08302013000000
    Instead of (For example)
    08302013223231
    The time does however appear when the box is selected but when it is deselected it goes back to 000000 as the time.
    This is an issue as these time stamps need to be unique every time as this form will be used more than once per day.
    Any suggestions on how to fix this? I'm still really new to Javascript.
    Thank you,
    Michael

    Where did you place this script exactly?
    I set it under the fields calculate setting, under custom calculation script.
    Did you set the format category to anything?
    I set the format category to date, then custom and set it up as mmddyyyyHHMMss
    Clearing the formatting fixed the issue.

  • Flattening LV Timestamp to String

    Hardware:
     cRIO 9004 with 9103 FPGA.
    I am running your standard Low-Priority, High-Priority / Host PC
    split-architecture to acquire data via my 9004/9103 and sending that
    data via TCP/IP to my host computer.
    I want to send a unique timestamp generated in the High Priority loop
    with my FPGA data over the TCP/IP , but need some advice on how to
    break it up and append it to my flattened string.  The reason I
    want to do this is that I want to generate a waveform from my data when
    it gets back to my host PC.  The data is in an array from my FPGA
    call.
    I can cobble something together, but am wondering whether someone
    cleverer than I has run into this and has some advice / sample code.
    Thanks!!
    Wes
    Wes Ramm, Cyth UK
    CLD, CPLI

    Hi Wes:
    If I understand correctly, all you are trying to do is to essentially transport a waveform from your RT system to your Host?
    If so you can simply take the data point and the time stamp and use the Build Waveform function on your host side.
    Best Regards,
    Jaideep

  • Difference between Unique key and Unique index

    Hi All,
    I've got confused in the difference between unique index & unique key in a table.
    While we create a unique index on a table, its created as a unique index.
    On the other hand, if we create a unique key/constraint on the table, Oracle also creates an index entry for that. So I can find the same name object in all_constraints as well as in all_indexes.
    My question here is that if during creation of unique key/constraint, an index is automatically created than why is the need to create unique key and then two objects , while we can create only one object i.e. unique index.
    Thanks
    Deepak

    This is only my understanding and is not according to any documentation, that is as follows.
    The unique key (constraint) needs an unique index for achieving constraint of itself.
    Developers and users can make any constraint (unique-key, primary-key, foreign-key, not-null ...) to enable,disable and be deferable. Unique key is able to be enabled, disabled, deferable.
    On the other hand, the index is used for performance-up originally, unique index itself doesn't have the concept like constraints. The index (including non-unique, unique) can be rebuilded,enabled,disabled etc. But I think that index cannot be set "deferable-builded" automatic.

  • INDEX UNIQUE SCAN instead of   INDEX FULL SCAN or TABLE ACCESS FULL

    I have calculated statistics in all tables and indexes
    I have a table and a view and when I put it
    SELECT *
    FROM TABLE_A A
    INNER JOIN VIEW_B B ON A.KEY_ID = B.PFK_KEY_ID          
    WHERE (B.FK_ID_XXX = 1)
    If I see the execution plan:
    In TABLE_A make a
    TABLE ACCESS BY INDEX ROWID
    INDEX UNIQUE SCAN (FIELD_A_TABLE_A_PK)
    It’s OK. I NEED IT (INDEX UNIQUE SCAN)
    But If I put
    SELECT A.Field_1, A.Field_2, A.Field_3, A.Field_4
    FROM TABLE_A A
    INNER JOIN VIEW_B B ON A.KEY_ID = B.PFK_KEY_ID          
    WHERE (B.FK_ID_XXX = 1)
    In table A make a TABLE ACCESS FULL.
    Then If I put:
    SELECT /*+ INDEX(A FIELD_A_TABLE_A_PK) */ A.Field_1, A.Field_2, A.Field_3, A.Field_4
    FROM TABLE_A A
    INNER JOIN VIEW_B B ON A.KEY_ID = B.PFK_KEY_ID          
    WHERE (B.FK_ID_XXX = 1)
    If I see the execution plan:
    In TABLE_A make a
    TABLE ACCESS BY INDEX ROWID
    INDEX UNIQUE SCAN (FIELD_A_TABLE_A_PK)
    It’s OK. I NEED IT (INDEX UNIQUE SCAN)
    Finally, If I put other tables and views in the query (I NEED IT)
    For example:
    SELECT /*+ INDEX(A FIELD_A_TABLE_A_PK) */ A.Field_1, A.Field_2, A.Field_3, A.Field_4
    FROM TABLE_A A
    INNER JOIN VIEW_B B ON A.KEY_ID = B.PFK_KEY_ID          
    INNER JOIN TABLE_C….
    LEFT JOIN VIEW_D….
    WHERE (B.FK_ID_XXX = 1)
    If I see the execution plan:
    In TABLE_A make a
    TABLE ACCESS BY INDEX ROWID
    INDEX FULL SCAN (FIELD_A_TABLE_A_PK)
    I need INDEX UNIQUE SCAN instead of INDEX FULL SCAN or TABLE ACCESS FULL.
    How can obtain it?
    What happens???
    Thanks!

    Notice the difference in cardinality between your two select statements:
    SELECT STATEMENT, GOAL = ALL_ROWS Cost=5 Cardinality=1
    SELECT STATEMENT, GOAL = ALL_ROWS Cost=10450 Cardinality=472161Apparently since the optimizer believed the first statement was going to return one row, it used an index. But in the second statement it believed it was going to return nearly the whole table (didn't you say it had around 500k rows?). Hence full table scan.

  • "scan from string" to timestamp doesn't work for 18:00:00 (6PM)

    I just found a strange issue in LabVIEW.  I hope I'm doing something silly, but I just may have found an unusual bug.
    run the snippet below with the following for the input string: 03:00:00,18:00:00,17:00:00
    Time converts fine for just about any other time EXCEPT 18:00:00 (6 PM) for which it is returned as 00:00:00 (midnight). If you even add a second to it (18:00:01) you get back the expected result.
    Here's hoping I'm not loosing my mind
    Matt Holt
    Certified LabVIEW Architect
    Solved!
    Go to Solution.
    Attachments:
    TimeParseBug.vi ‏11 KB

    As annoying as it may seem, this exact scenario is an abuse of the timestamp. A timestamp is meant to be used for absolute times. And that includes a date. As Ravens Fan already pointed out, the 0 seconds since January 1, 1904 GMT is used in all timestamp display routines to mean the canonical invalid timestamp and hence the timestamp control displays the default string indicating the actual date/time format rather than a specific date/time.
    If you need an absolute timestamp, for instance because you do want to have a local time indication, although the date is not relevant, adding an offset of 86400 to all values would fix it once and for all. Now the timezone offset can't cause the timestamp to reach 0 ever, even if you reside west of GMT, and it will be fine (until you start to do timestamp arithmetic that involves subtraction of relative timespans, then you would have to make the offset big enough that this will never get an issue). The current date would serve as a nice offset for that, which would be MattH's last suggestion. Nice to see that the Scan from String routine actually does use the passed in timestamp as default value and only replaces the values it is configured to parse.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How to create unique objects in class and store

    Hi, I have a class that opens a text file and reads in the
    lines. each line holds an ip address. i need to create x amount of
    objects, and each object is assigned a unique ip address from the file.
    and here i am stuck. the class reads in the file, then i think it should create an object for each line read in and assign that object the ip address. i want to store the objects in some sort of array or collection, and i guess each object will need a unique name, but i dont know how many objects until i read in the file and count the number of lines. can anyone give me any pointers as to how i should create/store the objects
    many thanx
    ness

    You could use your own object:
    public class Test {
      public class IPNumber {
        public int ip;
        public IPNumber(int ip) {
          this.ip = ip;
      public Test() {
        int numberOfIPs = 5; // this is your number of lines
        IPNumber[] ips = new IPNumber[numberOfIPs];
        for (int i = 0; i < numberOfIPs; i++) ips[i] = new IPNumber(i); // assign ip address from file
      public static void main(String args[]){
        new Test();
    }or you could store the ips as strings:
    public class Test {
      public Test() {
        final int numberOfIPs = 5; // this is your number of lines
        final java.util.ArrayList al = new java.util.ArrayList(numberOfIPs);
        for (int i = 0; i < numberOfIPs; i++) al.add(""+i); // assign ip address from file   
      public static void main(String args[]){
        new Test();
    }p.s Objects don't have names

  • When a dimension PK is suddenly not unique - how to go around it

    Good day all,
    I've faced a peculiar problem. Pulling a dimension that I've thought I'd have problem with - I noticed something strange on a most detailed level.
    Org/ Cost Code /Expenditure Amt
    ZZZ 2445 /$1100
    ZZZ 2445 /$1100
    ZZZ 2445 /$1100
    ZZZ 2445 /$1100
    I thought that something was wrong.Indeed, that particular dimension has 4 records for that code (with different categories). Ideally, this should come up as ZZZ / 2445 / $1000
    I wonder if this is possible? The only thing I'm thinking about is that I could set this dim level to total.
    Thanks

    You need a unique key in the Business model - even if its an internally generated ID which you don't expose to the user. That needs to appear at the lowest level of the dimension too, but you can uncheck use in drilldown so it never appears.

  • "ORA-1715 : UNIQUE may not be used with a cluster index" but why?

    "ORA-1715 : UNIQUE may not be used with a cluster index" but why and what "may" means here? Any comments will be welcomed, thank you and best regards;
    show rel
    release 1002000300
    CREATE CLUSTER sc_srvr_id (
    srvr_id NUMBER(10)) SIZE 1024;
    SELECT cluster_name, tablespace_name, hashkeys,
    degree, single_table FROM user_clusters;
    CREATE UNIQUE INDEX idx_sc_srvr_id ON CLUSTER sc_srvr_id;
    ERROR at line 1:
    ORA-01715: UNIQUE may not be used with a cluster index
    CREATE INDEX idx_sc_srvr_id ON CLUSTER sc_srvr_id;
    SELECT index_name, index_type, tablespace_name
    FROM user_indexes where index_name like '%SRVR%' ;
    CREATE TABLE cservers (
    srvr_id    NUMBER(10),
    network_id NUMBER(10),
    status     VARCHAR2(1),
    latitude   FLOAT(20),
    longitude  FLOAT(20),
    netaddress VARCHAR2(15))
    CLUSTER sc_srvr_id (srvr_id);
    ALTER TABLE cservers add constraint pk_srvr_id primary key (srvr_id ) ;
    SELECT index_name, index_type, tablespace_name
    FROM user_indexes where index_name like '%SRVR%' ;
    INDEX_NAME                     INDEX_TYPE
    TABLESPACE_NAME
    IDX_SC_SRVR_ID                 CLUSTER
    USERS
    PK_SRVR_ID                     NORMAL
    USERSdo we really need another pkey index here?

    "May" has different meanings, one of which is:
    (used to express opportunity or permission)
    Metalink note 19067.1 says:
    This is not permitted.
    ... which agrees with the above meaning of it.
    Besides these, it does not make any sense to me to create a unique index on a cluster. You can have primary keys in the tables you include in the cluster, it depends on your business requirement. But why do you need a unique index on a cluster?

Maybe you are looking for