I need to create a table that has each increment of 15 minutes between the current date and time in the past.

I can around the current datetime object to the the last quarter of an hour and show all dates for last year, but I'm looking for all the 15 minutes for each day of '1 October 13' to the current date.

Here's what I have so far:

SELECT

trunc (sysdate, 'mi')-

NUMTODSINTERVAL (mod (to_char (sysdate, 'mi'), 15), 'minute') as Quarter_Hr,

(sysdate-365 (LEVEL-1)) AS DATES

FROM DUAL connect by level < = (sysdate-(sysdate-365))

Any help would be appreciated. I use that as a dimension table to evaluate performance on a base quarter of an hour.

ALTER session set nls_date_format = "hh24:mi:ss dd/mm/yyyy '.

/

Select date "'2013-10-1 + (level - 1) / 96 dt"
of the double
connect by level<= trunc((sysdate="" -="" date="" '2013-10-1')="" *="" 96)="" +="">
/

DT
-------------------
01/10/2013 00:00:00
01/10/2013 00:15:00
01/10/2013 00:30:00
01/10/2013 00:45:00
01/10/2013-01:00
01/10/2013-01:15
01/10/2013-01:30
01/10/2013-01:45
01/10/2013-02:00
01/10/2013-02:15
01/10/2013-02:30

DT
-------------------
01/10/2013-02:45
01/10/2013-03:00
01/10/2013-03:15
01/10/2013-03:30
01/10/2013 03:45
01/10/2013 04:00
01/10/2013-04:15
01/10/2013-04:30
01/10/2013-04:45
01/10/2013-05:00
01/10/2013-05:15

.

.

.

DT
-------------------
06/08/2014-11:45
06/08/2014-12:00
06/08/2014-12:15
06/08/2014-12:30
06/08/2014-12:45

29716 selected lines.

SQL >

SY.

Tags: Database

