Lag() ignore null values performance
Hello
I have looked around, but didn't find everybody talks about performance problems specifically with the use of 'IGNORE NULLS' inside of an analytic function of LAG() in a view online.
This is a cut from the version of my sql, isolated to the question under discussion.
select * from ( SELECT /* use_nl (j,gjt,jt) */ jt.id ,COALESCE (lag(jt.my_column ignore nulls /* this is the nasty critter */ ) over (order by jt.order_seq) ,0 )+1 AS start_days ,coalesce (jt.my_column ,last_value(jt.my_column ignore nulls ) over (order by jt.order_seq desc) ) AS end_days FROM a,bunch,of,tables WHERE ... ) jt where jt.id = '123456'
If I remove ignores NULL values in the offset, there is no performance problem.
Last_value() is not affected.
If I do not use a view inline then performance is very good, although it is no different to explain the plan.
select .. from ... where ... and id = '123456'
Has anyone come across something like this, or have any suggestions?
Happy to try to build a test scenario if it contributes to the discussion, but I thought I would just ask the question first.
Scott
Scott.Wesley wrote:
Hello
I have looked around, but didn't find everybody talks about performance problems specifically with the use of 'IGNORE NULLS' inside of an analytic function of LAG() in a view online.
If I remove ignores NULL values in the offset, there is no performance problem.
Last_value() is not affected.
If I do not use a view inline then performance is very good, although it is no different to explain the plan.
- Select...
- Of...
- where the...
- and id = '123456'
Scott,
He would not have anything to do with your real problem, since you say that you get different performances during the removal of the IGNORE NULLS clause, but I doubt that you get exactly the same execution plan when online display is deleted these two queries are typically semantically the same.
If you use the inline view, Oracle cannot push the filter on the ID in the view if the analytical functions partitions not by this ID, because the result will not be the same for the steps: with the online mode, the data is transformed without filtering for the evaluation of the expressions of the LAG etc, and then the filter is applied.
If you remove the inline view and filter directly, it has a quite different meaning because now the data will be filtered first and then the analytical functions apply to the filtered result set.
So the case of inline view maybe has to deal with a completely different volume (larger) identical to the variant of view data not online according to the selectivity of the filter - which could explain that the clause "IGNORE NULLS" made a significant difference in performance on this larger volume of data to deal with, but not necessarily.
Randolf
Tags: Database
Similar Questions
-
Function of lag ignoring NULL values in 10g
I have the following query that works well in 11g. I want to rewrite the query in 10g and get the same set of results. Because the offset ignoring NULL values, I used below is a new feature in 11g, someone can help me in rewriting the query below.
Prop1 - String, evar11 - String
Select prop1, evar11,.
lag (Prop1 ignores Nulls) over (partition by order of period_key of visit_page_num, visit_num, visid_low, visid_high) as prop1_lag from TABLE_A where period_key = '20131012' - DATE
order of visit_page_num
Thanks in advance,
H.
Hello
In Oracle 10, you can use LAST_VALUE... ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PREVIOUS instead of LAG.
As I don't have your table, I'll use scott.emp to illustrate:
SELECT hiredate, ename, comm
MOST LAG (comm IGNORE NULLS) (ORDER BY hiredate, ename) AS lag_comm
, LAST_VALUE (comm IGNORE NULLS) OVER (ORDER BY hiredate, ename)
ROWS BETWEEN UNBOUNDED PRECEDING
AND 1 PRECEDING
) AS last_value_comm
FROM scott.emp
ORDER BY hiredate, ename
;
The output shows that LAG and LAST_VALUE produce the same results:
HIREDATE ENAME LAG_COMM LAST_VALUE_COMM COMM
--------- ---------- ---------- ---------- ---------------
DECEMBER 17, 80 SMITH
FEBRUARY 20, 81 300 ALLEN
FEBRUARY 22, 81 WARD 500 300 300
2 APRIL 81 JONES 500 500
MAY 1, 81 BLAKE 500 500
JUNE 9, 81 CLARK 500 500
08 SEP-81 TURNER 0 500 500
28 SEP-81 MARTIN 1400 0 0
NOVEMBER 17, 81 1400 1400 KING
DECEMBER 3, 81 1400 1400 FORD
DECEMBER 3, 81 JAMES 1400 1400
JANUARY 23, 82 1400 1400 MILLER
APRIL 19, 87 SCOTT 1400 1400
MAY 23, 87 1400 1400 ADAMS
To run the Oracle 11.1 or earlier, comment out the call to the LAG.
-
JDev 11 g: problem view VO criteria ignore Null values
Hello
I don't know if it's a bug or do something wrong but here is my case:
I created an original Version of a database table.
In page view of all of VO, aaa I bind a variable named
Then I add a criteria-> display I add an element of criteria including bing my previously create variable to an attribute of VO-> I have defined validation on "necessary".
Then a race my request and made a few test/dev.
After a while, I needed to change my display criteria 'optional' with 'Ignore Null values' checked.
I changedit, run my application and the display criteria did not work... I don't add no rows returned when I went to my variable named "null".
After 1 or 2 days to research, I managed to notice that in fact, an attribute is missing in my VO object source.
I needed to add explicitly in the XML of the source of this attribute:
GenerateIsNullClauseForBindVars = 'true '.
in the desired so ViewCriteriaItem it ignores Null values.
I tried various combinations of the interface for presentation but non of them generated this attribute set to "true".
Only when I put the validation 'Optional' and ' ignore values null ' unchecked, GenerateIsNullClauseForBindVars = 'false' appears in the XML source code.
Is this a bug?
Here's my version JDev: Build JDEVADF_11.1.1.1.0_GENERIC_090615.0017.5407
JackTo report a bug, you must go through the MOS (aka Metalink). You need a support contract valid to log into MOS.
Timo
-
Group by to ignore the values null
Hi all
Oracle version 10 g 2
Consider the scenario
Table: point
Columns: Itm_id, Itm_type, appl_y_n (VALUES VALID 'Y', ' n, NULL)
I HAVE FOLLOWING ITEM TYPES.
TYP1
TYP2
TYP3
In this appl_y_n is applicable only to the item type typ1 and it can contain y, n, or null.
Types of remaining elements of this field may contain any value, including null, but I want to ignore these values.
now I need a group of clause which must ignore values null to appl_y_n only for TYP1ITM_ID ITM_TYPE APPL_Y_N 1 TYP1 NULL 2 TYP1 Y 3 TYP1 N 4 TYP2 NULL 5 TYP2 NULL 6 TYP3 NULL 7 TYP3 NULL
on top of the sample output must be
Query, that I use for this:ITM_TYPE APPL_Y_N CNT TYP1 YES 1 TYP1 NO 1 TYP2 NULL 2 TYP3 NULL 2
Select ITEM_TYPE, COUNT (ITM_ID), decode (itm_type, 'TYP1', DECODE(APPL_Y_N,'Y','Yes','N','No')) APPL_Y_N
of the order of the day
Item_type group, decode (itm_type, 'TYP1', DECODE(APPL_Y_N,'Y','Yes','N','No'))
But he's considering typ1 as null values.
Please give me a solution that ignores null values
Thanks in advance
NMHello
Check the below. It will be useful.
SQL >
SQL > WITH t AS)
2 SELECT 2 ITM_ID, 'TYP1' ITM_TYPE, 'Y' APPL_Y_N FROM dual UNION ALL
3. SELECT 3 ITM_ID, 'TYP1' ITM_TYPE, "n" APPL_Y_N FROM dual UNION ALL
4. SELECT 1 ITM_ID, 'TYP1' ITM_TYPE, APPL_Y_N NULL FROM dual UNION ALL
5. SELECT 4 ITM_ID, "TYP2' ITM_TYPE, APPL_Y_N NULL FROM dual UNION ALL
6. SELECT 5 ITM_ID, "TYP2' ITM_TYPE, APPL_Y_N NULL FROM dual UNION ALL
7. SELECT 6 ITM_ID, "TYP3' ITM_TYPE, APPL_Y_N NULL FROM dual UNION ALL
8. SELECT 7 ITM_ID, "TYP3' ITM_TYPE, APPL_Y_N double NULL)
9 SELECT itm_type,
10 DECODE (itm_type, 'TYP1', DECODE (appl_y_n, 'Y', 'Yes', "n","no")) appl_y_n,.
11 COUNT (itm_id)
12 FROM t
13 WHERE NOT (itm_type = 'TYP1' AND APPL_Y_N IS NULL)
14 group of itm_type,
15 decode (itm_type, 'TYP1', DECODE (APPL_Y_N, 'Y', 'Yes', "n","no"))
16 ORDER BY itm_type
17.ITM_TYPE APPL_Y_N COUNT (ITM_ID)
-------- -------- -------------
TYP1 NO. 1
TYP1 Yes 1
TYP2 2
TYP3 2SQL >
Rgds
Ameya -
SQL: fill the same value, until it gets another NOT NULL value
It's my main table
CREATE TABLE MAIN (EMPNO INTEGER, DATE OF EFF_DT);
INS IN HAND VALUES(1,'2013-01-01');
INS IN HAND VALUES(1,'2013-03-01');
INS IN HAND VALUES(1,'2013-05-01');
INS IN HAND VALUES(1,'2013-07-01');
INS IN HAND VALUES(1,'2013-09-01');
INS IN HAND VALUES(1,'2014-01-01');
It's my table of choiceCREATE TABLE LKP (EMPNO INTEGER, TYPE_CD VARCHAR (10), EFF_DT DATE);
INS IN LKP VALUES(1,'A','2013-01-01');
INS IN LKP VALUES(1,'B','2014-01-01');My query:
SALT
M.EMPNO AS MAIN_EMP,
M.EFF_DT AS MAIN_DT,
L.TYPE_CD
HAND M LEFT JOIN LKP L ON M.EMPNO = L.EMPNO AND M.EFF_DT = L.EFF_DTResult:
MAIN_EMP MAIN_DT TYPE_CD
2013-01-01 1A
1 01-03-2013?
1 05-01-2013?
1 01-07-2013?
1 01-09-2013?
2014-01-01 1, BExpected result: (I need to get the same value, until I have a new value of research)
MAIN_EMP MAIN_DT TYPE_CD
2013-01-01 1A
2013-03-01 1A
2013-05-01 1A
2013-07-01 1A
2013-09-01 1A
2014-01-01 1, BPlease help me in this regard.
Concerning
KVB
RaminHashimzade wrote:
For 11g (ignores null values)
SELECT M.EMPNO AS MAIN_EMP,
M.EFF_DT AS MAIN_DT,
NVL (L.TYPE_CD, lag(L.TYPE_CD ignore nulls) over (partition by M.EMPNO of M.EFF_DT order)) TYPE_CD
HAND M
LEFT JOIN LKP L
ON M.EMPNO = L.EMPNO
AND M.EFF_DT = L.EFF_DT
order by 2
----
Ramin Hashimzade
It's not only 11g, which is also 10g
-
Offset and IGNORE NULLS for LEAD/LAG
Hi all
so far, I thought that I understood the functioning of LEAD and the DELAY, but after you add the IGNORE NULLS and a shift, I'm confused
I created a Fiddle SQL that executes a 11 g R2, v$ version returns Oracle Database 11 g Express Edition Release 11.2.0.2.0
CREATE TABLE vt (part INT, ord int, val INT); INSERT INTO vt VALUES(1, 1, 8); INSERT INTO vt VALUES(1, 2, 10); INSERT INTO vt VALUES(1, 3, 3); INSERT INTO vt VALUES(1, 4, NULL); INSERT INTO vt VALUES(1, 5, NULL); INSERT INTO vt VALUES(1, 6, NULL); INSERT INTO vt VALUES(1, 7, 2); INSERT INTO vt VALUES(1, 8, NULL); INSERT INTO vt VALUES(1, 9, 5);
-
Ignoring the Null value or 0 for an average of
Hello
I don't code in Java, so I'm having a problem with a form.
We have a form of training that adds the total of the sides and then is supposed to understand on average. My problem is that the provided average is based on the average function canned for the field, so it's the calculation of all the fields, including those who have either a Null value or a zero. Can someone help me with this please?
By the way. If the N.O. is checked, the coast is n/a.
There are also five sections that will total all the sides and will need an average of these totals.
Thanks in advance.
Tom
Screenshot taken: 15/03/2013-21:09
Here's a generic function to calculate the average of a group of non-empty fields.
This function takes two parameters: an array of domain names at average and a Boolean value specifying if the function should return an empty string if the result was zero.
function averageFields (fields, blankIfZero) {}
var total = 0;
var n = 0;
for (var i in fields) {}
var f = this.getField (fields [i]);
v var = f.valueAsString;
If {(v)
total += (+ v);
n ++ ;
}
}
var returnValue = (n == 0)? ' ': total/n;
If (blankIfZero & returnValue = 0) returnValue = "";
return returnValue;
}
You can set this function at the level of the document, and then call it as follows (starting a custom calculation script, in this case):
Event.Value = averageFields (["field1", "Field2", "Field3"], false);
-
test for the null value to IN request (null, 'a ', ' b', 'c')
Hello
Oracle 10.2.0.4
I think the following query is incorrect, in my opinion. (there is an index on the collar, but NULL values are ignored?
SELECT COUNT (*) < table > where col in (null, 'a ', ' b', 'c')
It works (no errors) and forth fast enough.
However, I think the correct query would
SELECT COUNT (*) < table > where IS NULL or neck neck ('a', 'b', 'c')
It takes a lot of time. As I see it, he performs a table scan for part of the value NULL and use the index for the rest, as the index cannot be used for NULL values.
I would appreicate an explanation on this matter, particularly why Oracle accepts the first query "where col in (null, 'a ', ' b', 'c')" without any problem.
Thank you
A null value is not equal to what whatsoever, not even another null value. This is consistent with the definition of the ANSI. For your first request is not what you think it does, even if it is not syntactically incorrect.
The second query is correct. If you want to use an index, you must create a bitmap index (which requires Enterprise Edition licenses), because they do not include the values NULL, unlike B * tree index.
-
How to implement 'Null value replace' inside a RTF
Hello
This is my area:
<? for-each - group:current-group(); / RP_CURRENCY? >
<? If: RP_CURRENCY = "ABOVE"? >
<? for-each - group:current-group(); / RPT_DESCRIPTION? >
<? If: RPT_DESCRIPTION = 'debit card '? >
<? sum (current - group () / RP_CI_EQUIVALENT_CALC)? >
<? end if? >
<? end for each group -? >
<? end if? >
<? end for each group -? >
If this field does not always reach the sum, and then returns a NULL value. I need it to return 0 instead, but I think I'm this overload since RTF are not flexible.
I tried to reach '+ 0' at the end and it works when its null, but if the number is not null, then it adds a 0 to the result rather than adding it.
The XML code is attached.
Please use this amount
And the code below will be more optimized for performance and maintenance.
-
Bar chart stacked - strange behavior on display null values
Hi all
I'm trying to graph a county of the end dates of the activities over several years by months grouped by project.
The problem I have is that there is a gap of 3 months where none of the activities that I am tracking complete. The default value for the stacked bar chart is to ignore the columns with no data (in my case it October-December 2015).
To view these any given month I went to properties graphic and ticked the box "Include Null values. At this point, I get a very strange behavior. Once this option is selected, the legend explodes, showing each project in the database regardless if it meets my criteria for analysis.
Has anyone another considering that happen? I'm doing something wrong?
If it's important I'm in the OBI 11.1.1.7.150120
Thank you for your help,
Kevin Wolfe
Hello
You have a filter on the list of projects you want to see?
Based on the way you describe your analysis I guess you don't have any what filter on the list of projects, but some of the filters on the other dimensions/attributes and these filters were limiting the list of projects.
If this is the case then what you see is not a weird behavior, but everything you've asked your analysis.
"Include null values" is not limited to the time dimension, it fits any dimension of your analysis, so no filter on projects = all projects.
-
Remove the NULL values and update the value according to the logic
Hello
The problem data
CREATE TABLE VOLA (SRNO, NUMBER, zero NUMBER, A NUMBER); INSERTION of REM in VOLA
TOGETHER TO DEFINE
Insert in VOLA (SRNO, ONE) values (1,237.94);
Insert in VOLA (SRNO, ONE) values (2, null);
Insert in VOLA (SRNO, ONE) values (3,203.565);
Insert in VOLA (SRNO, ONE) values (4,170.69);
Insert in VOLA (SRNO, ONE) values (5,113.67);
Insert in VOLA (SRNO, ONE) values (6,93.6);
Insert in VOLA (SRNO, ONE) values (7,82.03);
Insert in VOLA (SRNO, ONE) values (8,66.675);
Insert in VOLA (SRNO, ONE) values (9,63.59);
Insert in VOLA (SRNO, ONE) values (10,61.415);
Insert in VOLA (SRNO, ONE) values (11,60.015);
Insert in VOLA (SRNO, ONE) values (12,58.235);
Insert in VOLA (SRNO, ONE) values (13,57.805);
Insert in VOLA (SRNO, ONE) values (14,56.965);
Insert in VOLA (SRNO, ONE) values (15, null);
Insert in VOLA (SRNO, ONE) values (16, null);
I have to remove the NULL values in column 1, the problem is that the position of the NULL values are not fixed, and it can be any position. If all the lines of the columns are null, then throw it away.
If multiple NULL values are here so I have to do the math as follows to update null with the eigenvalues
1. If the first line is null then take the 2nd value in row and update it.
2. If the lines between both is null then take avg of prev and next value not null and refresh it.
3. If the last value in the column is null, then then take prev and update, in this case last two are null, so I have to take value of prev 14 value line update in
15th and 16th ranks.
I want to put this pl/sql logic, somehow, that I thought have loop and counter aapproach and loops through the elements and check and update.
But always looking for something better before looking to write code. No idea or help will be useful for me.
I * think * you are looking for something like:
WITH VOLA (SRNO, ONE)
AS (select 1,237.94 from all the double union)
Select 2, union null value double all the
Select 3,203.565 from all the double union
Select 4,170.69 from all the double union
Select 5,113.67 from all the double union
Select 6,93.6 from all the double union
Select 7,82.03 from all the double union
Select 8,66.675 from all the double union
Select 9,63.59 from all the double union
Select 10,61.415 from all the double union
Select 11,60.015 from all the double union
Select 12,58.235 from all the double union
Select 13,57.805 from all the double union
Select 14,56.965 from all the double union
Choose 15, null of union double all the
SELECT 16, NULL FROM dual)
GET_VALUES (SELECT SRNO, ONE ACE,
, LAST_VALUE (WE IGNORE NULLS) (ORDER BY SRNO CSA ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) AS PREVIOUS_VALUE
, first_VALUE (ONE IGNORE NULLS) over (ORDER OF SRNO CSA ROWS BETWEEN 1 SUITE AND FOLLOWS without TERMINALS) AS NEXT_VALUE
FROM VOLA)
SELECT SRNO, ONE, CASE
WHEN IT IS NOT NULL, THEN WE
OTHER CASES
WHEN PREVIOUS_VALUE IS NOT NULL AND IS NOT NULL THEN (PREVIOUS_VALUE + NEXT_VALUE) NEXT_VALUE / 2
WHEN THE PREVIOUS_VALUE IS NOT NULL, THEN PREVIOUS_VALUE
WHEN THE NEXT_VALUE IS NOT NULL, THEN NEXT_VALUE
END
END AS NEW_VALUE
OF GET_VALUES
/
HTH
-
Fill with the previous 'not null' value ' Null' known values
Hi all
I have the following requirement to fill in missing values (null values) with the "Not null" values known previously available.
Source of the example:
Emp_Id Start_Dt LOC Comm Grade A101
01/01/2013
NJ 4000 B A101
15/03/2013
CA 4800 A101
15/05/2013
3500 C A101
25/07/2013
2500 A101
20/12/2013
NY 5800 A A101
14/02/2013
5000 A101
20/05/2014
DC 6000 A A101
03/06/2014
3600 C A102
24/05/2013
THE 5000 A A102
15/12/2013 4300 Expected results values in columns LOC and grades:
Emp_Id Start_Dt LOC Comm Grade A101 01/01/2013
NJ 4000 B A101 15/03/2013
CA 4800 B A101 15/05/2013
CA 3500 C A101 25/07/2013
CA 2500 C A101 20/12/2013
NY 5800 A A101 14/02/2013
NY 5000 A A101 20/05/2014
DC 6000 A A101 03/06/2014
DC 3600 C A102 24/05/2013
THE 5000 A A102 15/12/2013
THE 4300 A Any suggestions would be helpful.
Kind regards
Arun
Also, I think that this is a case of analytics. Last_value is perhaps the most appropriate function for the given task:
Select emp_id
start_dt
last_value(loc ignore nulls) over (partition by emp_id arrested by start_dt) loc
comm
last_value(grade ignore nulls) about category (partition by emp_id arrested by start_dt)
t
-
Complete with matching null values
Hi all
Take into consideration the following:
create table X_T2 ( COL1 VARCHAR2(2), COL2 VARCHAR2(2) )
Required result:insert into x_t2 (COL1, COL2) values ('1', 'A'); insert into x_t2 (COL1, COL2) values ('2', ''); insert into x_t2 (COL1, COL2) values ('3', ''); insert into x_t2 (COL1, COL2) values ('4', ''); insert into x_t2 (COL1, COL2) values ('5', ''); insert into x_t2 (COL1, COL2) values ('6', ''); insert into x_t2 (COL1, COL2) values ('7', 'B'); insert into x_t2 (COL1, COL2) values ('8', ''); insert into x_t2 (COL1, COL2) values ('9', ''); insert into x_t2 (COL1, COL2) values ('10', ''); insert into x_t2 (COL1, COL2) values ('11', ''); insert into x_t2 (COL1, COL2) values ('12', 'C'); insert into x_t2 (COL1, COL2) values ('13', ''); insert into x_t2 (COL1, COL2) values ('14', ''); insert into x_t2 (COL1, COL2) values ('15', ''); insert into x_t2 (COL1, COL2) values ('16', ''); insert into x_t2 (COL1, COL2) values ('17', 'D'); insert into x_t2 (COL1, COL2) values ('18', ''); insert into x_t2 (COL1, COL2) values ('19', ''); insert into x_t2 (COL1, COL2) values ('20', '');
Any ideas?1 A 2 A 3 A 4 A 5 A 6 A 7 B 8 B 9 B 10 B 11 B 12 C 13 C 14 C 15 C 16 C 17 D 18 D 19 D 20 D
Oracle 11g
Thanks in advance,
Alexander.Hello, Alexander.
Here's one way:
SELECT col1 , LAST_VALUE (col2 IGNORE NULLS) OVER (ORDER BY LPAD (col1, 2)) AS c2 FROM x_t2 ORDER BY LPAD (col1, 2) ;
a.Stoyanov wrote: Hi all,.
Take into consideration the following:create table X_T2 ( COL1 VARCHAR2(2), COL2 VARCHAR2(2) )
insert into x_t2 (COL1, COL2) values ('1', 'A'); ...
If you want to '2' and '3' in front of '10' and 11', then you might consider col1, a NUMBER, rather than a VARCHAR2, or add a constraint (and possibly a trigger) to make sure he always has 2 characters.
Please include the information and sample version; It's very useful!
You didn't say if you have Oracle 11.1 or 11.2. From 11.2, there is another way to specify IGNORE NULLS; but as noted above will work in both versions (or any version starting with Oracle 10.1). -
History of backfilling with non-null values
Hi gurus,
in Oracle 11 g, which would be the best way to update a null with the next available non-null value?
For example: in the code below, I need to update the null in 20130201 record (key = 1) (key date) with a value of 100 available at the next available date IE 20130203.
Same key = 3 value will be updated with key = 4 value i.e. 200.
Thank you1,ABCD, 20130201, NULL 2,ABCD,20130203, 100 3,ABCD, 20130205, NULL 4, ABCD,20130207, 200
Swith t as ( select tbl.*, last_value(nvl2(c4,c1,null) ignore nulls) over(order by c1) prev_c1, last_value(c4 ignore nulls) over(order by c1) prev_c4, first_value(nvl2(c4,c1,null) ignore nulls) over(order by c1 rows between current row and unbounded following) next_c1, first_value(c4 ignore nulls) over(order by c1 rows between current row and unbounded following) next_c4 from tbl ) select c1, c2, c3, c4, case when c4 is not null then c4 when c1 - prev_c1 < next_c1 - c1 then prev_c4 else next_c4 end new_c4 from t / C1 C2 C3 C4 NEW_C4 ---------- ---- ---------- ---------- ---------- 1 ABCD 20130201 100 2 ABCD 20130203 100 100 3 ABCD 20130205 200 4 ABCD 20130207 200 200 SQL>
SY.
-
replace NULL values for not null values prior
Hi all
I want to set to Null to override value not zero preious available. data are sorted by column Date DT
I want the output voltage:WITH TEMP AS (SELECT SYSDATE DT, 1005 ID1, NULL ID2 FROM DUAL UNION ALL SELECT SYSDATE+1 DT, 1005 , NULL ID2 FROM DUAL UNION ALL SELECT SYSDATE+2 DT, 1006, 1005 ID2 FROM DUAL UNION ALL SELECT SYSDATE+3 DT, 1006 , NULL ID2 FROM DUAL UNION ALL SELECT SYSDATE+4 DT, 1007, 1006 ID2 FROM DUAL UNION ALL SELECT SYSDATE+5 DT, 1007 , NULL ID2 FROM DUAL UNION ALL SELECT SYSDATE+6 DT, 1007 , NULL ID2 FROM DUAL UNION ALL SELECT SYSDATE+7 DT, 1006, 1007 ID2 FROM DUAL ) SELECT * FROM TEMP
time added so far can be ignored.DT ID1 ID2 1/6/2012 9:54:11 AM 1005 NULL 1/7/2012 9:54:11 AM 1005 NULL 1/8/2012 9:54:11 AM 1006 1005 1/9/2012 9:54:11 AM 1006 1005 1/10/2012 9:54:11 AM 1007 1006 1/11/2012 9:54:11 AM 1007 1006 1/12/2012 9:54:11 AM 1007 1006 1/13/2012 9:54:11 AM 1006 1007
Thanks in advance.
... VivekWITH temp AS ( SELECT SYSDATE DT, 1005 ID1, NULL ID2 FROM DUAL UNION ALL SELECT SYSDATE+1 DT, 1005 , NULL ID2 FROM DUAL UNION ALL SELECT SYSDATE+2 DT, 1006, 1005 ID2 FROM DUAL UNION ALL SELECT SYSDATE+3 DT, 1006 , NULL ID2 FROM DUAL UNION ALL SELECT SYSDATE+4 DT, 1007, 1006 ID2 FROM DUAL UNION ALL SELECT SYSDATE+5 DT, 1007 , NULL ID2 FROM DUAL UNION ALL SELECT SYSDATE+6 DT, 1007 , NULL ID2 FROM DUAL UNION ALL SELECT SYSDATE+7 DT, 1006, 1007 ID2 FROM DUAL ) SELECT dt, id1, last_value(id2 ignore nulls) over(order by dt) as id2 FROM temp ORDER BY dt ;
Maybe you are looking for
-
compressor does not reach 28 seconds in treatment
After sending file fcpx to the compressor, it will fail at 28 seconds in treatment. In the same event fcpx I have 2 projects ongoing 1 to process completion ok but 1 fails after 28 seconds. I hope someone can help. My computer knowledge is limited. W
-
where to find my osx in the apple store application, please?
I bought on line osx lion update my macbook, I have received the agreement of license by e-mail but are unable to find the product in my purchases in the app store? Where could else be? Thks in advce for your help
-
[SOLVED] Y580 - unable to connect to Wi - Fi
http://i.imgur.com/MD6awJ2.jpg Here's what it looks like. Yesterday it worked fine, I turned off the computer laptop, is released, he lit the morning and bam, no internet. I reinstalled the drivers, then reinstalled the system, and nothing has change
-
How to install the HP Photosmart D110 printer
How to install a HP Photosmart D110 printer on my computer laptop gateway? This printer does not appear in the options when I try to add a printer.
-
Once logged into windows, it tells me that I need to activate windows. I click Yes to activate and it tells me that windows is already activated, click OK and it returns me to my log in page over and over. Why? and what to do about it?