Adding interval to systimestamp

Hello

With the help of Oracle 11 g R2.

I need to create a query that displays the records that exceed a certain length of time. I decided (with the help of Frank) that I need to add 2 hours to my query in order to get the correct results, but I'm having a hard time understanding why this interval of 2 hours must be added to the query. The structure of the table and query are simple and are as follows.

create table testtime (col1 number, col2 timestamp(6))

insert into testtime values (1, systimestamp)
insert into testtime values (2, systimestamp)

Most likely your time zone is different from the time zone database. For example:

SQL > alter session set time_zone = "00:00 '"
2.

Modified session.

SQL > select sessiontimezone,.
2 dbtimezone
3 double
4.

SESSIONTIMEZONE DBTIME
--------------------------------------------------------------------------- ------
+00:00                                                                      -05:00

SQL >

Systimestamp Function Returns the current timestamp to the zone database. So, return time to the time zone IS:

SQL > select systimestamp
2 double
3.

SYSTIMESTAMP
-----------------------------------
28 DECEMBER 13 02.51.29.650000 PM - 05:00

SQL >

Now, it is inserted into the column and what data type is timestamp. Timestamp data type has no concept of timezone, so inserted value is:

DECEMBER 28, 13 02.51.29.650000

Then you subtract from systimestamp. Now systimestamp has time zone while the column is not. Why Oracle applies by default rule - adds session time zone. So the value of the column is:

28 DECEMBER 13 02.51.29.650000 PM-00:00

As you can see, we just lost 5 hours. and example to illustrate the it:

SQL > alter session set time_zone = "00:00 '"
2.

Modified session.

SQL > select sessiontimezone,.
2 dbtimezone
3 double
4.

SESSIONTIMEZONE DBTIME
--------------------------------------------------------------------------- ------
+00:00                                                                      -05:00

SQL > drop table tbl purge
2.

Deleted table.

SQL > create table tbl (t timestamp)
2.

Table created.

SQL > insert
2 tbl
3 values (systimestamp)
4.

1 line of creation.

SQL > select t,.
2 systimestamp,
3 systimestamp - t diff
4 tbl
5.

T SYSTIMESTAMP DIFF
------------------------------ ----------------------------------- --------------------------
DECEMBER 28, 13 03.02.55.851000 PM DECEMBER 28, 13 03.02.55.861000 PM - 05:00 + 05:00:00.010000 000000000

SQL >

As you can see, the difference became 5 hours. This is why you have been suggested for 2 hours (I guess that your time zone session differs from database 2 hours time zone). But this is a "band-aid" solution It simply hides your misconception. Column should be timestamp with time zone, then:

SQL > alter session set time_zone = "00:00 '"
2.

Modified session.

SQL > select sessiontimezone,.
2 dbtimezone
3 double
4.

SESSIONTIMEZONE DBTIME
--------------------------------------------------------------------------- ------
+00:00                                                                      -05:00

SQL > drop table tbl purge
2.

Deleted table.

SQL > create table tbl (t timestamp with time zone)
2.

Table created.

SQL > insert
2 tbl
3 values (systimestamp)
4.

1 line of creation.

SQL > select t,.


2 systimestamp,
3 systimestamp - t diff
4 tbl
5.

T SYSTIMESTAMP DIFF
------------------------------ ----------------------------------- --------------------------
28 DECEMBER 13 03.08.40.176000 PM - 03.08.40.176000 PM - 05:00 + 000000000 00:00:00.000000 28 DECEMBER 13
05:00

SQL >

Or, if you stay with a current design, you must verify that all insertions/changes would be to convert timestamp inserted/updated to date to the same time zone (utc, for example):

SQL > alter session set time_zone = "00:00 '"
2.

Modified session.

SQL > select sessiontimezone,.
2 dbtimezone
3 double
4.

SESSIONTIMEZONE DBTIME
--------------------------------------------------------------------------- ------
+00:00                                                                      -05:00

SQL > drop table tbl purge
2.

Deleted table.

SQL > create table tbl (t timestamp)
2.

Table created.

SQL > insert
2 tbl
3 values (systimestamp to the "utc" time zone)
4.

1 line of creation.

SQL > select t,.
2 systimestamp,
3 systimestamp to the time zone "utc" - t diff
4 tbl
5.

T SYSTIMESTAMP DIFF
------------------------------ ----------------------------------- --------------------------
DECEMBER 28, 13 08.11.41.052000 PM DECEMBER 28, 13 03.11.41.062000 PM - 05:00 + 00:00:00.010000 000000000

SQL >

SY.

Tags: Database

