Incremental time based on column date
Hello
My database is 11g. I want to generate incremental time according to the date column column. Help, please:
for example:
SQL> select date from emp order by 1; DATE ---------- 02/12/2012 02/12/2012 02/12/2012 02/12/2012 24/12/2012 24/12/2012 24/12/2012
I want to add values to a time column that contains the values to a number 6 (hhmmss) as follows:
SQL> select date, time from emp; DATE TIME ---------------------------------------- 02/12/2012 000000 02/12/2012 000001 02/12/2012 000002 02/12/2012 000003 24/12/2012 000000 24/12/2012 000001 24/12/2012 000002 . . . 24/12/2012 000059 24/12/2012 000100
The time should reset itself as the date changes.
Why you store DATE and TIME in the form of two different columns? So is TIME column is VARCHAR2 data type?
You can do it
merge into e emp
a_l'_aide_de)
Select empid
, to_char (excerpt (numtodsinterval time (NWR, 'the other')), "fm09")
|| TO_CHAR (extract (minute of numtodsinterval (NWR, 'the other')), "fm09")
|| TO_CHAR (extract ((deuxieme from numtodsinterval (NWR, 'the other')), "fm09") time_value
de)
Select empid
row_number() over (partition by order by empid date_column) rno
WCP
)
) t
on)
e.EmpID = t.empid
)
When matched then
update set e.time_column = t.time_value;
Tags: Database
Similar Questions
-
Unable to store the component "time" in the column date Oracle's ADF
Hi friends,
I have a table with the date column. I'm trying to set the current date with the time in the column of the table. Java.sql.Date refers to the field of the VO. When I try to turn it using the setLastUpdatedDate() it not be saved. The time is get truncated and the time is saved is 16-mar-2015 00:00:00. How can I keep the component "hour" as well in the column with the date data type. FYI the component "hour" is saved when I do the sql uisng the insert.
JDev version is 11.1.1.7.0
Thank you
Hello
java.sql.Date
is the DATE of SQL which means it stores years, months and days whilehour, minute, second and millisecond are ignored. Alsosql.Date
is not related to time zones.java.sql.Timestamp
corresponds to the SQL TIMESTAMP, which is the exact nanosecond (Note thatutil.Date
only supported milliseconds!) with customizable precision.try to use the timestamp if you want exact
-
How to return all the TIME in a column date time?
Hello.
My column 'DATETIMESTAMP' usually returns November 15, 2011 10:32:15 '.
If I TRUNC (DATETIMESTAMP) I can get just the date - what is optimal.
But what I want here is just the TIME element.
SUBSTR does not seem to return anything after the date element.
I've searched high and low.
Any thoughts people?
See you soon.
Ady.To_char(DateTimeStamp,'HH24:mi:SS')
-
Solved: Problem of time in a column DATE
When I execute SELECT TO_CHAR(ISSUE_DATE,'hh24:mi') OF BOOKS, for some documents, it returns time as 12:05, 13:50 and for the number of records it returns 00:00
ISSUE_DATE is a DATE column and I used to define ISSUE_DATE as SYSDATE, issuing books.
How could I get the weather for all records?Looks like someone is using trunc (sysdate) to insert data into your table (ie. to remove the element of time, set for 00:00)
That, or somebody is very busy at midnight!
-
Can I bulk accumulate based on a date variable?
I want to use some sort of big collect to speed up this query inside a PL/SQL block (we-10 g). I've seen examples of using a FORALL statement, but I do not know how to account for the variable v_cal_date. My idea is to be able to run the script to update a portion of the table "tbl_status_jjs", based on a range of dates that I provided. tbl_status_jjs contains a list of dates per minute of the day for a whole year and a column empty to fill.
I have to use something like
... but that doesn't seem right, and I can't find a note of a bulk collect based on a date. How bulk harvest on a variable date? Can I use the date/time of a subset of records from the final table sort of cursor?FORALL v_cal_date in '01-apr-2009 00:00:00'..'01-jun-2009 00:00:00' -- somehow need to increment by minute!?
Thank you
Jason
-- loop through one day by minute of the day and update counts into table v_cal_date Date :=TO_DATE('01-apr-2005 00:00:00','dd-mm-yyyy hh24:mi:ss'); intX := 1; WHILE intX <= 1440 LOOP UPDATE tbl_status_jjs SET (cal_date, my_count) = (SELECT v_cal_date, NVL(SUM(CASE WHEN v_cal_date >= E.START_DT AND v_cal_date < E.END_DT THEN 1 END),0) AS my_count FROM tbl_data_jjs E ) WHERE cal_date = v_cal_date; v_cal_date := v_cal_date + (1/1440); intX := intX + 1; COMMIT; END LOOP;
Hi, Jason.
I know not if FUSION is faster, in itself, that update or INSERT, but a MERGE statement that changes 3 million lines will probably be faster that instructions UPDATE 3 million each query a table line 2.5 million and then change one line.
-
How to plan the report filtered by dynamic date based on the date, the Agent is running
Hello
I have a question about account using OBIEE agent.
If I run an agent today to deliver A report, can I me A report based on the date of last Monday or any dynamic dates?
For example, say is today, December 18, 2013, and my agent is run according to how I put the calendar. Now the content of the delivery report one being delivered. Now A report has a date column, normally this column is filtered by the current date. But if it comes through the agents to different users, the data should be the previous Monday, so in this case, 9 December 2013. When this agent is run once again, declared December 27, 2013, then the report must be filtered by December 16, 2013, which is the previous Monday 27 dec.
Something like this is possible in OBIEE 11 G?
Thanks in advance.
Yala,
Not in a straightforward way
(1) let the report through Agent with filter current Date
(2) after he ran for the first time you can see IBOT name/last execution time (LAST_RUNTIME_TS) in S_NQ_JOB
Create a variable reference 'last_run_agent' to aid in sql to get max (LAST_RUNTIME_TS)
SELECT max (LAST_RUNTIME_TS) from s_nq_job, whose name = "AGENT_NAME;
Change analysis with current date filter report and amend accordingly the condition of filter to filter on repository variable, newly created
Thank you
-
I would check my story for the time of day, as well as for the date. This is a feature that is common? How can I configure to work indicating the time, as well as, the date? Thank you.
If it's a history item to the current day, then you will see the time and not the date.
You can show more columns in the library (history > show history)
-
Find (weekly) missing date ranges based on the Date of submission
Nice day:
I have a table that contains the data with a date of presentation of the report column. If the requirements are that each employee must submit at least 1 weekly report beginning January 1, 2015, how can I find the weekly reports missing, based on the date of submission of reports.
The ideas that I had:
- Left join by partition by date (range between)
- Create a date dimension view?
Of course, I'm not sure how to approach this dilemma without creating a query of Monster. Sometimes the simplest queries mistake me...
Thank you, Aqua
Here are the DDL for the table with the information from the presentation report (example):
--------------------------------------------------------
-The DOF for Table DTS_FORM_SAMPLE
--------------------------------------------------------
CREATE TABLE 'DTS_FORM_SAMPLE '.
(NUMBER OF 'ID',
VARCHAR2 (20) "CLOCK_NUMBER."
NUMBER OF 'EMP_ID,'
NUMBER OF "REPORT_TYPE."
DATE OF THE "SUB_DATE.
) ;
/
INSERTION of REM in DTS_FORM_SAMPLE
TOGETHER TO DEFINE
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (2896, 'XX2444', 12810,1, to_date('02-APR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (2897, 'XX2444', 12810,1, to_date('09-APR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (2898, 'XX2444', 12810,1, to_date('16-APR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (2899, 'XX2444', 12810,1, to_date('23-APR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (2900, 'XX2444', 12810,1, to_date('30-APR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (2901, 'XX2444', 12810,1, to_date('05-MAR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (2902, 'XX2444', 12810,1, to_date('12-MAR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (2903, 'XX2444', 12810,1, to_date('19-MAR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (2904, 'XX2444', 12810,1, to_date('26-MAR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (2920, 'XX2444', 12810,1, to_date('19-FEB-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (2921, 'XX2444', 12810,1, to_date('22-JAN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (2922, 'XX2444', 12810,1, to_date('05-FEB-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (2923, 'XX2444', 12810,1, to_date('26-FEB-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (2924, 'XX2444', 12810,1, to_date('29-JAN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (2925, 'XX2444', 12810,1, to_date('12-FEB-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (2965, 'XX2444', 12810,1, to_date('30-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6970, 'XX2444', 12810,1, to_date('18-JUN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6971, 'XX2444', 12810,1, to_date('25-JUN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6972, 'XX2444', 12810,1, to_date('04-JUN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6973, 'XX2444', 12810,1, to_date('11-JUN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6978, 'XX2444', 12810,1, to_date('14-MAY-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6979, 'XX2444', 12810,1, to_date('21-MAY-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6980, 'XX2444', 12810,1, to_date('28-MAY-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6981, 'XX2444', 12810,1, to_date('07-MAY-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6948, 'XX2444', 12810,1, to_date('06-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6957, 'XX2444', 12810,1, to_date('09-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6958, 'XX2444', 12810,1, to_date('16-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6959, 'XX2444', 12810,1, to_date('23-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6960, 'XX2444', 12810,1, to_date('02-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8938, 'XX2444', 12810,1, to_date('14-MAY-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8939, 'XX2444', 12810,1, to_date('21-MAY-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8940, 'XX2444', 12810,1, to_date('28-MAY-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8941, 'XX2444', 12810,1, to_date('07-MAY-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8942, 'XX2444', 12810,1, to_date('14-MAY-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8943, 'XX2444', 12810,1, to_date('21-MAY-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8977, 'XX2444', 12810,1, to_date('04-JUN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8978, 'XX2444', 12810,1, to_date('11-JUN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8979, 'XX2444', 12810,1, to_date('11-JUN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8980, 'XX2444', 12810,1, to_date('18-JUN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8981, 'XX2444', 12810,1, to_date('18-JUN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8982, 'XX2444', 12810,1, to_date('25-JUN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8983, 'XX2444', 12810,1, to_date('25-JUN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8984, 'XX2444', 12810,1, to_date('02-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8985, 'XX2444', 12810,1, to_date('02-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8953, 'XX2444', 12810,1, to_date('19-FEB-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (9824, 'XX2444', 12810,1, to_date('20-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (9825, 'XX2444', 12810,1, to_date('20-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (9826, 'XX2444', 12810,1, to_date('20-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8972, 'XX2444', 12810,1, to_date('30-APR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8973, 'XX2444', 12810,1, to_date('30-APR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8974, 'XX2444', 12810,1, to_date('07-MAY-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8975, 'XX2444', 12810,1, to_date('28-MAY-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8951, 'XX2444', 12810,1, to_date('12-FEB-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8952, 'XX2444', 12810,1, to_date('19-FEB-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8954, 'XX2444', 12810,1, to_date('26-FEB-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8955, 'XX2444', 12810,1, to_date('26-FEB-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8956, 'XX2444', 12810,1, to_date('05-MAR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8957, 'XX2444', 12810,1, to_date('05-MAR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8958, 'XX2444', 12810,1, to_date('12-MAR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8959, 'XX2444', 12810,1, to_date('12-MAR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8960, 'XX2444', 12810,1, to_date('19-MAR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8961, 'XX2444', 12810,1, to_date('19-MAR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8962, 'XX2444', 12810,1, to_date('26-MAR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8963, 'XX2444', 12810,1, to_date('26-MAR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8964, 'XX2444', 12810,1, to_date('02-APR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8965, 'XX2444', 12810,1, to_date('02-APR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8966, 'XX2444', 12810,1, to_date('09-APR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8967, 'XX2444', 12810,1, to_date('09-APR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8968, 'XX2444', 12810,1, to_date('16-APR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8969, 'XX2444', 12810,1, to_date('16-APR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8970, 'XX2444', 12810,1, to_date('23-APR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8971, 'XX2444', 12810,1, to_date('23-APR-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8976, 'XX2444', 12810,1, to_date('04-JUN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8986, 'XX2444', 12810,1, to_date('09-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8987, 'XX2444', 12810,1, to_date('09-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (9041, 'XX2444', 12810,1, to_date('16-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (9042, 'XX2444', 12810,1, to_date('16-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (9043, 'XX2444', 12810,1, to_date('23-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (9044, 'XX2444', 12810,1, to_date('23-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (9045, 'XX2444', 12810,1, to_date('30-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (9046, 'XX2444', 12810,1, to_date('30-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (9047, 'XX2444', 12810,1, to_date('06-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (9048, 'XX2444', 12810,1, to_date('06-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8944, 'XX2444', 12810,1, to_date('22-JAN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8945, 'XX2444', 12810,1, to_date('22-JAN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8946, 'XX2444', 12810,1, to_date('29-JAN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8947, 'XX2444', 12810,1, to_date('29-JAN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8948, 'XX2444', 12810,1, to_date('05-FEB-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8949, 'XX2444', 12810,1, to_date('05-FEB-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (8950, 'XX2444', 12810,1, to_date('12-FEB-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (9527, 'XX2444', 12810,1, to_date('13-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (9528, 'XX2444', 12810,1, to_date('13-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (9529, 'XX2444', 12810,1, to_date('13-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6739, 'YY7223', 11093,8, to_date('15-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6740, 'YY7223', 11093,8, to_date('21-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6741, 'YY7223', 11093,8, to_date('22-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6742, 'YY7223', 11093,8, to_date('25-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6743, 'YY7223', 11093,8, to_date('26-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6744, 'YY7223', 11093,8, to_date('27-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6745, 'YY7223', 11093,1, to_date('04-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6746, 'YY7223', 11093,1, to_date('11-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6747, 'YY7223', 11093,1, to_date('18-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6748, 'YY7223', 11093,1, to_date('25-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6749, 'YY7223', 11093,11, to_date('01-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6750, 'YY7223', 11093,11, to_date('15-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (6751, 'YY7223', 11093,10, to_date('01-JUL-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (11017, 'YY7223', 11093,1, to_date('07-MAY-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (11018, 'YY7223', 11093,1, to_date('14-MAY-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (11019, 'YY7223', 11093,1, to_date('21-MAY-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (11020, 'YY7223', 11093,1, to_date('28-MAY-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (11021, 'YY7223', 11093,1, to_date('04-JUN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (11022, 'YY7223', 11093,1, to_date('11-JUN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (11023, 'YY7223', 11093,1, to_date('18-JUN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (11024, 'YY7223', 11093,1, to_date('25-JUN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (11025, 'YY7223', 11093,10, to_date('31-MAY-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (11026, 'YY7223', 11093,10, to_date('30-JUN-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13115, 'YY7223', 11093,1, to_date('13-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13201, 'YY7223', 11093,1, to_date('20-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13287, 'YY7223', 11093,1, to_date('27-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13373, 'YY7223', 11093,10, to_date('08-SEP-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13489, 'YY7223', 11093,8, to_date('01-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13490, 'YY7223', 11093,8, to_date('02-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13491, 'YY7223', 11093,8, to_date('03-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13492, 'YY7223', 11093,8, to_date('04-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13493, 'YY7223', 11093,8, to_date('05-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13494, 'YY7223', 11093,8, to_date('06-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13495, 'YY7223', 11093,8, to_date('07-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13496, 'YY7223', 11093,8, to_date('08-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13497, 'YY7223', 11093,8, to_date('09-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13498, 'YY7223', 11093,8, to_date('10-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13499, 'YY7223', 11093,8, to_date('11-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13500, 'YY7223', 11093,8, to_date('12-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13501, 'YY7223', 11093,8, to_date('13-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13502, 'YY7223', 11093,8, to_date('14-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13503, 'YY7223', 11093,8, to_date('15-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13504, 'YY7223', 11093,8, to_date('16-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13505, 'YY7223', 11093,8, to_date('17-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13506, 'YY7223', 11093,8, to_date('18-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13507, 'YY7223', 11093,8, to_date('19-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13508, 'YY7223', 11093,8, to_date('20-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13509, 'YY7223', 11093,8, to_date('21-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13510, 'YY7223', 11093,8, to_date('22-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13511, 'YY7223', 11093,8, to_date('23-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13512, 'YY7223', 11093,8, to_date('24-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13513, 'YY7223', 11093,8, to_date('25-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13514, 'YY7223', 11093,8, to_date('26-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13515, 'YY7223', 11093,8, to_date('27-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13516, 'YY7223', 11093,8, to_date('28-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13517, 'YY7223', 11093,8, to_date('29-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13518, 'YY7223', 11093,8, to_date('30-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13519, 'YY7223', 11093,8, to_date('31-AUG-15','DD-MON-RR'));
Insert into DTS_FORM_SAMPLE (ID, CLOCK_NUMBER, EMP_ID, REPORT_TYPE, SUB_DATE) values (13030, 'YY7223', 11093,1, to_date('06-AUG-15','DD-MON-RR'));
--------------------------------------------------------
-Table DTS_FORM_SAMPLE constraints
--------------------------------------------------------
CHANGE ALTER TABLE 'DTS_FORM_SAMPLE' ('ID' ENABLE NOT NULL);
/
Or more simple:
Select emp_id, w.wk, to_char (wk, 'ww') x
from (select trunc (date ' 2015-01-01' + 7 * (level - 1), 'ww') wk)
of the double
connect by level<=>=>
) o
left outer join
s dts_form_sample
by (emp_id) partition
We trunc (s.sub_date, 'ww') = w.wk
where sub_date is null
order to emp_id,
x
/
EMP_ID WK X
---------- --------- --
11093 1ST JANUARY 15 01
11093 8 JANUARY 15 02
11093 15 JANUARY 15 03
11093 22 JANUARY 15 04
11093 29 JANUARY 15 05
11093 5 FEBRUARY 15 06
11093 12 FEBRUARY 15 07
11093 19 FEBRUARY 15 08
11093 26 FEBRUARY 15 09
11093 5 MARCH 15 10
11093 12 MARCH 15 11EMP_ID WK X
---------- --------- --
11093 19 MARCH 15 12
11093 26 MARCH 15 13
11093 2 APRIL 15 14
11093 9 APRIL 15 15
11093 16 APRIL 15 16
11093 23 APRIL 15 17
11093 30 APRIL 15 18
11093 37 15 - SEP - 10
17-SEVEN 11093.-15 38
24-SEVEN 11093.-15 39
11093 1 OCTOBER 15 40EMP_ID WK X
---------- --------- --
11093 8 OCTOBER 15 41
11093 15 OCTOBER 15 42
11093 22 OCTOBER 15 43
11093 29 OCTOBER 15 44
11093 5 NOVEMBER 15 45
11093 12 NOVEMBER 15 46
11093 19 NOVEMBER 15 47
11093 26 NOVEMBER 15 48
11093 3 DECEMBER 15 49
11093 10 DECEMBER 15 50
11093 17 DECEMBER 15 51EMP_ID WK X
---------- --------- --
11093 24 DECEMBER 15 52
11093 31 DECEMBER 15 53
12810 1ST JANUARY 15 01
12810 8 JANUARY 15 02
12810 15 JANUARY 15 03
12810 27 AUGUST 15 35
12810 15 - SEP - 03 36
12810 37 15 - SEP - 10
17-SEVEN 12810.-15 38
24-SEVEN 12810.-15 39
12810 1 OCTOBER 15 40EMP_ID WK X
---------- --------- --
12810 8 OCTOBER 15 41
12810 15 OCTOBER 15 42
12810 22 OCTOBER 15 43
12810 29 OCTOBER 15 44
12810 5 NOVEMBER 15 45
12810 12 NOVEMBER 15 46
12810 19 NOVEMBER 15 47
12810 26 NOVEMBER 15 48
12810 3 DECEMBER 15 49
12810 10 DECEMBER 15 50
12810 17 DECEMBER 15 51EMP_ID WK X
---------- --------- --
12810 24 DECEMBER 15 52
12810 31 DECEMBER 15 5357 selected lines.
SQL >
However OP question must answer is start of week date.
SY.
-
Confusion of length of column data type
Hi all
To learn about my column data type and length, I have run the following query. However, when I confirm it with the table_name desc command, I see that the lengths of data do not correspond. You have an idea?
> > select column_name | » '|| DATA_TYPE | » ('|| ( data_length|') ' col_info all_tab_columns where table_name = 'CUSTTABLE' and column_name = 'ACCOUNTNUM;
> > ACCOUNTNUM NVARCHAR2 (24)
> > desc CUSTTABLE.
> > ACCOUNTNUM 1 N NVARCHAR2 (12)
Concerning
Charlie
NightWing wrote:
By the way I couln t understand what were you thinking when you explain to no.
I missed you NVARCHAR2 column and thought it was VARCHAR2. When you declare the semantics of VARCHAR2 column length is specified explicitly or implicitly. Explicitly suffixing length with BYTE or CHAR and implicitly when you specify the length of the right itself. Then length is based on the value NLS_LENGTH_SEMANTICS session. So let's assume you generate table create statement (and it seems that you is, based on column_name |) » '|| DATA_TYPE | » ('|| ( data_length|') ' ). Then it does not matter if use use data_length or char_col_decl_length. It will be regadless semantics implied length of what you use. Therefore, when you run create table instructions column length will be interpreted as bytes if current NLS_LENGTH_SEMANTICS byte value. But same length is interpreted as the characters if current NLS_LENGTH_SEMANTICS a char value. As you can see, in order to generate create table statement we use explicit semantic length column, otherwise create table statement can produce lengths of different column in the source table.
SY.
-
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#BABEDFJEHere 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. -
Addition of days for the column date of OBIEE
Hi gurus,
I have a date column, date alert and based on this column, I need to create another column to date, due date. The formula will be like,
Due date alert = date + 30 days. I found a function, TimeStampAdd when you change the column formula but not sure how to use it. Pls help me to implement this.
Thanks in advance.TIMESTAMPADD(SQL_TSI_DAY,30,alertdate)
TIMESTAMPADD (interval, intExpr, timestamp)
e.g:TIMESTAMPADD (SQL_TSI_DAY, 3, TIMESTAMP'2000-02-27 14:30:00 ')
-
Get the old value and the new value based on the date
Hello
I have a table called list created below with the rest of the insert statements.
CREATE TABLE ROSTER
(
NUMBER OF ROSTER_EMPLOYEE_DEF_ID
NUMBER OF EMPLOYE_ID
NUMBER OF DEFINITION_REGION_CODE
NUMBER OF DEFINITION_DISTRICT_CODE
NUMBER OF DEFINITION_TERRITORY_CODE
START_DATE DATE,
END_DATE DATE
)
INSERT IN THE LIST
(ROSTER_EMPLOYEE_DEF_ID, EMPLOYE_ID, DEFINITION_REGION_CODE, DEFINITION_DISTRICT_CODE, DEFINITION_TERRITORY_CODE, START_DATE, END_DATE)
VALUES
(1,299,222,333,444, 'JUNE 1, 2011', 30 JUNE 2011 "")
INSERT IN THE LIST
(ROSTER_EMPLOYEE_DEF_ID, EMPLOYE_ID, DEFINITION_REGION_CODE, DEFINITION_DISTRICT_CODE, DEFINITION_TERRITORY_CODE, START_DATE, END_DATE)
VALUES
(2,299,223,334,445, "1 JULY 2011', JULY 20, 2011" "")
INSERT IN THE LIST
(ROSTER_EMPLOYEE_DEF_ID, EMPLOYE_ID, DEFINITION_REGION_CODE, DEFINITION_DISTRICT_CODE, DEFINITION_TERRITORY_CODE, START_DATE, END_DATE)
VALUES
(3,299,224,335,446, 'AUGUST 1, 2011', AUGUST 30, 2011 "")
INSERT IN THE LIST
(ROSTER_EMPLOYEE_DEF_ID, EMPLOYE_ID, DEFINITION_REGION_CODE, DEFINITION_DISTRICT_CODE, DEFINITION_TERRITORY_CODE, START_DATE, END_DATE)
VALUES
(4,300,500,400,300, 'JUNE 1, 2011', JUNE 20, 2011 "")
INSERT IN THE LIST
(ROSTER_EMPLOYEE_DEF_ID, EMPLOYE_ID, DEFINITION_REGION_CODE, DEFINITION_DISTRICT_CODE, DEFINITION_TERRITORY_CODE, START_DATE, END_DATE)
VALUES
(5,300,501,401,301, "1 JULY 2011', JULY 20, 2011" "")
In the table above we have columns like
EMPLOYE_ID, DEFINITION_REGION_CODE, DEFINITION_DISTRICT_CODE, DEFINITION_TERRITORY_CODE, START_DATE, END_DATE
The result I'm looking for the table above is based on the employe_id OF start_date AND end_date
I need to get the OLD_DEFINITION_REGION_CODE and the NEW_DEFINITION_CODE
Similarly, OLD_DEFINITION_REGION_CODE and the NEW_DEFINITION_REGION_CODE
and OLD_DEFINITION_TERRITORY_CODE and the NEW_DEFINITION_TERRITORY_CODE
I need to get a row of data for each employee saying old value and the new value
for the employee 299 there are 3 records he puts the new record which is the latest date is to say beginning August 1, 2011 and end date of recordings old 30 August 2011
beginning July 1, 2011 and July 20, 2011
For the data in the table above, I need to get the data as below
EMPLOYE_ID OLD_DEFINITION_REGION_CODE NEW_DEFINITION_CODE OLD_DEFINITION_REGION_CODE NEW_DEFINITION_REGION_CODE START_DATE END_DATE
299 223 224 334 335 20 JULY 11 30 AUG 11
300 500 501 400 401 20 JUNE 11 JULY 20, 11
Please suggest me to get the result above, based on the data. Please let me know if my messages are not clear
Thank you
SudhirSELECT EMPLOYEE_ID, OLD_DEFINITION_REGION_CODE, NEW_DEFINITION_REGION_CODE, OLD_DEFINITION_DISTRICT_CODE, NEW_DEFINITION_DISTRICT_CODE, OLD_DEFINITION_TERRITORY_CODE, NEW_DEFINITION_TERRITORY_CODE, START_DATE, END_DATE FROM ( SELECT EMPLOYEE_ID, ROW_NUMBER() OVER(PARTITION BY EMPLOYEE_ID ORDER BY START_DATE DESC) RN, LAG(DEFINITION_REGION_CODE) OVER(PARTITION BY EMPLOYEE_ID ORDER BY START_DATE) OLD_DEFINITION_REGION_CODE, DEFINITION_REGION_CODE NEW_DEFINITION_REGION_CODE, LAG(DEFINITION_DISTRICT_CODE) OVER(PARTITION BY EMPLOYEE_ID ORDER BY START_DATE) OLD_DEFINITION_DISTRICT_CODE, DEFINITION_DISTRICT_CODE NEW_DEFINITION_DISTRICT_CODE, LAG(DEFINITION_TERRITORY_CODE) OVER(PARTITION BY EMPLOYEE_ID ORDER BY START_DATE) OLD_DEFINITION_TERRITORY_CODE, DEFINITION_TERRITORY_CODE NEW_DEFINITION_TERRITORY_CODE, LAG(END_DATE) OVER(PARTITION BY EMPLOYEE_ID ORDER BY START_DATE) START_DATE, END_DATE FROM ROSTER ) WHERE RN = 1 / EMPLOYEE_ID OLD_DEFINITION_REGION_CODE NEW_DEFINITION_REGION_CODE OLD_DEFINITION_DISTRICT_CODE NEW_DEFINITION_DISTRICT_CODE OLD_DEFINITION_TERRITORY_CODE NEW_DEFINITION_TERRITORY_CODE START_DAT END_DATE ----------- -------------------------- -------------------------- ---------------------------- ---------------------------- ----------------------------- ----------------------------- --------- --------- 299 223 224 334 335 445 446 20-JUL-11 30-AUG-11 300 500 501 400 401 300 301 20-JUN-11 20-JUL-11 SQL>
SY.
-
How to sort records based on columns in the model
I have a column by which the records are to be displayed based on the sort order of the column...
Hoe to do?
Help, pleaseUse
Change the data type based on the data type of the column. -
the time display of the data stored in a file using Labview
I saved data in an Excel file but I donnot know how to display the time recorded for each data. I would be grateful if you can help me.
Thank you very much
Sincerely,
Nehemia Elvis
Hi Matt,
where do you have problems? You have already saved time and you only write in the file?
Mike
-
compare the time while ignoring the date
I have this...
"In the beach?" is always false no matter what that right now. I guess it's because the date is included in the comparison function.
I need to compare these time and ignore the date. I can't find a way around it. The time will be the same every day and I would like for them
to be one of the constants.
Any help?
Thank you.
Try formatting the date in a string that does not include the day (only the hours and minutes).
Tim W.
Engineering applications
National Instruments
Maybe you are looking for
-
iOS reissued 9.3. What should do those who already?
Hey guys,. I own a 5s, and I'm in 9.3 since it was released (10 days ago?). Well, I had no problem with actviation or something else. Today I woke up and noticed that the 9.3 full iOS ready for installation, once again, I had. This time, its 1.4 GB t
-
Original photos on my iPad pro
My original photos are on my iPad Pro. Whenever it syncs with iCloud it replaces pictures I deleted on my Mac (El Cap) and other iOS devices. I don't want the originals on my iPad. I have hard to recognize anything apparently on the iPad. When I s
-
J8P6OUA #ABA: Google Games Shop
I installed a few applications of Google game store and cannot find them on my computer. I'm on Windows 8 and I have a HP Touchsmart 15
-
lets stop the loop parralle notification
Hello Everyone I created several loops producer/connsumer. A loop producer is business event that hold value control change of FP and then send queue consumer loop (solenoid) The other separate producer loop is to NEITHER 9213 display Temp data, I us
-
The menu selection in multi States of handling state machine
Hello world My application uses States architecture machine, I have to manage the menu selection in two different States, and 2 of them must be managed by the structure of business event. The problem is that when I use the structure of the event in t