Gaps in interval data
Hi Gurus,
I am using oracle 11.2.0.1 Enterprise Edition. And I tried writing query different ways but unable to get going. Your help is greatly appreciated.
The Query should give output as I explained below.
This query is identify the gaps in interval reads.
Here is my create script.
create table rtype (
rid number,
rdesc varchar2(30));
insert into rtype values (1, '5-deviceinterval');
insert into rtype values (2, '15-deviceinterval');
create table readings (
device_id number,
rid number,
qstartid number,
qfinishid number,
readvalue number,
readtimestamp date);
insert into readings values (123, 1, null,null, .951, to_date('05/01/2012 00:00:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .51, to_date('05/01/2012 00:05:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .51, to_date('05/01/2012 00:10:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .51, to_date('05/01/2012 00:15:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .51, to_date('05/01/2012 00:20:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .51, to_date('05/01/2012 01:00:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .61, to_date('05/01/2012 01:05:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .41, to_date('05/01/2012 01:10:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .31, to_date('05/01/2012 01:15:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .23, to_date('05/01/2012 01:20:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .69, to_date('05/01/2012 01:25:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .85, to_date('05/01/2012 01:30:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .51, to_date('05/01/2012 02:10:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .61, to_date('05/01/2012 02:15:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, null,null, .41, to_date('05/01/2012 02:20:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1, 1, null, .31, to_date('05/01/2012 02:25:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1,null,1, .23, to_date('05/01/2012 03:20:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1,null,null, 2.23, to_date('05/01/2012 03:25:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1,null,null, .23, to_date('05/01/2012 03:30:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 16.71, to_date('05/01/2012 01:00:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 17.81, to_date('05/01/2012 01:15:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 191.11, to_date('05/01/2012 01:30:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 221.11, to_date('05/01/2012 01:45:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 61.71, to_date('05/01/2012 02:00:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 71.81, to_date('05/01/2012 03:15:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 911.11, to_date('05/01/2012 03:30:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 121.11, to_date('05/01/2012 04:45:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 61.71, to_date('05/01/2012 05:00:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 72.81, to_date('05/01/2012 05:15:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123,2,null,null, 941.11, to_date('05/01/2012 05:30:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,null, 6.71, to_date('05/01/2012 01:00:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,null, 7.81, to_date('05/01/2012 01:15:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,null, 91.11, to_date('05/01/2012 01:30:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,null, 121.11, to_date('05/01/2012 01:45:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,null, 6.71, to_date('05/01/2012 02:00:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,null, 7.81, to_date('05/01/2012 03:15:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,1,null, 91.11, to_date('05/01/2012 03:30:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,1, 121.11, to_date('05/01/2012 04:45:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,null, 6.71, to_date('05/01/2012 05:00:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,null, 7.81, to_date('05/01/2012 05:15:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,null, 91.11, to_date('05/01/2012 05:30:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (456,2,null,null, 121.11, to_date('05/01/2012 06:45:00','mm/dd/yyyy HH24:MI:SS'));
I would like to get output as below. I have billions of records in readings table, so would like to have good performance.
As you can see rtype 1 is 5 minutes reading interval and rtype 2 is 15 minutes reading time interval.
Expected output
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 05/01/2012 01:35:00
123 1 05/01/2012 01:40:00
123 1 05/01/2012 01:45:00
123 1 05/01/2012 02:05:00
123 1 05/01/2012 02:30:00 1 - Since quality data start with qstartid
123 1 05/01/2012 02:35:00 1
123 1 05/01/2012 02:40:00 1
123 1 05/01/2012 02:45:00 1
123 1 05/01/2012 03:15:00 1 - end quality data with qendid
123 1 05/01/2012 03:35:00
123 1 05/01/2012 03:40:00
123 1 05/01/2012 23:55:00
123 2 05/01/2012 00:00:00 --(Similarly for same device_id 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:00
123 2 05/01/2012 02:30:00
123 2 05/01/2012 02:45:00
123 2 05/01/2012 03:00:00
123 2 05/01/2012 03:45:00
123 2 05/01/2012 04:00:00
123 2 05/01/2012 04:15:00
123 2 05/01/2012 04:30:00
123 2 05/01/2012 05:45:00
123 2 05/01/2012 05:50:00
123 2 05/01/2012 23:30:00
123 2 05/01/2012 23:45:00
456 ....
Edited by: MDK999 on Oct 17, 2012 5:30 PM
Hello
Yes, I have edited other information also such as -
"This query is identify the gaps in interval reads" and I explained that the way output should report the missing intervals. Actually expected output explains the data how it should look like. This output is created based on sample data I have provided.
basically there are two rtypes, one has 5 minutes interval and other one has 15 minutes.
so as you can see that missing intervals between below two reads '05/01/2012 00:25:00' and '05/01/2012 01:00:00' should be as below since its 5 minutes interval data 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 readings between two reads '05/01/2012 02:00:00' and '05/01/2012 03:15:00' should be as below since its 15 minutes interval data based on rtype = 2
123 2 05/01/2012 02:15:00
123 2 05/01/2012 02:30:00
123 2 05/01/2012 02:45:00
123 2 05/01/2012 03:00:00
And
when qstartid 1 , means there is missing interval data because there is some quality. So we just need to report that this missing interval data due to quality flag observed. there is qstartid=1 means quality reading start qfinishid=1, end of quality data.
insert into readings values (123, 1, 1, null, .31, to_date('05/01/2012 02:25:00','mm/dd/yyyy HH24:MI:SS'));
insert into readings values (123, 1,null,1, .23, to_date('05/01/2012 03:20:00','mm/dd/yyyy HH24:MI:SS'));
So missing interval output should be
123 1 05/01/2012 02:30:00 1 - Since quality data start with qstartid
123 1 05/01/2012 02:35:00 1
123 1 05/01/2012 02:40:00 1
123 1 05/01/2012 02:45:00 1
123 1 05/01/2012 03:15:00 1 - end quality data with qfinishid
Thanks
Similar Messages
-
Exporting Interval Data in batch INTDEXP
Hi,
I'm new to Oracle Utilities, and we've got a request from an internal customer to export interval data for a predefined list of recorders.
I've found that you can do this with the INTDEXP.exe tool. And I've managed to get some output.
But in the Data Manager help, several parameters are listed to manipulate the outcome.
Can anyone provide some more information on following paramters? Since the help only says you can create a config file for it, but it doesn't explain how:
-ctrl control file
-m format file
-lcfg logging configuration file
Where can I find the syntax that I need to create these files? Example files are most welcome!
Thanks in advance!
Regards,
RoelPlease check sample code here
have enhanced the 0MAT_PLANT_ATTR datasource from MBEW and RESB tables. While i scheduling the master data for full load it is taking to every long time.
****************************START OF CODE***************
tables: MBEW, RESB, MARA.
data: l_s_ZEXTSTR_PLT like BIW_MARC_S.
data: l_t_ZEXTSTR_PLT like table of BIW_MARC_S.
data: l_t_mara like table of mara with header line.
data: l_t_mbew like table of mbew with header line.
data: l_t_resb like table of resb with header line.
l_t_ZEXTSTR_PLT[] = i_t_data[].
select matnr
werks
verpr
peinh
lbkum
salk3
from mbew
into corresponfing fields of table l_t_mbew
for all entries in l_t_ZEXTSTR_PLT
where matnr = l_t_ZEXTSTR_PLT-matnr
and bwkey = l_t_ZEXTSTR_PLT-werks.
sort l_t_mbew by matnr bwkey.
select matnr
meins
from mara
into corresponfing fields of table l_t_mara
for all entries in l_t_ZEXTSTR_PLT
where matnr = l_t_ZEXTSTR_PLT-matnr.
sort l_t_mara by matnr.
select werks
waers
from resb
into corresponfing fields of table l_t_resb
for all entries in l_t_ZEXTSTR_PLT
where werks = l_t_ZEXTSTR_PLT-werks.
sort l_t_resb by werks.
loop at l_t_ZEXTSTR_PLT into l_s_ZEXTSTR_PLT.
l_tabix = sy-tabix.
read table l_t_mbew with key
matnr = l_s_ZEXTSTR_PLT-matnr
bwkey = l_s_ZEXTSTR_PLT-werks
BINARY SEARCH.
if sy-subrc = 0.
l_s_ZEXTSTR_PLT-verpr = l_t_mbew-verpr.
l_s_ZEXTSTR_PLT-peinh = l_t_mbew-peinh.
l_s_ZEXTSTR_PLT-lbkum = l_t_mbew-lbkum.
l_s_ZEXTSTR_PLT-salk3 = l_t_mbew-salk3.
endif.
read table l_t_mara with key
matnr = l_s_ZEXTSTR_PLT-matnr
BINARY SEARCH.
if sy-subrc = 0.
l_s_ZEXTSTR_PLT-meins = l_t_mara-meins.
endif.
read table l_t_resb with key
werks = l_s_ZEXTSTR_PLT-werks
BINARY SEARCH.
if sy-subrc = 0.
l_s_ZEXTSTR_PLT-zzwaers = l_t_resb-zzwaers.
endif.
modify l_t_ZEXTSTR_PLT from l_s_ZEXTSTR_PLT index l_tabix.
endloop.
refresh i_t_data.
i_t_data[] = l_t_ZEXTSTR_PLT[]. -
Interval data types ODBC driver support
I have tried both Oracle 10.02.00.03 and Oracle 11.01.00.06 ODBC drivers to get resultset description for interval data type columns with no success. Example,
CREATE TABLE TEST_INTERVAL
"COL1" INTERVAL YEAR (2) TO MONTH,
"COL2" INTERVAL YEAR (1) TO MONTH,
"COL3" INTERVAL DAY (2) TO SECOND (6),
"COL4" INTERVAL DAY (0) TO SECOND (0)
and in an ODBC client like CompareData or WinSQL attempt to retrieve the resultset description for 'select * from test_interval' using SQLColAttribute and SQL_DESC_CONCISE_TYPE, SQL_DESC_LABEL, SQL_DESC_AUTO_UNIQUE_VALUE, etc and get all errors.
Seems Oracle ODBC drivers do not know how to handle interval data types eventhough ODBC api provides the necessary framework for handling interval data [http://msdn.microsoft.com/en-us/library/ms716506(VS.85).aspx]
(For example, Informix ODBC driver, Mimer SQL ODBC driver provide complete support for their DBMS interval data types via ODBC)Perhaps you ask in the wrong forum? It doesn't seem to be a 'Database - General' question:
ODBC
Werner -
Can Anyone tell me how to find out the gap between two dates. Specifically Without counting Saturday and Sunday.
corlettk wrote:
<intercession>
Has anyone written a DateMath class?... it would be handy... the amount (and ugliness) of the code required to do elementary date mathematics with the raw Calendar is appaling.<recess>
Isn't Java 7 supposed to cure all this headache?
</recess> -
Find gap between two dates from table
Hello All,
I want to find gap between two dates ,if there is no gap between two dates then it should return min(eff_dt) and max(end_dt) value
suppose below data in my item table
item_id eff_dt end_dt
10 20-jun-2012 25-jun-2012
10 26-jun-2012 28-jun-2012 There is no gap between two rows for item 10 then it should return rows like
item_id eff_dt end_dt
10 20-jun-2012 28-jun-2012
item_id eff_dt end_dt
12 20-jun-2012 25-jun-2012
12 27-jun-2012 28-jun-2012 There is gap between two rows for item 12 then it should return like
item_id eff_dt end_dt
12 20-jun-2012 25-jun-2012
12 27-jun-2012 28-jun-2012
I hv tried using below query but it giv null value for last row
SELECT item_id, eff_dt, end_dt, end_dt + 1 AS newd,
LEAD (eff_dt) OVER (PARTITION BY ctry_code, co_code, item_id ORDER BY ctry_code,
co_code, item_id) AS LEAD,
(CASE
WHEN (end_dt + 1) =
LEAD (eff_dt) OVER (PARTITION BY ctry_code, co_code, item_id ORDER BY ctry_code,
co_code, item_id, eff_dt)
THEN '1'
ELSE '2'
END
) AS new_num
FROM item
WHERE TRIM (item_id) = '802'
ORDER BY ctry_code, co_code, item_id, eff_dtI m using oracle 10g.
please any help is appreciate.
Thanks.Use start of group method:
with sample_table as (
select 10 item_id,date '2012-6-20' start_dt,date '2012-6-25' end_dt from dual union all
select 10,date '2012-6-26',date '2012-6-26' from dual
select item_id,
min(start_dt) start_dt,
max(end_dt) end_dt
from (
select item_id,
start_dt,
end_dt,
sum(start_of_group) over(partition by item_id order by start_dt) grp
from (
select item_id,
start_dt,
end_dt,
case lag(end_dt) over(partition by item_id order by start_dt)
when start_dt - 1 then 0
else 1
end start_of_group
from sample_table
group by item_id,
grp
order by item_id,
grp
ITEM_ID START_DT END_DT
10 20-JUN-12 26-JUN-12
SQL> SY. -
Initializing INTERVAL data type
I have a situation in which I want to keep track of the amount of time it takes to perform a task that it comprised of a number of steps. I need to get the amount of time to perform each task by subtracting the stop and start times; then these need to be added to a running total to track the total time to perform the task. My PL/SQL code looks something like this:DECLARE
start TIMESTAMP;
stop TIMESTAMP;
task_time INTERVAL DAY TO SECOND;
total_time INTERVAL DAY TO SECOND;
BEGIN
total_time := <an initial value (0)>; -- How is this done?
FOR i IN 1 .. <some upper limit> LOOP
start := <some date and time>;
stop := <some other date and time later than start>;
task_time := stop - start; -- Subtracting TIMESTAMPs results in an INTERVAL data type
total_time := total_time + task_time; -- Adding two INTERVALS results in an INTERVAL data type
END LOOP;
END;My question, as noted in the code is how do you initialize an INTERVAL data type?
I have tried "total_time := 0" but I get a compile error because the types are not compatible. I have also tried setting it to "TO_DATE('00:00','hh24:mi')" but this also results in a type compatibility issue.
Should I be approaching the problem in another way completely?Nothing could be simpler:
declare
v_interval interval day to second;
begin
v_interval := interval '0' hour;
dbms_output.put_line(v_interval);
end; -
제품 : SQL*PLUS
작성날짜 : 2004-05-28
ORACLE9I - INTERVAL DATA TYPE
=============================
PURPOSE
Oracle9i 부터 추가된 INTERVAL data type에 대해 알아보자.
Explanation
INTERVAL data type은 datetime 기간을 저장하는 type이다.
아래의 syntax를 확인해 보자.
INTERVAL <interval qualifier>
Examples:
INTERVAL YEAR TO MONTH
INTERVAL DAY (6) TO SECOND (5)
INTERVAL type에는 다음의 두 가지 종류가 있다.
1. Year-month interval (INTERVAL YEAR TO MONTH)
연과 월의 기간을 저장하는 type으로 각각 연수,월수를 나타낸다.
Keyword Meaning
YEAR Years
MONTH Months
2. Day-time interval (INTERVAL DAY TO SECOND)
각 DAY, HOUR, MINUTE, and SECOND 를 저장하는 type으로 일반적으로
사용하는 date format으로 저장한다.
Keyword Meaning
DAY Days
HOUR Hours
MINUTE Minutes
SECOND Seconds and possibly fractions of a second
이 type은 생성할 때 각 day와 second의 자리수를 지정해야 한다.
default 로는 day(2), second (6) 으로 지정된다.
Year-month interval type은 다른 type과 함께 비교할 때 다른 data의 각 year, month
와 비교되며, day-time interval의 경우에도 다른 type의 day-time 값과만 비교된다.
3. INTERVAL item의 valid value.
Keyword Valid values
YEAR Unconstrained except by <interval leading field precision>
MONTH 0..11
DAY Unconstrained except by <interval leading field precision>
HOUR 0..23
MINUTE 0..59
SECOND 0..59.9(N) where "9(N)" indicates the number of digits
specified by <interval fractional seconds
precision> in the <interval qualifier>
4. Interval data type의 sample value.
Data type Literal Example
INTERVAL YEAR TO MONTH INTERVAL '01-02' YEAR TO MONTH
INTERVAL DAY(3) TO SECOND(2) INTERVAL '100 10:20:42.22' DAY(3) TO SECOND(2)
Examples
1. sample table생성후 data입력
create table demo_interval ( a INTERVAL YEAR(2) TO MONTH,
b INTERVAL DAY(2) TO SECOND(6));
insert into demo_interval values(INTERVAL'12-01' YEAR TO MONTH,
INTERVAL'50 10:20:20.123' DAY(2) TO SECOND(3));
commit;
SQL> select * from demo_interval;
A B
+12-01 +50 10:20:20.123000
2. 다른 date type의 data와 이 interval type의 data를 더하거나 계산하여 나타낼 수 있다.
SQL> select sysdate, sysdate+a, sysdate+b from demo_interval;
SYSDATE SYSDATE+A SYSDATE+B
2004-05-12 00:11:46 2016-06-12 00:11:46 2004-07-01 10:32:06
Reference Documents
<Note:149118.1>Nothing could be simpler:
declare
v_interval interval day to second;
begin
v_interval := interval '0' hour;
dbms_output.put_line(v_interval);
end; -
Min/ Max interval data storage
OK, so what I am trying to do is scan 2 voltages at 3K, temporarily write that data to a file or buffer, read the min and max values, and log those to a file once per minute. I'm at the point where I can scan and display the data, but really don't know where to go next. Any thoughts or ideas would be much appreciated. Thanks
Attachments:
NI-6343-2CH VDC min-max.vi 45 KBYou only need a single loop. You can use the "elapsed time" express VI to signal when time has elapsed, and simply use a case structure to append the averages to the data before writing (in the false case just wire the current data across). You should also open the file before the loop, append inside the loop, and only close the file once the loop completes. You can use the min&max ptbypt VI to keep track of the min and max for each interval or just keep track of it using a shift register.
LabVIEW Champion . Do more with less code and in less time . -
Finding Gaps in the date field.
Hello,
I have a date field in a table which has date values incremented every month for 5 years.
I have to find out the any gaps between the months that is the entry for some month is not there.
eg. the data is as follows, i have entries for dec month of 2000, jan of 2001, feb of 2001, march of 2001, April month is missing, there is entry for may of 2001 and it follows.
I want to display that April month is missing.
How would i do in pl/sql.
Help would be appreciated
thanks.
return_dt
12/31/2000 12:00:00.000 AM
12/31/2000 12:00:00.000 AM
12/31/2000 12:00:00.000 AM
12/31/2000 12:00:00.000 AM
1/31/2001 12:00:00.000 AM
1/31/2001 12:00:00.000 AM
1/31/2001 12:00:00.000 AM
1/31/2001 12:00:00.000 AM
2/28/2001 12:00:00.000 AM
2/28/2001 12:00:00.000 AM
2/28/2001 12:00:00.000 AM
2/28/2001 12:00:00.000 AM
3/31/2001 12:00:00.000 AM
3/31/2001 12:00:00.000 AM
3/31/2001 12:00:00.000 AM
3/31/2001 12:00:00.000 AM
5/31/2001 12:00:00.000 AM
5/31/2001 12:00:00.000 AM
5/31/2001 12:00:00.000 AM
5/31/2001 12:00:00.000 AM
6/30/2001 12:00:00.000 AM
return_dt
6/30/2001 12:00:00.000 AM
6/30/2001 12:00:00.000 AM
6/30/2001 12:00:00.000 AM
7/31/2001 12:00:00.000 AM
7/31/2001 12:00:00.000 AM
7/31/2001 12:00:00.000 AM
7/31/2001 12:00:00.000 AM
8/31/2001 12:00:00.000 AM
8/31/2001 12:00:00.000 AM
8/31/2001 12:00:00.000 AM
8/31/2001 12:00:00.000 AMSELECT A.MISSING_MONTHS
FROM (select DISTINCT TRUNC(B.DATES,'MON') MISSING_MONTHS
from(select ADD_MONTHS(sysdate, (MONS_BACK*-1) ) + rownum dates
from dual,
(SELECT MONTHS_BETWEEN (TRUNC(SYSDATE,'MON'),MIN(TRUNC(RETURN_DT, 'MON')) ) MONS_BACK
FROM DATE_TAB)
connect by rownum < 1000) B ) A
WHERE A.MISSING_MONTHS <=(SELECT MAX(TRUNC(RETURN_DT, 'MON')) FROM DATE_TAB)
AND A.MISSING_MONTHS NOT IN (SELECT TRUNC(RETURN_DT, 'MON') FROM DATE_TAB) -
Interval date get the to value
Hi experts,
I have a manual input interval variable for the object 0calday and I would like to "isolate" the "to value" because in the column section, I have a column for "period amount" and another one to "last date of the period amount".
I've tried with a formula with 2 replacement path variables in it , but without success.
Is it possible to do that with a formula or a variable in QD or, should I go with a user exit variable ??
Thanks.Hi,
as I understand the issue, you want to create a text variable for
column header.
I think you should cretae a text variable and use customer exit.
sample
WHEN 'YOUR_TEXT_VARIABLE'.
IF I_STEP = 2.
LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
WHERE VNAM = 'VAR_FOR_0CALDAY'.
CLEAR L_S_RANGE.
L_S_RANGE-LOW = LOC_VAR_RANGE-HIGH.
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'EQ'.
APPEND L_S_RANGE TO E_T_RANGE.
EXIT.
ENDLOOP.
ENDIF.
'YOUR_TEXT_VARIABL represents name of created text variable, 'VAR_FOR_CALDAY' name of variable for 0CALDAY.
Hope this helps
Joe -
Filling the gap with previous data and newdate...
input data
GLOBAL_NAME PRODUCT_MODEL TRX_TYPE POS_DATE QUANTITY
ABC MAW3147NC POS 3/17/2008 111
ABC MAW3147NC POS 4/14/2008 100
ABC MAW3147NC POS 5/26/2008 200
ABC MAW3147NC SHIPMENT 3/17/2008 222
ABC MAW3147NC SHIPMENT 4/7/2008 40
ABC MAW3147NC SHIPMENT 4/14/2008 80
ABC MAW3147NC SHIPMENT 4/21/2008 160
ABC MAW3147NC SHIPMENT 4/28/2008 162
ABC MAW3147NC SHIPMENT 5/19/2008 182
ABC MAW3147NC SHIPMENT 5/26/2008 262output
GLOBAL_NAME PRODUCT_MODEL TRX_TYPE POS_DATE QUANTITY
ABC MAW3147NC POS 3/17/2008 111
ABC MAW3147NC POS 3/24/2008 111 --> previous record values but pos_date should be next monday
ABC MAW3147NC POS 3/31/2008 111--> previous record values but pos_date should be next monday
ABC MAW3147NC POS 4/7/2008 111--> previous record values but pos_date should be next monday
ABC MAW3147NC POS 4/14/2008 100
ABC MAW3147NC POS 4/21/2008 100--> previous record values but pos_date should be next monday
ABC MAW3147NC POS 4/28/2008 100--> previous record values but pos_date should be next monday
ABC MAW3147NC POS 5/05/2008 200
ABC MAW3147NC SHIPMENT 3/17/2008 222
ABC MAW3147NC SHIPMENT 3/24/2008 222--> previous record values but pos_date should be next monday
ABC MAW3147NC SHIPMENT 3/31/2008 222--> previous record values but pos_date should be next monday
ABC MAW3147NC SHIPMENT 4/7/2008 40
ABC MAW3147NC SHIPMENT 4/14/2008 80
ABC MAW3147NC SHIPMENT 4/21/2008 160
ABC MAW3147NC SHIPMENT 4/28/2008 162
ABC MAW3147NC SHIPMENT 5/05/2008 162--> previous record values but pos_date should be next monday
ABC MAW3147NC SHIPMENT 5/12/2008 162--> previous record values but pos_date should be next monday
ABC MAW3147NC SHIPMENT 5/19/2008 182
ABC MAW3147NC SHIPMENT 5/26/2008 262all posdates are monday dates?
any ideas?In other words that monday is missing from the original data set, so you are missing mondays and want to recover them by copying the data down from the last existing monday.
Here's some code that you can modify that will do just that. SEQ_WITH_GAPS and X correspond to the original data with gaps, while SEQ_WITH_NO_GAPS and COPY is the data you are looking for. You just need to define the source of your filler data to provide all the dates of interest and join it to your POS_DATE column and replicate the copy column for each of the columns of your original data that you want to copy.
WITH mydata AS
( SELECT level x, sum(level) over (order by level) seq_with_gaps
FROM dual CONNECT BY level < 5
, filler AS
( SELECT level seq_with_no_gaps FROM dual CONNECT BY level <= 12
SELECT seq_with_gaps
, x
, seq_with_no_gaps
, last_value( x ignore nulls ) over( order by f.seq_with_no_gaps ) copy
FROM mydata d
RIGHT JOIN filler f
ON d.seq_with_gaps=f.seq_with_no_gaps
SEQ_WITH_GAPS X SEQ_WITH_NO_GAPS COPY
1 1 1 1
2 1
3 2 3 2
4 2
5 2
6 3 6 3
7 3
8 3
9 3
10 4 10 4
11 4
12 4
12 rows selected -
Mixing SourceDataLine with Clip with initial gap and interval
Hi!
I have one long (wav or aif) file. I want to "watermark" it with small clip file (*.wav). How could I mix them to get long file watermarked with clip with initial gap and specific interval (I mean in output file the clip is played after 10s, then after 20s interval clip is played again, next 20s and again etc)?
Could this be done? Could You give me simple hints?zielonyplot wrote:
Hi!
I already did it. I had to modify MixingAudioInputStream, but it was't so simple as it sounds... ;-)Oh, I'm sure it was a pain and a half ;-) But certainly less work than mixing the streams at the sample-level yourself ;-)
But thanks!Glad you got it working.... -
Does Oracle (12c) manage the interval data (6NF) ?
Hi!
I would like to know if Oracle (12c) supports the data type interval.
In other words, does it manage the Normal Form Six (6NF) with temporal data?
Thank you in advance for your answer.
N.B.:
And if yes, please precise since which version does Oracle support the intervals. Thank you.Sb92075, You're a genius !
But you did not read exactly my question here: the additional question is Since which version are the intervals supported?
(A copy paste from an unfindable documentation would be appreciated.)
That was my proper question on DbForums, before having connexion problem for a special Oracle Support - but not Premium - and precisions asking of Oracle...
during all this time, these answers were made.
That was a question which I had for monthes ago, so this is why I already asked in several forums.
Let me post here my response to them for the case where you can answer:
-Something that I don't really understand, reading the docs:
INTERVAL YEAR [(year_precision)] TO MONTH, what does it mean, exactly ? I guess that "to month" means the granularity of time. But for me, if I say "to", is as in "from... to", so it doesn't make any sense in this interval example.
In his book, Temporal data and the relational model, Date recommend to write as:
[begin:end], so if I translate:
[2013-11-18 21H10M00s : 2013-11-18 21H15M00s] (the exact writing is from me).
According that.. the granularity of time is implicit in the dates precision!
Did I make a mistake ?"
Thank you -
Interval dates in Table V_T706B2
Hello,
During customizing of messages types (warning or error) when exepenses exceed limit, i wants to know how the fields "Start date" and "End date" works.
Those date range can take into account a different limit expenses from one period to another?
Example: If in 2010 we change the limit, can we continue to manage the old limit for expense statements for 2009?
Thank you in advanceResolved
-
Binary Data file displays large gaps in the data. Will use of a queue help?
Ultimately I'd like to save 15 channels of data (1 channel at 20kHz, 6 at 2kHz, and 8 at 100 Hz) while displaying the waveforms on the front panel.
Currently, I am saving in binary format without any decimation of the data (therefore saving all channels at 20kHz). Decimating the waveforms can be done without affecting the display, and will definitely reduce the final size of the data files, but will slow down the processing. I've seen examples of using queues to limit data loss, but do not know if it will be advantageous in this case.
Any comments and suggestions will be greatly appreciated.
Attachments:
Cont_Acq_to_File_(binary)_NM-no_dec.llb 546 KB
Cont_Acq_to_File_(binary)_NM-dec 531 KBSo let's say that I'm going to use queues. Is it better to have an acquisition loop and then a 'everything else' loop (decimation and data recording) or is it possible (and better?) to use 3 loops? I'm assuming with each queue segment, the time spent reading and writing the data will increase, and therefore slow down my vi even more than it is doing now.
And another question: in the case of the tabbed case structure, my charts are only active when the corresponding tab is selected, correct? If I would then put the recording of data in each case, then the data would be recorded for only those signals which are displayed on that tab. I'm not completely confident that I understand how that structure works, or how I can make the data recording more efficient.
Thank you for all of your help, and for the compliment.
Maybe you are looking for
-
2 questions for 1 part of my app
Hello there, I have a report and form in my APEX application, and right now the form adds entries into the report, which aggregates the data into 1 row if the name is the same. (terrible explanation but if you take a look at my app then maybe you wil
-
How can I set the number of day that FF remembers a visited site?
Using FF 8, a visited site link turns color to show it has been visited. I would like to have that color go back to normal after 14 days. In other words, I want FF to remember that I visited a site by turning the link a different color for only 14 da
-
How can I get a boot-disk for a Compaq P2500 laptop Windows XP Home Edition?
I'm already in another forum with a eerily similar question, but that's for the HP Media Center Pavilion m8000e desktop system (Windows Vista Home Premium) I was just given; I've ordered a new hard drive for that. I assume the directions to create a
-
Objective Settings and Appraisal Eval. Path Selection
Goodday, I'm getting this particular error in MSS service 'Objective Settings and Appraisal'. One of my drop down selection is not returning any employees even after maintainng teh proper relationship. I have 3 selection for this service - 'All emplo
-
Hi, I recently received a letter from BT offering 'BT Broadband Extra' with an offer code to quote. The letter also says 'If you preferorder online and you'll also get a £25 Sainsburys Gift Card'. I can't see anywhere that I can order this product th