Similar Questions

  • Bug with the calculation of the interval calendar

    Hello world
    I think the following error is well known already:

    Select to_timestamp ('2012-01-31', 'yyyy-mm-dd') + '1' months apart
    Double;

    In fact, I couldn't find a topic in this forum about this error. My question is: is that someone is aware of a workaround for this (add_months throw timestamp to date, so this isn't an option)? And: Does anyone know if Oracle plans to fix this bug in the Release 12?

    Thanks in advance,

    Jürgen

    Not a bug. Adding interval '1' month for a stamp is SAME day next month. "So if the stamp is the 31st of a month it will cause an error unless it's July 31). Same error happen if we add an interval of 12 months to 29 Feb.

    SY.

  • on systimestamp as variable interval

    Hi all

    just a quick question and I think it's just very simple for you.
    select to_char(systimestamp- INTERVAL '120:00' MINUTE TO SECOND, 'Dy DD-Mon-YYYY HH24:MI:SS') from dual;
    works very well...
    But I want to replace the '120:00' with a variable 'v_interval', so that the interval is not fixed.

    But every time I finish the of in "invalid interval..."

    Please help me.

    Thank you
    Joerg

    Joerg Lang wrote:
    But I want to replace the '120:00' with a variable 'v_interval', so that the interval is not fixed.

    You're talking about SQL * more variable? If so, SQL * more does not interval variables. But this isn't a big problem. Like number set and use the NUMTODSINTERVAL function:

    SQL> variable n number
    SQL> exec :n := 120;
    
    PL/SQL procedure successfully completed.
    
    SQL> select to_char(systimestamp - numtodsinterval(:n,'minute'), 'Dy DD-Mon-YYYY HH24:MI:SS') from dual;
    
    TO_CHAR(SYSTIMESTAMP-NUM
    ------------------------
    Thu 25-Jun-2009 07:02:00
    
    SQL> 
    

    SY.

  • Error adding child on interval...

    Hey,.

    Im trying to add an extra movieclip to the stage with this code, I want an added extra movieclip every 10 seconds...

    addEventListener (Event.ENTER_FRAME, fl_EnterFrameHandler);

    function fl_EnterFrameHandler(event:Event):void
    {
    addChild (movieclip);

    }

    This error pops up:
    setInterval(fl_EnterFrameHandler,10000);
    ArgumentError: Error #1063: incompatibility of County of Argument on Untitled_fla::MainTimeline / fl_EnterFrameHandler (). 1 EXPECTED, got 0.

    Please help me someone

    There are a few little things, you do not want with the code that you show.

    (1) you don't want the ENTER_FRAME event listener.  Which calls the function fl_EnterFrameHandler at the rate of your file.

    (2) using the addChild(), this is not how you add new objects, it is only how to add objects to the display list.  You need create new instances of the object, as in...

    var newObj:MC = new MC(); where MC is any class name you assign to the MovieClip

    and then you can use addChild (newObj) to add the object to the display list.

    The way you have it now, it simply continues his maneuver the same object at the top of the screen.

    (3) the error you are getting is because your function expects an argument to pass to, which provides the ENTER_FRAME listener, but the setInterval does not work. If you get rid of the ENTER_FRAME listener, then you just need to change the line of the function definition to be...

    function fl_EnterFrameHandler (): void

    Just for future consideration, if there is an instance where you call a function that a listener calls also, but you don't have any event argument to pass to the function, then you can host this scenario by the removal of the argument in the function definition line...

    function fl_EnterFrameHandler(event:Event__=null_):void

  • Addition of waveform with adding block - element wise or interpolated or...?

    Hello

    I see the block addition is beautifully overloaded to overlay waveforms and I would like to know how it works. Specifically, I want to know if using matrix addition (i.e. simply by adding the elements of each waveform) OR is he among the waveforms by interpolation and resampling to the points of time corresponding to the other or another method.

    I know that the sampling interval (dt) should be the same for both waveforms added, so I suspect it is using matrix addition, but don't know.

    To add a bit of context, I use this to add two waveforms of sampled data of a sinus waves up to 100 kHz. Sampling faster than my DAQ can exploit the difference in the two waveforms of departure time (t0) is an important part of the period. At this point, I think that the approach by adding simple matrix will not work.

    Thanks for any idea that you can give. See you soon

    -ron

    Hi Ron,

    I don't think there is a VI that does it for you. However, it should not be too difficult to program yourself. There's a Subvi, called 'Get waveform components' that allows you to access the table variables (Y) t0, dt and the data type of waveform data. You can subtract the two start times to find the difference between the two waveforms (DAQ readings put a timestamp on the data). Then you can complete the table operations to create a lag in the data. A few other useful subvis are "Get the subset of waveform" or "Index Waveform Array", you can use depending on how you want to set up your program. Let me know if you need help with this programming. Good luck!

  • Sample interval finished PCI 6071E scanning

    Hello

    We plan to acquire data of an array of 64 pixels linear photodiode using PCI 6071E. Suppose we take 64 x 3 samples our sample rate is 1 ms/s (for 64 channels of avian influenza) and each group of 64 samples are separated by a time interval T * (see photo).

    Platform: WIN XP OS, DAQmx with C++, Int CLK

    For the big T * > 50ms we can set the device to take 64 samples each time and reconfigure the unit and prepare for the next DAQmxReadAnalogF64.

    For the smaller T * (say 2ms), the device may not able to reconfigure quickly enough that works properly. One can think of device configuration to collect samples of 64 x 3 and using external synchronization (using a delayed digital model) to care for the calendar

    (see attached "Sub PDA::Acquire()" C++ code, which can be changed to use Ext. CLK).

    but I post here in case any expert knows an easier way without adding hardware.

    The ideal solution, we expect to send a trigger for each set of 64 samples and controls the delay between each set of acquisition between triggers, but it is not possible to obtain simply by using this device.

    Thank you very much in advance,

    eLions.


  • Creation of interval workout broken

    Creation of interval training is today broken (it worked for me before).

    Trying to create a workout interval today and recorded intervals are not what I entered (see pictures attached). Additional intervals are added, portions high and the recovery of different intervals are blurred and entered paces are not registered.

    I spent an hour trying to get this working, really frustrating!


  • The interval can be changed to conn/http/ftp

    I think I'm an overwhelming my BB (old version NCR) server with too much conn, http and ftp check the cause for suddenly show a ton of purple spinning icons on all these tests for almost all my monitored servers. Is there a way to reduce the frequency of these checks for some servers?

    For example, I can specify the frequency of running scripts to post for example by adding a ";". " ' at the end of the trial, is there something similar for conn, http, ftp &?

    No, all the network tests are based on the same interval.

    What is the current value of BBNETSLEEP?

    you could always use the external fping.sh for connectivity test (conn) and set a specific time limit for this increase (or decrease BBNETSLEEP). To disable the test of conn in Sib, located in bbdef-.sh CONNTEST = FALSE.

    Also, what platform and version are you on?

  • Virtual Storage Manager - can't change instant planning time interval with vSphere Web Client

    Hello

    I try to activate Virtual Storage Manager schedules-model for a data store using vSphere Web Client. Everything works fine, but I can't change the time interval of planning of the snapshot. He remains at 12:00 midnight to 12:00 midnight. I can't change it manually or by dragging the bar.

    I tried with IE9, IE11, newer Chrome browsers. And with Flash versions 15 and 13-. Same mistake.

    I've added the URL of Sites you trust with weaker security settings - no help.

    Y at - it a bug or something else I can try?

    I just talked to Dell support on my problem and this is apparently a known issue with local Europe\UK.  The similarity of our problems might be useful - workaround for me was to settle the Locale\Regional from my PC, where I'm doing it in the United States.  Not the time zone or other settings, to control panel, then "Region and language", then on the first tab, 'Format' box should be set to "English (United States).  Close browsers, start again and it worked for me.

    Might be worth a try if you're not already in US format. (mine was in the United Kingdom).

  • Impact of setting the interval partitioning off and then on again

    Hi all

    Have discovered that to split the partitions of a partitioned table Beach-interval, in that we need to define the partitioning interval all issue the command split then on again.

    e, g.

    ALTER TABLE retailer_transaction SET INTERVAL ();

    ALTER TABLE POR2_retailer_transaction

    SPLIT PARTITION PART_400012 AT (TO_DATE (' 2020-09-01 00:00:00 ',' SYYYY-MM-DD HH24:MI:SS ',' NLS_CALENDAR = GREGORIAN '))

    INTO (PARTITION PART_202008,

    PART_400012 PARTITION)

    ALTER TABLE retailer_transaction SET INTERVAL (NUMTOYMINTERVAL(1,'MONTH'))

    Everything we need to pay attention to that?

    Using oracle 11.2.0.3

    Thank you

    You can NOT split the LAST (most HIGH_VALUE) partition of a partitioned table interval interval. You can only separate partitions BEFORE the last. Which converts also all partitions from the bottom (split and below) for the partitions of the RANGE.

    If interval partitioning will only apply to data added above the transition point (the score higher.

    To return to your original question. To split the LAST interval follow the procedure described in your original post

    1. range partitioning

    2 split the partitioning

    3 set the partitioning interval on

    Conclusion with this however when adding data back to a nine month doesn't automatically create the partition again.

    This "new month" MUST BE above the point of passage for a new partition to create. In your code example, this point of transition is for the year 4000.

    This works very well for me:

    ALTER TABLE sales PARTITION RENAME SYS_P1122 to SALE_400012

    ALTER TABLE sale SET INTERVAL ();

    ALTER TABLE SPLIT PARTITION for sale

    SALE_400012 TO (TO_DATE('01/02/2020','DD/MM/YYYY')) IN

    (

    SALE_202001 PARTITION,

    SALE_400012 PARTITION

    );

    ALTER TABLE sale SET INTERVAL (NUMTOYMINTERVAL(1,'MONTH'))

    INSERT INTO sales

    (SALES_DATE, STORE_NUM, QTY_SOLD)

    values (to_date('31/12/4001','DD/,MM/YYYY'), 1, 10);

    This last INSERT statement above creates a NEW partition because the date (31/12/4001) is above the transition point.

    Looks like you want to move the transition point downwards. That is - you were using this year there date of 4000 as a 'catch all '.

    1. set the partitioning interval

    2 split that last partition into two NEW partitions (new names) by using a VALUE that is high enough to contain ALL the data you have in this last partition.

    3. remove the last partition - it should now be empty

    4. turn on range partitioning

    Now, any data that you insert above this NEW point of transition (the limit that you used for the new partition) it will create a new partition of the interval. Make sure the border is really an end of month, if that's what you want.

    If your data sample had this

    INSERT INTO sales

    (SALES_DATE, STORE_NUM, QTY_SOLD)

    values (to_date('05/10/2016','DD/,MM/YYYY'), 1, 10);

    INSERT INTO sales

    (SALES_DATE, STORE_NUM, QTY_SOLD)

    values (to_date('31/12/4000','DD/,MM/YYYY'), 1, 10);

    So for the step #2 above use split date 06/2016 so that the line above for 10/05/2106 goes to the new partition and 12/31/4000 stays in the old.

    Then, drag this old and lines in it (31/12/4000).

    You can NOT split the last partition if interval is always on because it is the last partition interval.

    And as long as you have given for 12/31/4000, you will get no new partitions unless you insert was more TOP than this.

    So if you want partitioning interval to activate again 06/2016 that higher data would be deleted and the score he falls.

    You have discovered only among "traps" with the help of partitioning of the interval. Oracle will happily create new partition needed to keep the data. If ANYONE, even accidentally, between a date as 12/31/4000 that nobody would ever know until the new data seem to DISAPPEAR for some use cases.

    This is because all data will start to enter this new partition ACCIDENTALLY created instead of a partition for the month, it's part.

    And, and you have discovered, you cannot split this partition directly.

    Delayed segment creation can allow you to pre-create the partitions ahead without actually affecting the segment for them until the first row is inserted.

    Interval partitioning will create the appropriate partitions but not if someone accidentally or intentionally, data will be a valuable capitalized in the table.

  • Refreshing a report APEX region automatically after the specified interval

    Hi all

    I have a region report on my page that I would be refreshed after every 5 seconds auto. The data in the underlying table reports is generated using a procedure. I need to call the procedure after all 5 seconds which will refresh the table, and then the region report must refresh too which will display the updated data.

    Currently, I call the procedure in a front header process that generates the data of the table used in the report:

    I added the following code to the footer area. (I found the code in the report Oracle APEX refreshing simplicity ' Warp11.:. ") The Oracle Apex knowledge group)

    < script type = "text/javascript" >

    <!--

    setInterval ("jQuery('##REGION_ID#').trigger ('apexrefresh');", 5000);

    ->

    < /script >

    How would have managed to perform the procedure after every 5 seconds or more. ? I can only really see if the above code works once the procedure call is repeated after an interval, so I don't know yet if I'm on the right track or not.

    I would appreciate any help

    Concerning

    Dominic

    What apex version do you use?

    Have you tried to put a static region on your area ID and modified the script to refer to this region id?

    for example:

    setInterval ("jQuery('#p1_my_region').trigger ('apexrefresh');", 5000);

    I'm not sure what alternative strings still works, it's best to simply make reference to your own code.

    Edit: using a dynamic region in pl/sql or a classic report based on your data?

    I think you need to provide more information about your problem, so as to avoid the problem of xy suggested previously

  • Interval partitioning: excessive value PARTITION_COUNT

    Hello

    My apologies if this question is in the wrong place - I wasn't sure where to ask.

    I am trying to create a partitioned table of interval:

    CREATE TABLE my_test

    (my_column VARCHAR2 (10))

    created_date TIMESTAMP

    )

    PARTITION OF RANGE (created_date)

    INTERVAL (NUMTOYMINTERVAL (1, 'MONTH'))

    (

    PARTITION part_01 VALUES LESS THAN (TO_DATE('01-DEC-2014','DD-MON-YYYY'))

    );

    The table has only 1 row in it, with a value of created_date a month ago. So I expect to create only a single partition, which includes the rank and a new monthly from December, when data is added.

    When I have a user_part_tables request, is aware that the table has 1 048 575 partitions in the PARTITION_COUNT column.

    What I am doing wrong?

    Oracle version: Enterprise Edition Release 11.2.0.3.0

    Thanks in advance for any help.

    Discovered that the value is actually provided for in the PARTITION_COUNT of user_part_tables: this is the maximum possible scores. The number of existing partitions are in user_tab_partitions.

  • dbms_scheduler.create_window fails with ORA-27418: syntax error in the interval of recurrence or calendar

    I tried to create a window to test the activation of plans of RM. But I get this error.

    SQL > EXECUTE dbms_scheduler.create_window.

    > (-)

    > window_name = > 'day ', -.

    > resource_plan = > 'my_plan ', -.

    > start_date = > systimestamp + 1 /(24*60).

    > repeat_interval = > ' freq = > daily '.

    > time = > ' 0 01:00:00 '.

    > Comments = > ' C know if it works without a job "-"

    >);

    BEGIN dbms_scheduler.create_window (window_name = > 'day', resource_p)

    LAN = > 'my_plan', start_date = > systimestamp + 1 /(24*60), repeat_interv

    Al = > ' freq = > daily ', duration = > ' 0 01:00:00 ', comments = > ' C so she

    works without employment '); END;

    *

    ERROR on line 1:

    ORA-27481: 'SYS '. "' DAY ' has an invalid schedule

    ORA-27418: syntax error in the interval of recurrence or calendar

    ORA-06512: at "SYS." DBMS_ISCHED", line 486

    ORA-06512: at "SYS." DBMS_SCHEDULER', line 1295

    ORA-06512: at line 1

    I have tried many tips found on the web, nothing works.

    Any help would be greatly appreciated.

    Also, can you pls tell me if this command run once automatically activates the my_plan after 1 minute, 1 minute, after which, it will disable the my_plan? So, you do not need to create a JOB for this. If you create a window, that is, as a job creation to enable an RM plan?

    2734369 wrote:

    Wow, discovered the issue: the repeat interval is broken (I use a database of 12.1 in Windows 7). It must be uppercase. Very surprising in the windows to be case-sensitive.

    SQL >

    SQL > EXECUTE dbms_scheduler.create_window.

    >  (-

    > window_name-online 'day ', -.

    > resource_plan-online 'my_plan ', -.

    > start_date-online systimestamp + 1 /(24*60).

    > repeat_interval-online ' FREQ = DAILY; BYHOUR = 10; BYMINUTE = 30', -.

    > time-online ' 0 01:00:00 '.

    > Comments => ' C know if it works without a job "-"

    >  );

    PL/SQL procedure successfully completed.

    Problem is, after 1 minute, always that the plan is not activated?

    SQL > SEE THE RESOURCE_MANAGER_PLAN PARAMETER

    VALUE OF TYPE NAME

    ------------------------------------ ----------- ----------------------

    resource_manager_plan chain

    Why the Plan is not activated after 1 minute. Have we not create a job (I don't think).

    I think you misunderstand the meaning of "start_date".  Please see the documentation on what this means exactly.

    This attribute specifies the first date and time where it is scheduled to open in this window. If the value start_date specified is in the past or is not specified, the window opens, from its inception.

    To repeat windows using an expression of the calendar to specify the repetition interval, the value of start_date is a reference date. The first time the window opens depends on the specified repeat interval and the value of start_date .

    (From Types and Oracle® packages of PL/SQL Database 11g Release 2 (11.2) reference E40758-03); dbms_scheduler, create_window.  DBMS_SCHEDULER

    Once you have done this, you will see that it is pretty useless to specify that you have.

    Your repeat_interval said "every day at 10:30.

  • Between the operator on systimestamp do not return data

    create the table test_ts1 (timestamp);

    insert into test_ts1 values (systimestamp);

    insert into test_ts1 values (systimestamp-interval '1' time);

    commit;

    Select * from test_ts1 where one between systimestamp - interval '1' time and systimestamp;

    do not return data, could you please help? I would if necessary the param values.

    --

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

    PL/SQL Release 11.2.0.2.0 - Production

    "CORE 11.2.0.2.0 Production."

    AMT for Linux: Version 11.2.0.2.0 - Production

    NLSRTL Version 11.2.0.2.0 - Production

    Thank you

    Mahesh

    2 options.

    1 convert your datatype of the column of TIMESTAMP WITH time ZONE SCHEDULE

    SQL > create table test_ts1 (a timestamp with time zone);

    Table created.

    SQL > insert into test_ts1 values (systimestamp);

    1 line of creation.

    SQL > insert into test_ts1 values (systimestamp-interval '1' time);

    1 line of creation.

    SQL > commit;

    Validation complete.

    SQL > select *.
    2 of test_ts1
    3 where one between systimestamp - interval '1' time and systimestamp;

    A
    ---------------------------------------------------------------------------
    MAY 19, 14 09.06.01.135799 AM - 04:00

    2 convert SYSTIMESTAMP TIMESTAMP.

    SQL > DROP TABLE TEST_TS1 IS SERVING;

    Deleted table.

    SQL > create table test_ts1 (timestamp);

    Table created.

    SQL > insert into test_ts1 values (systimestamp);

    1 line of creation.

    SQL > insert into test_ts1 values (systimestamp-interval '1' time);

    1 line of creation.

    SQL > commit;

    Validation complete.

    SQL > select *.
    2 of test_ts1
    3 where one between systimestamp - interval '1' time and systimestamp;

    no selected line

    SQL > select *.
    2 of test_ts1
    3 where one between Mount (systimestamp timestamp) - interval '1' time and cast (systimestamp timestamp);

    A
    ---------------------------------------------------------------------------
    MAY 19, 14 09.04.09.132503 AM

  • Missing time based interval readings out

    I'm using oracle 11.2.0.1 Enterprise Edition. And I tried write differently query but unable to go there. Your help is greatly appreciated.

    The query should give out as I explained below.

    This request is to identify gaps in the readings of the interval.

    This is my creation script.
    create table rtype)
    rid the number,
    RDesc varchar2 (30));

    insert into rtype values (1, 5-deviceinterval');
    insert into rtype values (2, 15-deviceinterval');

    create table (reads
    number of DEVICE_ID,
    rid the number,
    number of qstartid
    number of qfinishid
    number of ReadValue,
    date of readtimestamp);

    Insert in the values of readings (123, 1, null, null,.951, to_date (May 1, 2012 00:00:00 "," mm/dd/yyyy HH24:MI:SS));))
    Insert in the values of readings (123, 1, null, null,.51, to_date (May 1, 2012 00:05:00 "," mm/dd/yyyy HH24:MI:SS));))
    Insert in the values of readings (123, 1, null, null,.51, to_date (May 1, 2012 10:00:00 "," mm/dd/yyyy HH24:MI:SS));))
    Insert in the values of readings (123, 1, null, null,.51, to_date (May 1, 2012 15:00:00 "," mm/dd/yyyy HH24:MI:SS));))
    Insert in the values of readings (123, 1, null, null,.51, to_date (May 1, 2012 20:00:00 "," mm/dd/yyyy HH24:MI:SS));))

    Insert in the values of readings (123, 1, null, null,.51, to_date (May 1, 2012 01:00 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (123, 1, null, null,.61, to_date (May 1, 2012 01:05 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (123, 1, null, null,.41, to_date (May 1, 2012 01:10 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (123, 1, null, null,.31, to_date (May 1, 2012 01:15 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (123, 1, null, null,.23, to_date (May 1, 2012 01:20 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (123, 1, null, null,.69, to_date (May 1, 2012 01:25 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (123, 1, null, null,.85, to_date (May 1, 2012 01:30 ',' mm/dd/yyyy HH24:MI:SS));))

    Insert in the values of readings (123, 1, null, null,.51, to_date (May 1, 2012 02:10 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (123, 1, null, null,.61, to_date (May 1, 2012 02:15 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (123, 1, null, null,.41, to_date (May 1, 2012 02:20 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (123, 1, 1, null,.31, to_date (May 1, 2012 02:25 ',' dd/mm/yyyy HH24:MI:SS));))

    Insert in the values of readings (123, 1, null, 1,.23, to_date (May 1, 2012 03:20 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (123, 1, null, null, 2.23, to_date (May 1, 2012 03:25 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (123, 1, null, null,.23, to_date (May 1, 2012 03:30 ',' mm/dd/yyyy HH24:MI:SS));))
    Insert in the values of readings (123.2, null, null, 16.71, to_date (May 1, 2012 01:00 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (123.2, null, null, 17.81, to_date (May 1, 2012 01:15 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (123.2, null, null, 191.11, to_date (May 1, 2012 01:30 ',' mm/dd/yyyy HH24:MI:SS));))
    Insert in the values of readings (123.2, null, null, 221.11, to_date (May 1, 2012 01:45 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (123.2, null, null, 61.71, to_date (May 1, 2012 02:00 "," mm/dd/yyyy HH24:MI:SS));))

    Insert in the values of readings (123.2, null, null, 71.81, to_date (May 1, 2012 03:15 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (123.2, null, null, 911.11, to_date (May 1, 2012 03:30 ',' mm/dd/yyyy HH24:MI:SS));))

    Insert in the values of readings (123.2, null, null, 121.11, to_date (May 1, 2012 04:45 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (123.2, null, null, 61.71, to_date (May 1, 2012 05:00 "," mm/dd/yyyy HH24:MI:SS));))
    Insert in the values of readings (123.2, null, null, 72,81, to_date (May 1, 2012 05:15 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (123.2, null, null, 941.11, to_date (May 1, 2012 05:30 "," mm/dd/yyyy HH24:MI:SS));))

    Insert in the values of readings (456,2, null, null, 6.71, to_date (May 1, 2012 01:00 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (456,2, null, null, 7.81, to_date (May 1, 2012 01:15 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (456,2, null, null, 91.11, to_date (May 1, 2012 01:30 ',' mm/dd/yyyy HH24:MI:SS));))
    Insert in the values of readings (456,2, null, null, 121.11, to_date (May 1, 2012 01:45 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (456,2, null, null, 6.71, to_date (May 1, 2012 02:00 "," mm/dd/yyyy HH24:MI:SS));))
    Insert in the values of readings (456,2, null, null, 7.81, to_date (May 1, 2012 03:15 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (456,2,1, null, 91.11, to_date (May 1, 2012 03:30 ',' mm/dd/yyyy HH24:MI:SS));))

    Insert in the values of readings (456,2, null, 1, 121.11, to_date (May 1, 2012 04:45 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (456,2, null, null, 6.71, to_date (May 1, 2012 05:00 "," mm/dd/yyyy HH24:MI:SS));))
    Insert in the values of readings (456,2, null, null, 7.81, to_date (May 1, 2012 05:15 ',' dd/mm/yyyy HH24:MI:SS));))
    Insert in the values of readings (456,2, null, null, 91.11, to_date (May 1, 2012 05:30 "," mm/dd/yyyy HH24:MI:SS));))
    Insert in the values of readings (456,2, null, null, 121.11, to_date (May 1, 2012 06:45 ',' dd/mm/yyyy HH24:MI:SS));))

    commit;

    I would like to get an output like below. I have billions of records in the table of readings, and so would have good performance.
    As you can see rtype 1 5 minutes reading interval and rtype 2 is 15 minutes to the reading of time interval.
    Expected output as below.

    DEVICE_ID rtype missing_interval_date_time Qty.
    123 1 05/01/2012 00:30:00
    123 1 05/01/2012 00:35:00
    123 1 05/01/2012 00:40:00
    123 1 05/01/2012 00:45:00
    .
    .
    123 1 05/01/2012 00:55:00

    123 1 01:35 05/01/2012
    123 1 05/01/2012 01:40
    123 1 05/01/2012 01:45
    .
    .
    123 1 02:05 05/01/2012
    123 1 05/01/2012 02:30 1 - since the data on quality starts with qstartid
    123 1 05/01/2012 02:35 1
    123 1 05/01/2012 02:40 1
    123 1 05/01/2012 02:45 1
    .
    .
    123 1 05/01/2012 03:15 1 - data end with qendid quality
    123 1 05/01/2012 03:35
    123 1 05/01/2012 03:40
    .
    .
    123 1 23:55 05/01/2012
    123 2 05/01/2012 00:00:00-(same for the device_id even another rtype with 15 min interval)
    123 2 05/01/2012 00:15:00
    123 2 05/01/2012 00:30:00
    123 2 05/01/2012 00:45:00

    123 2 05/01/2012 02:15
    123 2 05/01/2012 02:30
    123 2 05/01/2012 02:45
    123 2 05/01/2012-03:00

    123 2 05/01/2012 03:45
    123 2 05/01/2012-04:00
    123 2 05/01/2012-04:15
    123 2 05/01/2012-04:30

    123 2 05/01/2012 05:45
    123 2 05/01/2012 05:50
    .
    .
    123 2 23:30 05/01/2012
    123 2 05/01/2012 23:45
    456...



    Basically, there are two rtypes, there are 5 minute interval and has another 15 minutes.

    so, as you can see that missing intervals between below two bed 1st may 2012 00:25:00 ' and may 1, 2012 01:00 ' should be as below since its data every 5 minutes based on rtype = 1

    123 1 05/01/2012 00:30:00
    123 1 05/01/2012 00:35:00
    123 1 05/01/2012 00:40:00
    123 1 05/01/2012 00:45:00
    .
    .
    123 1 05/01/2012 00:55:00

    Similarly the readings between two bed 1st may 2012 02:00:00 ' and may 1, 2012 03:15 ' should be as below since its data every 15 minutes based on rtype = 2

    123 2 05/01/2012 02:15
    123 2 05/01/2012 02:30
    123 2 05/01/2012 02:45
    123 2 05/01/2012-03:00

    And

    When qstartid 1, means it lacks data range because there are certain quality. So, we just need to point out that these interval data missing due to the quality indicator observed. He has qstartid = 1 means quality reading beginning qfinishid = 1, end of quality data.

    The next part is ends and housing starts of flag of quality. Which means that if there is some other readings such as device failure may cause missing intervals, then in this case, its valid missing intervals and we need to mark that data, so we can not consider as a real lack of range, but its missing due to the interruption intervals, so we need to identify this piece of interval missing due to the quality indicator.
    When qstartid 1, means it lacks data range because there are certain quality. So, we just need to point out that these interval data missing due to the quality indicator observed. He has qstartid = 1 means quality reading beginning qfinishid = 1, end of quality data.



    Insert in the values of readings (123, 1, 1, null,.31, to_date (May 1, 2012 02:25 ',' dd/mm/yyyy HH24:MI:SS));))

    Insert in the values of readings (123, 1, null, 1,.23, to_date (May 1, 2012 03:20 ',' dd/mm/yyyy HH24:MI:SS));))

    Lack of exit of the interval should be

    123 1 05/01/2012 02:30 1 - since the data on quality starts with qstartid
    123 1 05/01/2012 02:35 1
    123 1 05/01/2012 02:40 1
    123 1 05/01/2012 02:45 1
    .
    .
    123 1 05/01/2012 03:15 1 - data end with qfinishid quality



    ------------------------------------------------------
    I tried several combinations, including after one, but impossible to go
    Select missing all_dates.d
    de)
    Select to_date ('20120501 00:00:00 ', 'YYYYMMDD HH24:MI:SS')-1 + rownum of double d
    connect by level < = 15) all_dates, reading x
    where all_Dates.d = x.readtimestamp (+)
    and x.readtimestamp is null
    order of all_dates.d
    /

    ---------------------------------------------------------

    >
    If possible, can you please give me a plsql sample code to do this?
    >
    Of course - see below.

    Hear about. For the collection of data like yours there is used when the collection process is serial in nature. For these cases, it may be useful data collection "missing time" at the time where the actual data are inserted in the database rather than trying to recreate both later. Which may or may not be possible in your situation.

    For an example using FORALL with INSERT see example 12-3 issuance of INSERT queries in a loop in the Doc of the PL/SQL language
    http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/tuning.htm#BABEDFJE

    Here is a simple example of using BULK COLLECT with a LIMIT clause. You conducts experiments with the code using the SCOTT schema to get an idea of how this works. Normally, you would use a variable or a parameter for the value LIMIT.

    EXTRACTION is a BULK of COLLECTING all the data in "v". It will get either all data, or none if there is none.

    The construction of the LOOP would be used when you have a LIMIT clause while Oracle would be 'loop' return to
    Download the following Recordset. Run this example in the SCOTT schema and you will see how the LIMIT clause.
    I have 14 records in my table EMP.

    DECLARE
      CURSOR c1 IS (SELECT * FROM emp);
      TYPE typ_tbl IS TABLE OF c1%rowtype;
      v typ_tbl;
    BEGIN
      OPEN c1;
      LOOP                                                 --Loop added
        FETCH c1 BULK COLLECT INTO v LIMIT 3; -- process 3 records at a time
            -- process the first 3 max records
           DBMS_OUTPUT.PUT_LINE('Processing ' || v.COUNT || ' records.');
            FOR i IN v.first..v.last LOOP
                DBMS_OUTPUT.PUT_LINE(v(i).empno);
            END LOOP;
        EXIT WHEN c1%NOTFOUND;
      END LOOP;
      DBMS_OUTPUT.PUT_LINE('All done');
    END;
    

    In the loop, you would do any processing of the nested table, you want to make
    and could use a FORALL do one INSERT into another table.

Maybe you are looking for