strange timestamp conversion problem

I have two packages of PL/SQL, both have the same owner and my java application connects to the db as the owner. The first package contains these features:

function convert_to_millis(ts timestamp) return number as
ms number;
begin
  select round(((trunc(sys_extract_utc(ts), 'MI') - DATE '1970-01-01')* 24 * 60 * 60) + extract(second from ts), 3) * 1000 into ms from dual;
  return ms;
end convert_to_millis;

function current_time_in_ms return number as
begin
  return convert_to_millis(systimestamp);
end current_time_in_ms;

and the second package contains a procedure that calls the functions in the first set:

debug(first_package.current_time_in_ms ||';'||
     round(((trunc(sys_extract_utc(systimestamp), 'MI') - DATE '1970-01-01')* 24 * 60 * 60) + extract(second from systimestamp), 3) * 1000) ||';'||
     to_char(systimestamp,'HH24:MI:SS TZH:TZM'));

How is it possible that the first two debug values from the second package are different (the call to current_time_in_ms gives a wrong value, the inline expression is correct)?

The timezone in the third parameter, debug is '+ 02:00 ', which is also the time difference between the first two values.

In addition, when I connect to the db to SQL Developer (with the same account as the application) and perform the procedure in the second package, the first two parameters give the same correct value, the time zone in new '+ 02:00 '. However, I think that this could be explained by different parameters of sessions (NLS params?).

My system:

Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

PL/SQL Release 11.2.0.1.0 - Production

"CORE 11.2.0.1.0 Production."

AMT for Linux: Version 11.2.0.1.0 - Production

NLSRTL Version 11.2.0.1.0 - Production

change the data type of input parameter of CONVERT_TO_MILLIS of TIMESTAMP for TIMESTAMP WITH TIMEZONE.

SYSTIMESTAMP is the type of TIMESTAMP WITH TIMEZONE data. Your function converts the TIMESTAMP. I think it's what the cause of the difference.

Tags: Database