Similar Questions

  • You need to add a "Current Date and Time" stamp on the sheet of taxation using the SmartStream.

    I would use a 'factor of propagation', but don't know how to program to give the current date and time.

    Found the solution. Added this code:

    '#JobName '.

    the Element.Indd of propagation that is assigned to the tax.

    I had also added a current date; under Variables of Type/text I added

    day/month/year, and

    I've added the counter of the leaf on the counter of fields/counters/datasheet.

    Works very well. Registered as a master to automatically assign these three elements

    for each sheet of any tax without having to add varable columns to the

    the database.

    Hope it will be useful to others.

  • Need to create a trigger that generates multiple rows in another table

    {size: 12} Hello

    I use Oracle9i (9.2.0.4.0)

    My problem is:
    I need to create a trigger that create different in the other table lines when someone will introduce a new line in the first table.

    For this, I use the table 4:

    1. first one where you want the trigger.
    2. a second just to take information.
    3. a third to make a trip meter.
    4. the fourth is the table where I want to create new lines. {size}

    Here is a summary of these 4 tables:

    {color: blue} Table 1
    STOJOU
    Number ¿Nulo? Tipo
    STOFCY_0 NOT NULL VARCHAR2 (9)
    ITMREF_0 NOT NULL VARCHAR2 (60)
    LOT_0 NOT NULL VARCHAR2 (45)
    VCRTYP_0 NOT NULL NUMBER (3)
    VCRNUM_0 NOT NULL VARCHAR2 (45)
    VCRLIN_0 NOT NULL NUMBER (10)
    QTYSTU_0 NOT NULL NUMBER
    NUMVCR_0 NOT NULL VARCHAR2 (45) {color}

    {color: blue} Table 2
    ITMMASTER
    Number ¿Nulo? Tipo
    ITMREF_0 NOT NULL VARCHAR2 (60)
    ZCOEFI_0 NOT NULL NUMBER {color}

    {color: blue} Table 3
    ZCTUART;
    Number ¿Nulo? Tipo
    CTUART_0 NOT NULL NUMBER (10)
    CTUDATE_0 NON NULL DATE {color}

    {color: blue} Table 4
    ZUART
    Number ¿Nulo? Tipo
    ZUARTDM_0 NOT NULL VARCHAR2 (102)
    STOFCY_0 NOT NULL VARCHAR2 (9)
    STOCOU_0 NOT NULL NUMBER
    ITMREF_0 NOT NULL VARCHAR2 (60)
    LOT_0 NOT NULL VARCHAR2 (45)
    CREDAT_0 NOT NULL DATE
    QTYSTU_0 NOT NULL NUMBER
    STA_0 NOT NULL VARCHAR2 (3)
    VCRLIN_0 NOT NULL NUMBER (10)
    VCRNUM_0 NOT NULL VARCHAR2 (45)
    VCRTYP_0 NOT NULL NUMBER (3) {color}

    I do this trigger:
    CREATE OR REPLACE TRIGGER CREA_REGISTROS_TRAZA
    AFTER INSERT ON STOJOU
    FOR EACH ROW
    DECLARE
       n INTEGER;
       ct NUMBER;
       fecha_actual VARCHAR2;
       fecha_old VARCHAR2;
       codigo_dm VARCHAR2;
    BEGIN
       fecha_actual := TO_CHAR(SYSDATE, 'DD/MM/YYYY');
       -- SELECT TO_CHAR(sysdate, 'DD/MM/YYYY') INTO fecha_actual FROM DUAL;
       SELECT TRUNC((STOJOU.QTYSTU_0/ITMMASTER.ZCOEFI_0),0) INTO n FROM STOJOU INNER JOIN ITMMASTER ON STOJOU.ITMREF = ITMMASTER.ITMREF;
          FOR i IN 1 .. n
       LOOP
          SELECT CTUART_0,TO_CHAR(CTUDAT_0, 'DD/MM/YYYY') INTO ct,fecha_old FROM ZCTUART;
          IF fecha_old <> fecha_actual THEN
            ct := 0;
          END IF;
          ct := ct + 1;
          INSERT INTO ZCTUART
            (CTUART_0,CTUDAT_0)
          VALUES
            (ct,SYSDATE);
          codigo_dm := SUBSTR('000000000000000000000',1,20 - LENGHT(NEW.ITMREF_0)) || NEW.ITMREF_0 || SUBSTR('0000000000',1,10 - LENGHT(NEW.LOT)) || NEW.LOT || SUBSTR('0000',1,4 - LENGHT(ct)) || ct;
          INSERT INTO ZUART
            (ZUARTDM_0,ITMREF_0,CREDAT_0,STA_0,QTYSTU_0,LOT_0,STOFCY_0,VCRLIN_0,VCRNUM_0,VCRTYP_0)
          VALUES
            (codigo_dm,NEW.ITMREF_0,SYSDATE,0,NEW.QTYSTU_0,NEW.LOT_0,NEW.STOFCY_0,NEW.VCRLIN_0,NEW.VCRNUM_0,NEW.VCRTYP_0);
       END LOOP;
    END CREA_REGISTROS_TRAZA;
    /
    {size: 12} And the error message I get States is just:
    "The trigger was created with compilation errors."
    Thanks for the help {size}

    You must prefix your NEW "columns" with a colon, as in: NEW.

  • Querying the oracle table that has a column with the name of "FILE".

    Hi all

    I need to have an oracle table that has the column with the name "FILE".

    I can query all columns with the query "select * from table".

    But I'm not able to use the query "select the table file.

    This table is converted from ms access to oracle and I need to have this column with the name "FILE".

    Any suggestions?

    Thank you

    Abdellaoui

    Hello

    FILE is a keyword from Oracle, so it's not a good name,

    Use FILEDATE, or DATE_FILED, or something else that is not in V$ RESERVED_WORDS. KEYWORD as the name column.

    If you need to use the FILE, then you must use quotation marks.

  • How can I create a watermark that has the text and graphics?

    Lightroom does not seem to offer a text watermark OR graphic, can create a watermark that has both?

    Basically, you need create a chart with text it contains.

  • Help to extract data Clob to a column in a table that has several lines in a table

    Help to extract data Clob to a column in a table that has several lines in a table

    It works for only the first line

    CREATE or REPLACE DIRECTORY XMLDIR AS ' / orabackups';

    Grant read, write on DIRECTORY XMLDIR to the public;

    () dbms_xslprocessor.clob2file

    beef in CLOB,

    XMLDIR IN VARCHAR2,

    "testfile2.txt" IN VARCHAR2);

    DECLARE

    buf CLOB.

    BEGIN

    SELECT H15_DOC

    IN buf

    OF H15TEST. H15_STAGE

    where rownum = 1;

    dbms_xslprocessor.clob2file (buf, 'XMLDIR', 'testfile2.txt');

    END;

    /

    -This error code

    CREATE or REPLACE DIRECTORY XMLDIR AS ' / orabackups';

    Grant read, write on DIRECTORY XMLDIR to the public;

    () dbms_xslprocessor.clob2file

    XData in CLOB,

    XMLDIR IN VARCHAR2,

    "testfile2.txt" IN VARCHAR2,

    CSID in NUMBER: = 0);

    DECLARE

    CURSOR xmlmycur IS SELECT H15_DOC

    OF H15TEST. H15_STAGE

    where rownum = 102140;

    l_clob CLOB.

    XData CLOB.

    BEGIN

    DBMS_LOB.CREATETEMPORARY (l_clob, true);

    DBMS_LOB.CREATETEMPORARY (xdata, true);

    OPEN xmlmycur.

    LOOP

    SEEK xmlmycur INTO xdata;

    dbms_xslprocessor.clob2file (xdata, 'XMLDIR', 'testfile2.txt');

    EXIT WHEN xmlmycur % notfound;

    END LOOP;

    CLOSE Xmlmycur;

    END;

    /

    ORA-21560: 3 argument is null, invalid or out of range

    ORA-06512: at "SYS." DBMS_LOB", line 991

    ORA-06512: at "XDB". DBMS_XSLPROCESSOR', line 324

    ORA-06512: at line 15 level

    FYI, it seems that the file being created will exceed 5 gig

    Yes, it is a known issue with DBMS_XSLPROCESSOR.clob2file with big files.

    Here is a slightly modified version of the code that I posted earlier, fixing WRITE_ERROR except:

    DECLARE

    v_file utl_file.file_type;

    -write a unique to clob

    procedure write_clob (p_content in clob) is

    v_buffer varchar2 (32767).

    V_POSITION pls_integer: = 1;

    v_amount pls_integer: = 32767;

    Start

    loop

    Start

    DBMS_LOB. Read (p_content, v_amount, v_position, v_buffer);

    exception

    When no_data_found then exit;

    end;

    UTL_FILE.put_raw (v_file, utl_raw.cast_to_raw (v_buffer), true);

    V_POSITION: = v_position + v_amount;

    end loop;

    end;

    BEGIN

    -Open the file

    v_file: = utl_file.fopen ('TEST_DIR', 'testfile2.txt', 'wb', 32767);

    -loops through the lines

    for r in)

    Select h15_doc

    of h15test.h15_stage

    )

    loop

    write_clob (r.h15_doc);

    end loop;

    UTL_FILE.fclose (v_file);

    END;

    /

  • The use of sequence and generate the number in a table that has data

    Hello

    There is a custom table that has a column Rowid (NULL).
    This table already has 10 k with rowid as null lines, now the user asks me to enter a unique number for the Rowid.
    I created a sequence, but don't know how to use this sequence and generate numbers for the Rowid.

    Could you suggest.

    Thank you.

    "rowid" is an oracle reserved word and should be avoided. Perhaps "Rowid" between quotes or something.

    Here's how to "fill" a column by a sequence:

    SQL> create table t (id number, value varchar2(100));
    
    Table created.
    
    SQL> insert into t (value) select object_name from all_objects where rownum <= 10000;
    
    10000 rows created.
    
    SQL> create sequence idgen_sequence;
    
    Sequence created.
    
    SQL> update t set id = idgen_sequence.nextval;
    
    10000 rows updated.
    

    Given that the sequence was used all the 'id's will be unique.

  • I need to create a table of contents in iPages but I want only one word for the title, not the line of holes. Or, how can I change the contents of the table? Thank you!

    I need to create a table of contents in iPages but I want only one word for the title, not the line of holes. Or, how can I change the contents of the table? Thank you!

    Yes, you can have a one word title, by assigning a paragraph style title to this one word. No, you cannot change the text in a Table of contents, but you can change paragraph style font attributes (line) and add for example, a head of points between the types of OCD paragraph and page numbers. No part of the table of contents will not provide hyperlinks in exported PDF documents.

    When you look up in the menu bar, you can see the word iPages, or simply Pages. There is no product of iPages.

  • What is the name of the table that has the name of the custom in the Oracle database Section?

    What is the name of the table that has the name of the custom in the Oracle database Section?

    Thank you

    Nefertari

    The names of the custom Sections are stored in commonExtendedAttributeML, the extended attribute table.

  • By creating a form that has several text boxes to a single character on the same line, how can I get the cursor to go in the next text box automatically after inserting a character?

    By creating a form that has several text boxes to a single character on the same line, how can I get the cursor to go in the next text box automatically after inserting a character?

    Create a text field and use the option 'comb n characters.

  • Copying recordings to another column in the table that has NULL values

    Hello

    I am trying to copy the email address from one table to another table that has the NULL value in the column email
    SQL> select
      2     count(*)
      3  from
      4     users a, cvProperties b, cvDetails c
      5  where
      6     a.user_id=b.user_id and b.cv_id=c.cv_id and a.userType like '1'
      7  and
      8     c.email is NULL
      9  /
    
      COUNT(*)
    ----------
             7
    
    SQL> insert into cvDetails(email)
      2  VALUES(
      3  (select
      4     a.login
      5  from
      6     users a, cvProperties b, cvDetails c
      7  where
      8          a.user_id=b.user_id and b.cv_id=c.cv_id and a.userType like '1'
      9  and
     10          c.email is NULL)
     11  );
    (select
     *
    ERROR at line 3:
    ORA-01427: single-row subquery returns more than one row
    Please notify

    Thank you in anticipation

    Check to see if that helps...

    MERGE INTO cvdetails c
         USING (SELECT a.login, b.cv_id
                  FROM users a, cvproperties b
                 WHERE a.user_id = b.user_id AND a.usertype = 1) xx
            ON (xx.cv_id = c.cv_id)
    WHEN MATCHED
    THEN
       UPDATE SET email = xx.login
               WHERE c.email IS NULL;
    

    Vanessa B.

  • help needed by subtracting a line that contains (date and time) + business days

    Hi all
    Could someone please help me reg this
    I have a single column including (date and time) for example, 28/03/2009-12:40
    I want to calculate the days of work for an employee
    the table is as follows
    Opn_in_out OPN_MOV_DATE name

    2009-03-28 12:40 abc 2
    2009-03-29 08:25 1 abc
    2009-03-28 16:15 2 def
    2009-03-29 08:45 1 def

    '2' means is out for work
    '1' means employee came after work
    ABC and def are the different employees, how to calculate the days each has worked, I tried date_diff but it does not work
    Please help me
    concerning
    userconfused

    As explained above...
    you need to replace...

    (select case when tot>3 then 1 end as days ) 
    

    with a little (even in brackets are not required)

    case when tot>3 then 1 end as days 
    

    Ravi Kumar

  • I have a computer that has Windows 2000 Pro, I can use the disk to upgrade to Windows XP with this OS?

    I have a computer that has Windows 2000 Pro, I can use the disk to upgrade to Windows XP with this OS? It's

    an old computer, but it works very well.  I want to switch to XP using the Windows upgrade disc. But

    in the specifications it lists only 98, 98 Second and ME as an operating system you can upgrade.  Thanks John

    Provided the specifications of the computer meets Windows XP you can switch from 2000 to XP. If it does not meet the specifications, you may upgrade the computer first or get a new one which is more cheaper today.

    In addition, please note that you can only switch to Windows XP Professional. If it is a home edition you have then it will not work. You can refer to the link below on how to update your copy of Windows 2000 to Windows XP Pro.

    http://support.Microsoft.com/kb/978307

  • date and time do not automatically change it remains the same as the last time that I turned off the computer, it has recently started to happen

    The date and time do not automatically change when I turn on the computer, it has recently been like that.  I have change the settings manually and everything is ok until I turn on the computer the next day.

    The date and time do not automatically change when I turn on the computer, it has recently been like that.  I have change the settings manually and everything is ok until I turn on the computer the next day.

    Change the battery on the motherboard.
    http://www.computerhope.com/issues/ch000239.htm

  • I created an admin password, but when I restart my computer, I can connect without password and I need to create a new admin password each time

    I created an admin password, but when I restart my computer, I can connect without password and I need to create a new admin password each time

    Open a high command prompt, and then type these commands:

    NET user "user %%nom" | more

    (to check when you change changed your password)

    NET user "user %%nom" 123456

    (to change your password to 123456)

    Now, restart Windows and check if the problem persists.

Maybe you are looking for