Similar Questions

  • Timestamp conversion problem.


    Hi Vinicius,

    This image should give you a clue...

  • Conversion problem 8i to oracle 11g database timestamp

    Hello
    I have an interface that migrates data from 8i to Oracle 11 g server. I use ODI 10.1.3.5 version for this migration.
    When we try to send the timestamp from 8i to 11g, time stamp values are coming as parag 00:00:00.
    I tried almost all the functions of conversion posible as to_timestamp (tochar(field,format), format).
    The above mentioned is the last conversion I used which is insert 0 in the timestamp.
    Please let me know the resolution if someone has experienced the same problem.

    Thank you
    Naveen

    Hello

    Maybe you can try with this...

    Add a topology for the JDBC url property.

    Key = oracle.jdbc.V8Compatible
    Value = true

    Thank you
    Fati

  • Conversion problem of oracle.jbo.domain.Date in java.util.Calendar and oracle.jbo.domain.Timestamp to oracle.jbo.domain.Date

    Hello world

    Work with dates has been harder than I thought! Please take a look at the code; everything compiles, but it fails because I'm not cast properly. Any help would be appreciated.

    Imports are:

    import java.sql.SQLException;

    to import java.text.ParseException;

    import impossible;

    import java.util.Calendar;

    Import oracle.jbo.domain.Date;

    Import oracle.jbo.domain.Timestamp;

    Here is the method:

    public static Date (String sDate, int day, nextDay

    SimpleDateFormat String) {}

    Date result = null;

    java.util.Date date;

    If (sDate! = null) {}

    try {}

    System.out.println ("Try...");

    Calendar calendar = Calendar.GetInstance ();

    SimpleDateFormat dateFormat =

    new SimpleDateFormat (simpleDateFormat);

    calendar.setTime (dateFormat.parse (sDate));

    Calendar.Set (Calendar.DAY_OF_WEEK, date); day = Calendar.SUNDAY

    Calendar.Set (Calendar.HOUR_OF_DAY, 0);

    Calendar.Set (Calendar.MINUTE, 0);

    Calendar.Set (Calendar.SECOND, 0);

    Calendar.Add (Calendar.DATE, 7);

    dateFormat.format (calendar.getTime ());

    try {}

    System.out.println ("try (inside)... ») ;

    "System.out.println (" new Timestamp (calendar.getTime () .getTime ()) "):" +.

    new Timestamp (calendar.getTime () .getTime ()));

    result = new Date (Timestamp (calendar.getTime () .getTime ())) new; Code does not work here.

    return the result;

    } catch (SQLException e) {}

    System.out.println ("catch (SQLException e)... ») ;

    e.printStackTrace ();

    }

    Returns a null value.

    } catch (ParseException exception) e {}

    System.out.println ("catch exception e ParseException... ») ;

    e.printStackTrace ();

    }

    Returns a null value.

    }

    Returns a null value.

    }

    Here is the result:

    try...

    Try (inside)...

    new Timestamp (calendar.getTime () .getTime ())): 2013-12-29 00:00:00.0

    catch (SQLException e)...

    java.sql.SQLException: failed initialization

    to oracle.sql.DATE. < init > (DATE.java:237)

    to oracle.jbo.domain.Date. < init > (Date.java:378)

    James

    try to convert timestamp to jbo.date as

    java.sql.Timestamp datetime =newjava.sql.Timestamp(System.currentTimeMillis());

    oracle.jbo.domain.Date daTime =new  oracle.jbo.domain.Date(datetime);

  • CRIO-9066 FIFO data conversion problem

    I'm having a problem with a multiple element SGL FIFO on a cRIO-9066 where data is not read correctly.  Here is the configuration:

    I have two Host - to - Target FIFOs, identical except for type: FXP is the other SGL.  Both are 16-element.  Data SGL which are read turns a conversion error.  A sample minimum (2014 for the 9066) project is included.

    The example works fine if the FIFO SGL 1-element; something more big fails.  Is not supported on the same 9066 thought that the project allows the creation?

    Thank you

    David

    It seems that maybe it's a bug in the Simulator.  Exit the simulation mode, run it on your target and watch the interactive mode in this way.  The results are what you expect.  It is strange that they would be converted at some point.

  • Since last week, I have a PDF to WORD conversion problem.  All the documents, I have try to convert room conversion failed.  What is going on?  Thanks in advance and I look forward to hear from you.

    Nice day

    Since the last week I'm trouble conversion PDF to WORD.

    All documents I try to convert room conversion failure.

    What happens?

    Thanks in advance and I look forward at the hearing of your.

    Hi prates77,

    I'm sorry to hear that you are experiencing problems, file conversion. You receive a conversion error, regardless of the file you are trying to convert? The error occurs if you use the web interface, or convert by the reader? And a strange question: how many files you have stored in your Acrobat.com account? We have seen reports of this error when there are a large number of files stored in the folder root your Acrobat.com account.

    I can't wait to hear back on your part.

    Best,

    Sara

  • Timestamp conversion customer

    Hello

    I noticed weird customer in number to the time stamp function. If the entry is 0 then the time stamp indicator:

    00:00:00, 000

    DD. MM. YYYY

    which is OK, but IMHO the date should indicatecurrent the current date or a default date. If I increase the input 1, I get:

    01:00:01, 000

    1.1.1904

    So the date default 1.1.1904 (OR why is it not the case when 0 is at the entrance?) and why do I 1 h and 1 s on the clock when only 1s should be added? There is more so I entered 82801 (1 day and 1 second later) the timestamp shows:

    00:00:01, 000

    2.1.1904

    I found that trying to implement the start of Test and the elapsed time. What I did evade and currently the following current timestamp with the previous one - jusl like when you run VI with number of cycles of time.

    Another strange thing is that, when using a function to convert time in seconds, it seems that is 1 min 40 seconds then UNMIT counter is increased and the seconds counter goes up-19 and counties to 0.

    A bug or am I missing something?

    3DVision wrote:

    Another strange thing is that, when using a function to convert time in seconds, it seems that is 1 min 40 seconds then UNMIT counter is increased and the seconds counter goes up-19 and counties to 0.

    A bug or am I missing something?

    That is not hidden a timestamp in seconds. It converts to a cluster, which exempt you from then to another cluster. The behavior for this operation is to subtract each element of the cluster of the corresponding item in the other group, and that's why you see-14 seconds. As you can see, LV refuses to translate only a timestamp back.

    If you want to get the elapsed time in seconds, just subtract the two stamps with each other (you may need to convert to DBL before or after subtraction).

  • String to number conversion problem

    I have a VI that pulls in data from a device using VISA, and I got it on another computer to work a few weeks back. I had to transfer the VI to a laptop computer to run a few tests, and now I can't make it work. I am unable to put my VI because the laptop on it's is unable to access the network companies, I will do my best to explain it all, I apologize for the inconvenience! My problem is not however with VISA, it's with an exit VISA number conversion chain.

    I have attached a painting drawing of VI to better explain it.

    I use the block series Visa football match in baud rate and all that many good things to the unit and port settings set of device management. Then, a while loop is entered. The loop will run until you press the stop"" button. The next block of visa is the writing block, he asks for a reading of the device. The next block of visa is the first block of reading, he returns playback in the form of "NA-XXX. X' where x are numbers. The next block of visa is the second reading block, this block just echoes back the command sent to the device. Playback of the first visa read block, "NA-XXX. X' is going exponential/fractional chain to digital converter.

    When you perform a run/debug to highlight run, the release of visa reports the correct value, is the value of the device reading - however the string to number converter generates a 0,000, no matter what channel number is. I am at a loss as to what may be wrong because it's the EXACT set up I had to work very well a few weeks ago!

    I'm using Labview 10 on the laptop, the old computer was labview 7. I'm guessing that this is perhaps the rub... I Redid the VI from scratch, although I have not opened the old VI in labview 10.

    Any help would be appreciated. Again, sorry I am unable to attach the VI.

    DARB wrote:

    I have attached a painting drawing of VI to better explain it.

    Would it not have been easier to just post a screenshot? You might also have used the Tool of Capture of Code. (Which reminds me that I need to install it to my previous versions of LabVIEW, as evidenced by the screenshot I took. )

    As to the question: you probably either:

    • employee analysis of chain initially and when you rewrote the VI you used the regular string conversion functions.
    • Wired an offset value in the string to the number function.

  • Strange photo printing problem.

    Windows 7 SP1 runs on a home-built PC (Intel Core 2 Duo E8400/Nvidia 8600GT) my printer is a HewlettPackard Deskjet 1050 A., I'm having a problem very strange printing photos and other images.

    If the image is stored on my PC, it will print only in shades of gray, well that the images display correctly in color on the monitor. Images printed directly from the internet using "file > print" in the menu of the browser print in color.

    Diagnostic and test pages print in color, as expected. Color of text prints correctly. In "Printing Options", "Print in grayscale" is disabled. I thought initially a printer problem, but printer diagnosis and convenience stores to find nothing wrong.

    I think that the problem must be in the attributes or properties of the image, but I don't know where to begin the search in order to find a solution.

    Anyone know what I can do to fix this?

    Gary,

    In addition to answering the question about the types of files which are giving you the problem, what program you use to view and print the files saved on your computer?

    If you are using the Windows Photo Viewer (Windows 7 by default), see--> http://answers.microsoft.com/en-us/windows/forum/windows_7-pictures/jpegs-only-print-in-black-and-white-via-the-image/b9c1a406-b046-48d3-b9c3-ab23279c8b3a

  • Disqualification: Date conversion problem

    Hi all

    For some reason, it turns out that which was built as 00:30:15 (HH) will be automatically converted to 12:30:15 (HH) as string value. See screenshot below.

    Date issue.png

    Tried several things in the reference list of date format, but no resolution yet. How can we avoid this conversion?

    Problem has been resolved:

    Under two date formats have been contradictory:

    DD/MM/YYYY HH: mm 23/01/2014 12:30
    DD/MM/YYYY HH: mm 03/01/2014-10:10

    Deleted the premiera and dates are converted correctly now.

  • the date conversion problem

    Hi friends,

    I have a problem with the conversion of the date in my PB.

    SELECT eff_dt, TO_CHAR (TO_DATE (eff_dt, 'Dd-mon-yy'), 'dd-mm-yyyy') DATE from une_table;

    It gives me o/p as -.

    DATE OF EFF_DT

    01.01.1950 00:00:00 01/01/2050

    as you can see here the year is wrong, while I convert the date that I use the substr() also to cut the year of first line, but it gives me the 50 i.e. onle last (YY)

    So, if someone can help me with this prob.

    If eff_dt is a column DATE, then stop calling to_date on it.

    If this is not the case, consider making it into a DATE column. If you are unable to do this, use the format mask appropriate when you call to_date

  • char conversion problem

    Hi all

    in the following query:
    select to_date('31-JUL-12', 'dd-MON-yy') res from dual;
    We have the error:
    ORA-01843: not a valid month
    01843. 00000 -  "not a valid month"
    *Cause:    
    *Action:
    .. .This is the first strange error / for me :)...



    After this conversion - I want to convert to a char.

    Expected results:
    2012/07/31 00:00:00
    Any ideas?


    Version: 11g



    Thanks in advance,
    Bahchevanov.

    Bahchevanov wrote:
    It is in Cyrillic, perhaps because the database is installed on different language.../i'm not able to know....

    No need of. Just use the third parameter TO_DATE:

    SQL> ALTER SESSION SET NLS_LANGUAGE=BULGARIAN
      2  /
    
    Session altered.
    
    SQL> select to_date('31-JUL-12', 'dd-MON-yy') res from dual;
    select to_date('31-JUL-12', 'dd-MON-yy') res from dual
                   *
    ERROR at line 1:
    ORA-01843: not a valid month
    
    SQL> select to_date('31-JUL-12', 'dd-MON-yy','NLS_DATE_LANGUAGE = American') res from dual;
    
    RES
    ----------
    2012-07-31
    
    SQL> 
    

    SY.

  • RedHat4 conversion problem

    Hi guys,.

    I convert a server Linux Redhat 4, and it gives me problems. When I start the wizard, select a remote computer, powered, he know "a general error has occurred: uninitialized: converter.info.StorageInfo storage.volume.diskId. Unfortunately, it is not all that useful to understand what is happening. My log files are included. Any suggestions to what is happening?

    See you soon

    Nik

    I'm guessing it's because you have volumes that are mapped directly to complete drives, instead of create a partition to contain the volumes.  It is not supported by the converter at the moment, please see the release notes:

    http://www.VMware.com/support/converter/doc/releasenotes_conv401.html#84

    You could try to remove those file systems that are mapped directly on the hard disks (/ storage/data_01, etc.), and then try to restart the Conversion.  After that it's over, you can add new disks on the virtual computer and just copy the data of these file systems that you have ignored.

    (If your question has been resolved please check the responses as 'Useful' or 'Correct').

  • Document Conversion problem

    We're trying to convert a FrameMaker 10 book into a PDF file and only in a section of the graphic document is randomly being left out.  Adobe leaves a space where the graphic should be.  And in one case, he even left the arrows pointing to various components, but the rest of the picture was missing.  We tried to convert just a section to be able later to add it in Adobe Pro thinking the file size could be the issue - no joy.  We tried to copy the file in FrameMaker vice he saw a link to the document - no joy.  We tried to change the printer (and, therefore, the printer drivers) that we use during the conversion process, thinking it was a problem of driver/memory printer - no joy.  Finally, we have tried to put the file on the disk hard vice the server - no joy.  Graphics are always left just a section of the document.  It wasn't even the same graphics each time (some changed, most have remained the same).  The graphics are CGM files.  Not sure if this has something to do with it.  But we have nothing else in common with the graphics another that they have just a section of the document.  Other sections of the document have even larger graphics (file size).  Has anyone any suggestions?  I tried to put my email address from work here and he said that someone was already using (unlikely) but never the less, I resorted to the personal use of my email in order to get an account.  Unfortunately, I'm unable to retrieve messages from my personal account to work.  If you have a suggestion, please send me an email to [email protected].  Thank you.

    Check box "Convert CMYK to RGB colours" was selected.  I unchecked it and tried again.

    You are a genius!  It worked! Thank you.

  • Strange Remove applet problem

    Hello

    I have a problem with the deletion of a specific applet on my card. When you try to remove it, I get 6985 SW. When I'm trying to remove his main pkg with related bodies, I get 6985 SW too. The strange thing is, I am able to instantiate the same applet (of the same module) with other AID that can be removed without problem. I can't reproduce this with my emulator.

    Is someone can you please tell me what is happening?

    Thank you very much in advance.

    Hello

    It is possible that you have static references in your code that are created during execution that are not be cleaned. This will prevent the applet cannot be deleted. I would have thought that remove the package with related bodies would work. Is it possible that there is another cmdlet on the map to access fields or self-esteem of this applet?

    You must implement the AppletEvent interface in your applet so that you have a hook to be called when the applet instance must be deleted. You can then use this cleaning all the references you have that there would be. It won't help now that you cannot remove the old applet, but it avoids what happens in the future.

    See you soon,.
    Shane

Maybe you are looking for