On the date ranges in search of oracle forms
I use service number, name, type person and date as search criteria in the custom form ranges.When I enter the employee number, press the search button, I get the exact info in the block of result.
Result block contains
name of the employee, personid, emp numbed, org, start_date.
Similarly when I enter the employee number, dept, I get the correct values.
My question is, when I enter the date range. IAM unable to filter the data.
When I enter START_DATE between nvl(:BLOCKNAME.) Start_date, 1 January 1901 ') and nvl(:BLOCKNAME.) End_date, 31-DEC-4712') where block clause in the result. I had data for the range of dates also.
If I give condition in where clause results take so long when I search with the name of the employee, number, dept, person type.
If I have a query with the date, the persormance is good.
Think you know everything, how it prevents START_DATE between nvl(:BLOCKNAME.) Start_date, 1 January 1901 ') and nvl(:BLOCKNAME.) End_date, 31-DEC-4712') when look us with the employee's name, number, dept, person type.
So leave the WHERE clause of your empty block and put something like the following in your search button:
IF :BLOCK.START_DATE IS NOT NULL
OR :BLOCK.END_DATE IS NOT NULL THEN
SET_BLOCK_PROPERTY('YOURBLOCK', ONETIME_WHERE, 'START_DATE between nvl(:BLOCKNAME.START_DATE,TO_DATE(''01-JAN-1901'', ''DD-MON-YYYY'')) and nvl(:BLOCKNAME.END_DATE,TO_DATE(''31-DEC-4712'', ''DD-MON-YYYY''))');
END IF;
Tags: Oracle Development
Similar Questions
-
SUM (case use this structure to get average values on the date range
I use:
Oracle SQL Developer (3.0.04) build hand - 04.34 Oracle Database 11 g Enterprise Edition 11.2.0.1.0 - 64 bit Production
How do we use the function sum with a structure of matter inside.
so I gave that looks like have an ID, date and value. I'm looking to get the day 7 medium for the date range of 04/01/2013 to 20/04/2013
* Please let me know if the table does not load.with t as ( select 1 ID_Key,to_date('4/1/2013','mm-dd-yyyy') date_val, 10 Value_num from dual union all select 1 ID_key,to_date('4/2/2013','mm-dd-yyyy'), 15 from dual union all select 1 ID_key,to_date('4/3/2013','mm-dd-yyyy'), 20 from dual union all select 1 ID_key,to_date('4/5/2013','mm-dd-yyyy'), 0 from dual union all select 1 ID_key,to_date('4/8/2013','mm-dd-yyyy'), 12 from dual union all select 1 ID_key,to_date('4/9/2013','mm-dd-yyyy'), 8 from dual union all select 1 ID_key,to_date('4/10/2013','mm-dd-yyyy'), 6 from dual union all select 1 ID_key,to_date('4/12/2013','mm-dd-yyyy'), 10 from dual union all select 1 ID_key,to_date('4/13/2013','mm-dd-yyyy'), 0 from dual union all select 1 ID_key,to_date('4/14/2013','mm-dd-yyyy'), 0 from dual union all select 1 ID_key,to_date('4/15/2013','mm-dd-yyyy'), 10 from dual union all select 1 ID_key,to_date('4/16/2013','mm-dd-yyyy'), 5 from dual union all select 1 ID_key,to_date('4/17/2013','mm-dd-yyyy'), 2 from dual union all select 1 ID_key,to_date('4/20/2013','mm-dd-yyyy'), 3 from dual union all select 2 ID_key,to_date('4/3/2013','mm-dd-yyyy'), 12 from dual union all select 2 ID_key,to_date('4/5/2013','mm-dd-yyyy'), 15 from dual union all select 2 ID_key,to_date('4/6/2013','mm-dd-yyyy'), 5 from dual union all select 2 ID_key,to_date('4/7/2013','mm-dd-yyyy'), 7 from dual union all select 2 ID_key,to_date('4/9/2013','mm-dd-yyyy'), 10 from dual union all select 2 ID_key,to_date('4/11/2013','mm-dd-yyyy'), 5 from dual union all select 2 ID_key,to_date('4/12/2013','mm-dd-yyyy'), 0 from dual union all select 2 ID_key,to_date('4/13/2013','mm-dd-yyyy'), 0 from dual union all select 2 ID_key,to_date('4/15/2013','mm-dd-yyyy'), 6 from dual union all select 2 ID_key,to_date('4/16/2013','mm-dd-yyyy'), 8 from dual union all select 2 ID_key,to_date('4/17/2013','mm-dd-yyyy'), 0 from dual union all select 2 ID_key,to_date('4/18/2013','mm-dd-yyyy'), 10 from dual union all select 2 ID_key,to_date('4/19/2013','mm-dd-yyyy'), 5 from dual )
I would get the average of 7 days, as long as there is date for the rank of enough previous dates, is it not, then it returns a null value.
the results should look like this
As you can see, there are gaps in the dates, the value is then processed by zeros for the 7Day_Avg and then ignored for the 7Day_Avg2 (not counted in the number of days on average do to no valu_num line)ID_Key date_val Value_num 7Day_Avg 7Day_Avg2 1 4/1/2013 10 null null 1 4/2/2013 15 null null 1 4/3/2013 20 null null 1 4/5/2013 0 null null 1 4/8/2013 12 6.71 11.75 1 4/9/2013 8 5.71 10.00 1 4/10/2013 6 3.71 6.50 1 4/12/2013 10 5.14 9.00 1 4/13/2013 0 5.14 7.20 1 4/14/2013 0 5.14 6.00 1 4/15/2013 10 4.86 5.67 1 4/16/2013 5 4.42 5.17 1 4/17/2013 2 3.85 4.50 1 4/20/2013 3 2.86 4.00 2 4/3/2013 12 null null 2 4/5/2013 15 null null 2 4/6/2013 5 null null 2 4/7/2013 7 5.57 9.75 2 4/9/2013 10 7.00 9.80 2 4/11/2013 5 6.00 8.40 2 4/12/2013 0 3.86 5.40 2 4/13/2013 0 3.14 4.40 2 4/15/2013 6 3.00 4.20 2 4/16/2013 8 2.71 3.80 2 4/17/2013 0 2.71 3.17 2 4/18/2013 10 3.43 4.00 2 4/19/2013 5 4.14 4.83
I tried something like this at first, but becomes "missing keyword" error
Should I have the structure outside the sum function?select t.*/, sum( case when date_val between :day2 - 6 and :day2 then value_num between date_val - 6 and date_val else null end ) as 7Day_avg form t
Any thoughts?
Published by: 1004407 on June 7, 2013 11:06Hello
If you want to calculate the average of the last 7 days, including the current day, then then RANGE should be 6 PRIOR, not 7.
Try this:
WITH got_min_date_val AS
(
SELECT id_key, date_val, value_num
MIN (date_val) compared to (AS min_date_val)
T
WHERE the date_val BETWEEN TO_DATE (April 1, 2013 ', "dd-mm-yyyy")
AND TO_DATE (April 20, 2013 ', "dd-mm-yyyy")
)
SELECT id_key, date_val, value_num
CASE
WHEN date_val > = min_date_val + 6
THEN SUM (value_num) OVER (PARTITION BY id_key
ORDER BY date_val
PRIOR TO TIER 6
)
/ 7
END AS avg_7_day
CASE
WHEN date_val > = min_date_val + 6
THEN AVG (value_num) OVER (PARTITION BY id_key
ORDER BY date_val
PRIOR TO TIER 6
)
END AS avg_7_day_2
OF got_min_date_val
ORDER BY id_key
date_val
;
Output:
ID_KEY DATE_VAL VALUE_NUM AVG_7_DAY AVG_7_DAY_2
---------- --------- ---------- ---------- ------------
1 1 APRIL 13 10
1 2 APRIL 13 15
1 APRIL 3, 13 20
1 5 APRIL 13 0
1 APRIL 8, 13 12 6.71 11.75
1 APRIL 9, 13 8 5.71 10.00
1 APRIL 10 13 6 3.71 6.50
1 12 APRIL 13 10 5.14 9,00
1 13 APRIL 13 0 5,14 7.20
1 14 APRIL 13 0 5,14 6.00
1 15 APRIL 13 10 4.86 5.67
1 16 APRIL 13 5 4.43 5.17
1 APRIL 17, 13 2 3.86 4.50
1 APRIL 20, 13 3 2.86 4.00
2 APRIL 3, 13 12
2 5 APRIL 13 15
2 6 APRIL 13 5
2 7 APRIL 13 7 5.57 9.75
2 9 APRIL 13 10 7,00 9.80
2 11 APRIL 13 5 6.00 8.40
2 12 APRIL 13 0 3.86 5.40
2 13 APRIL 13 0 3.14 4.40
2 15 APRIL 13 6 3.00 4.20
2 16 APRIL 13 8 2.71 3.80
2 17 APRIL 13 0 2.71 3.17
2 18 APRIL 13 10 3.43 4.00
2 APRIL 19, 13 5 4.14 4,83
Post edited by: FrankKulash
Sorry; I wanted to respond to OP, not Greg
-
Get number of records in the date range - IDE: PLSQL Developer
I want to count the number of records of members who register within a date range specified, based on effective and expiration dates and their "elg_code". I posted the SQL code for some examples of data. What I would like to see returned is in three columns of the counties where the eff_date date_exp members fall within the date range specified by the SQL and have an Elg_code of ' ' (space).
So what I would like is all members with elg_code ' ' where he eff_dt and exp_dt range is April 2012, 2012 MAY & JUN 2012. Thus, according to data from the sample I posted, Mark, where his elg_code record is ' ', his eff_dt is 01/01/2011 and April 2012 (30/04/2012) is his exp_dt. Range of the brand statement may 2012, but not MAY or JUNE of 2012. Marty would tally for the APR and MAY because his eff_dt is before MAY 2012 and his exp to MAY 2012. etc...
According to the data below, the results should resemble:
APR MAY JUN
4-3-2
APR should have FRANK, MARK, MARTY, MARY.
MAY should have FRANK, MARTY, MARY
JUN should have FRANK and MARIE
NOAM and JOHN should not appear as his records with elg_code ' ' have no documents eff_dt and exp_dt which are April-June 2012.
So what I tried without success as it appears that I have a kind of Cartesian question (?), is:
Select count (m1.mbr_name) APR,
Count (m2.mbr_name) MAY,
Count (m3.mbr_name) JUN
mbr2 M1,
mbr2 m2,
mbr2 m3
"where m1.eff_dt < ' 01 - may - 2012"
"and m1.exp_dt > ' 01-Apr-2012.
and m1.elg_code = ' '
"and m2.eff_dt < 1 June 2012"
"and m2.exp_dt > ' 01 - may - 2012"
and m2.elg_code = ' '
"and m3.eff_dt < 1 July 2012"
"and m3.exp_dt > 1 June 2012"
and m3.elg_code = ' '
Here's the DML
Thanks for any help!
create table mbr2 (mbr_name varchar (10), varchar (1) grpid eff_dt date, date of exp_dt elg_code varchar (1))
Commit
insert into mbr2 values ('BRAND', 'A', to_date (January 1, 2011 ',' DD-MM-YYYY '), to_date (April 30, 2012 ',' DD-MM-YYYY '), ' ')
insert into mbr2 values ('BRAND', 'A', to_date (May 1, 2012 ',' DD-MM-YYYY '), to_date (31 December 2013 ',' DD-MM-YYYY '), 'C')
insert into mbr2 values ('MARTY', 'A', to_date (January 1, 2011 ',' DD-MM-YYYY '), to_date (May 31, 2012 ',' DD-MM-YYYY '), ' ')
insert into mbr2 values ('MARTY', 'A', to_date (June 1, 2012 ',' DD-MM-YYYY '), to_date (31 December 2013 ',' DD-MM-YYYY '), 'C')
insert into mbr2 values ('FRANK', 'B', to_date (January 1, 2011 ',' DD-MM-YYYY '), to_date (June 30, 2012 ',' DD-MM-YYYY '), ' ')
insert into mbr2 values ('FRANK', 'B', to_date (July 1, 2012 ',' DD-MM-YYYY '), to_date (31 December 2013 ',' DD-MM-YYYY ""), 'C')
insert into mbr2 values ('MARY', 'B', to_date (January 1, 2011 ',' DD-MM-YYYY '), to_date (June 30, 2012 ',' DD-MM-YYYY '), ' ')
insert into mbr2 values ('MARY', 'B', to_date (July 1, 2012 ',' DD-MM-YYYY '), to_date (31 December 2013 ',' DD-MM-YYYY ""), 'C')
insert into mbr2 values ('JOHN', 'C', to_date (January 1, 2011 ',' DD-MM-YYYY '), to_date (July 1, 2011 ',' DD-MM-YYYY '), ' ')
insert into mbr2 values ('JOHN', 'C', to_date (July 1, 2011 ',' DD-MM-YYYY '), to_date (1 January 2012 ',' DD-MM-YYYY ""), 'C')
insert into mbr2 values ("NOAM" 'd', to_date (July 1, 2012 ',' DD-MM-YYYY '), to_date (31 December 2013 ',' DD-MM-YYYY '), ' ' ")
CommitThis gives you a report for the current month and the two front. Column header must be adjusted ;-)
select count( case when eff_dt < add_months(trunc(sysdate,'MM'), -1) and exp_dt >= add_months(trunc(sysdate,'MM'), -2) then 1 end) April , count( case when eff_dt < add_months(trunc(sysdate,'MM'), 0) and exp_dt >= add_months(trunc(sysdate,'MM'), -1) then 1 end) May , count( case when eff_dt < add_months(trunc(sysdate,'MM'), 1) and exp_dt >= add_months(trunc(sysdate,'MM'), 0) then 1 end) June from mbr2 where elg_code = ' ' and eff_dt < add_months(trunc(sysdate,'MM'), 1) and exp_dt >= add_months(trunc(sysdate,'MM'), -2) APRIL MAY JUNE 4 3 2
-
Dear professionals,
How to perform a search in oracle forms using the toolbar: (press enter query key + press run key) using the following criteria:
1. the value in the date element is less then some (e.g. date_item < 01.02.2011) photo
2. how to find NULL values in date and no items date (IS NULL does not work)
It is not the problem of dynamically set these criteria: set_block_property ('block_name', default_where,'date_item IS NULL "") OR set_block_property ('block_name', default_where,'date_item < ' 01.02.2011 ").
There is a useful link to get advice from oracle forms research?
THX in advance,
Adnan
Published by: adnanBIH on February 8, 2011 11:18You can do this by using
#IS NULL -- or #IS NOT NULL
Be aware, that your text object accepts values is more than limit set in search mode. So it cannot accept the channels above if the length of the column is less.
Another way may be to use replace colon (:) in all areas and it will appear in a search window where you can type your condition (so you can put the like condition - YourColumn IS NOT NULL, etc) and it will be increased to current blocks where clause.)
I hope that helps!
-
AMOUNT of Oracle with the date range
Hello community,
I'm having a problem with the addition of a field with a date range. It comes to my table
JVREF VARCHAR2 10 - - - - - - SOURCE VARCHAR2 2 - - - - - - PERIOD VARCHAR2 6 - - - - - - JVDATE NUMBER - 38 0 - Nullable - - GLCODE VARCHAR2 24 - - - - - - DESCR VARCHAR2 40 - - - Nullable - - AMOUNT_0 FLOAT 48 48 - - Nullable - - AMOUNT_1 FLOAT 48 48 - - Nullable - - JVTYPE VARCHAR2 4 and I'm glad the the following statement works as expected
SELECT AMOUNT_1 FROM 'TABLE' where
TO_DATE ("PERIOD, ' YYYYMM") > = to_date ("'201501 ',' YYYYMM")
and
TO_DATE (PERIOD, 'YYYYMM') < = to_date ("'201502 ',' YYYYMM");
E.g.
AMOUNT_1
56192.48
59863.57
48570.1
72407.12
21626.96
35532.96
75860.67
25623.62
54799.83
16872.3
The next thing I want to do is the sum of these amounts... so I changed my statement to become
SELECT SUM (AMOUNT_1) 'TABLE' where
TO_DATE ("PERIOD, ' YYYYMM") > = to_date ("'201501 ',' YYYYMM")
and
TO_DATE (PERIOD, 'YYYYMM') < = to_date ("'201502 ',' YYYYMM");
and now I'm getting
ORA-01841: (full) year must be between-4713 and 9999 and not 0
I also tried
SELECT THE PERIOD (AMOUNT_1) SUM OF "BRE". "' OPW_NMLTRX ' where
TO_DATE ("PERIOD, ' YYYYMM") > = to_date ("'201501 ',' YYYYMM")
and
TO_DATE (PERIOD, 'YYYYMM') < = to_date ("'201502 ',' YYYYMM")
Group by PERIOD
with the same results... I can't figure out what I should do next?
Thank you.
Hello
Solomon Yakobson says:
Question:
SELECT *.
From your_table
WHERE the TO_NUMBER (SUBSTR (PERIOD, 1, 4)) NO BETWEEN-4713 and 9999
OR TO_NUMBER (SUBSTR (PERIOD, 1, 4)) = 0
/
To find the offending rows.
SY.
This can cause other errors, according to what is in this column. A better way would be something like:
Primary_key SELECT, period - add more columns you want
'TABLE' - avoid names which need quotation marks
(Period WHERE the TRANSLATION)
'012345678'
'999999999'
) <> = "999999"
OR SUBSTR (period, 1, 4), not BETWEEN "1900" AND "2099"
OR SUBSTR (period 5) NOT BETWEEN '01' to '12'
;
Now there may be errors of conversion, because there is no conversion.
-
Conditional formatting depends on the date ranges
Basically, I want to be able to enter a date in column A and a sum of money in the B column, depending on where the date in column A grave in a date range, I want the money in column B to copy to a corresponding column. Is this possible? The only questions I found on here deal in a conditional formatting with dates have to do with derivative.
Thank you
Julio
I hope this help to clarify for you...
It is not bringing conditional formatting. Formatting conditional would change the format of a cell (or cells)... as the font, color, size, color cell background, or other formatting character is tics of a cell based on the contents of the cell
You ask about including of the value of a cel another beach under certain conditions
Here is an example:
The first three rows are header lines.
You must enter a valid date for the towing job. Using the format "mm/dd/yyyy".
C4 = IF (AND (DATEVALUE (A4) ≥DATEVALUE($B$1), DATEVALUE (A4) ≤DATEVALUE($B$2)), B4, "")
It's shorthand dethrone select cell C4, and type (or copy and paste it here) the formula:
= IF (AND (DATEVALUE (A4) ≥DATEVALUE($B$1), DATEVALUE (A4) ≤DATEVALUE($B$2)), B4, "")
Select the cell C4, copy
Select cells C4 at the end of the C column, paste
-
The smart Albums based on the date range cause app Crash Photos
While I'm setting up a new Smart Album based on day of photos between 12/01/2015 and 31/12/2015 the Photos app closes with a crash. Cannot set the second date (the end date for this album). However, I can easily create a new Smart Album for next month (01/01/2016 and 01/31/2016). I create smart Albums, because the new Photos app does not like the old iPhoto does with my Photos from the photo gallery.
How can I solve this? I don't have an album of December...? !
You are in an area where the date format is different from the United States? Earlier this year, we have seen small business issues have reported that rules for smart albums date range do not work with the primary language set to French or German.
Try to change the primary system language to English with an English date format. Photos could be trying to read the 12/31/2015 as the 12th day of the month 31.
Or use a different date based on 'before' rule and after.
-
To ignore the date ranges that overlap
Hi guys,.
I have the tables below
Periods
START_DATE END_DATE ID 30-SEP-05 13 OCTOBER 05 1 12 OCTOBER 05 14 NOVEMBER 05 2 15 NOVEMBER 05 15 DECEMBER 05 3 T1
DAT_COL ID AMOUNT 11 OCTOBER 05 1 10 12 OCTOBER 05 1 10 16 NOVEMBER 05 1 10 I need to ignore the remaining date range if it overlaps when comparing dat_col from T1 between the dates of beginning and end of periods table. Always need to consider the first periods
output something like this
ID ID_1 START_DATE END_DATE DAT_COL 1 1 30-SEP-05 13 OCTOBER 05 11 OCTOBER 05 1 1 30-SEP-05 13 OCTOBER 05 12 OCTOBER 05 1 3 15 NOVEMBER 05 15 DECEMBER 05 16 NOVEMBER 05 I use query
Select a.id, b.id, b.start_date, b.end_Date, a.DAT_COL from T1 a, (select id, start_date, end_date periods) b
where a.dat_col between b.start_Date and b.end_Date
Group of a.id, b.id, b.start_date, b.end_Date, a.dat_col
order of b.start_date;
ID ID_1 START_DATE END_DATE DAT_COL 1 1 30-SEP-05 13 OCTOBER 05 11 OCTOBER 05 1 1 30-SEP-05 13 OCTOBER 05 12 OCTOBER 05 1 2 12 OCTOBER 05 14 NOVEMBER 05 12 OCTOBER 05 1 3 15 NOVEMBER 05 15 DECEMBER 05 16 NOVEMBER 05 Test case:
CREATE TABLE 'PERIODS '.
("START_DATE" DATE,
"END_DATE" DATE,
'ID '.
) ;
Insert into periods (start_date, end_date, ID) values (to_date('30-SEP-05','DD-MON-RR'),to_date('13-OCT-05','DD-MON-RR'),1);
Insert into periods (start_date, end_date, ID) values (to_date('12-OCT-05','DD-MON-RR'),to_date('14-NOV-05','DD-MON-RR'),2);
Insert into periods (start_date, end_date, ID) values (to_date('15-NOV-05','DD-MON-RR'),to_date('15-DEC-05','DD-MON-RR'),3);
Insert into T1 (DAT_COL, ID) values (to_date('11-OCT-05','DD-MON-RR'), 1);
Insert into T1 (DAT_COL, ID) values (to_date('12-OCT-05','DD-MON-RR'), 1);
Insert into T1 (DAT_COL, ID) values (to_date('16-NOV-05','DD-MON-RR'), 1);
CREATE TABLE 'T1 '.
(DATE OF THE 'DAT_COL',
'ID '.
);
Hello
If you really want to use something close to what you posted, then you can do it like this:
WITH got_r_num AS
(
SELECT a.id
b.id AS id_1
b.start_date
b.end_date
a.dat_col
, ROW_NUMBER () OVER (PARTITION BY a.id, a.dat_col)
ORDER BY b.start_date, b.end_date
) AS r_num
FROM one t1
, (
SELECT id, start_date, end_date
Periods
) b
WHERE a.dat_col BETWEEN b.start_date
AND b.end_date
GROUP BY a.id, b.end_date, a.dat_col, b.start_date and b.id
)
SELECT id, id_1, start_date, end_date, dat_col
OF got_r_num
WHERE r_num = 1
ORDER BY start_date
;
Note that the WITH clause, that's essentially what you posted in your first post (with the added r_num column) and the main request is essentially the same as in response #1.
But why would you do something like that? View online or GROUP BY allows all. If you remove them, you get the #1 response solution.
-
Impossible to get Min, Max and median of the values in the date range values
Hello
I had a requirement as to show the data of each charge group of wise men as '< 100' ' 100-199 "" 200-299 "" 300-399 "400-499, 500-599 600-699 700-799 800-899 900-999 > = 1000 '"»
With the query be able to get the count between the beach and the total below. But impossible to get the Min and Max values for this range. For example if the County < 100 is 3 then in these 3, the lowest value is need to display in the min. Idem for Max column also.
In the light of the median value on these values.
Thanks in advance.
Requirement is as below:
State < 100 100-199, 200-299 300-399 400-499, 500-599 600-699 700-799 800-899 900-999 > = 1000 Min Total median Max
AK 1 2 0 4 1 4 4 35 35 4 1 $25 $85 850 $1,200
AL 0 0 2 27 10 17 35 2 2 35 0 $103 100-$1 500 750
* "QUERY ' * '"
WITH t AS
(SELECT 'AL' State, 12 DUAL FROM VALUE
UNION ALL
SELECT 'AL' State, 67 FROM DUAL VALUE
UNION ALL
SELECT 'AL' State, 23 FROM DUAL VALUE
UNION ALL
SELECT 'AL' State, 12 DUAL FROM VALUE
UNION ALL
SELECT 'AL' State, 12 DUAL FROM VALUE
UNION ALL
SELECT 'AL' State, 78 FROM DUAL VALUE
UNION ALL
SELECT 'AL' State, 34 FROM DUAL VALUE
UNION ALL
SELECT 'AL' State, 4 DUAL FROM VALUE
UNION ALL
SELECT 'AL' State, 12 DUAL FROM VALUE
UNION ALL
SELECT 'AL' State, 15 VALUE FROM DUAL
UNION ALL
SELECT "AZ" State, FROM DUAL VALUE 6
UNION ALL
SELECT "AZ" State, 123 FROM DUAL VALUE
UNION ALL
SELECT "AZ" State, 123 FROM DUAL VALUE
UNION ALL
SELECT 'MY' State, 23 FROM DUAL VALUE
UNION ALL
SELECT 'MY' State, 120 FROM DUAL VALUE
UNION ALL
SELECT 'MY' State, 456 FROM DUAL VALUE
UNION ALL
SELECT 'MY' State, 11 FROM DUAL VALUE
UNION ALL
SELECT 'MY' State, 24 FROM DUAL VALUE
UNION ALL
SELECT 'MY' State, 34 FROM DUAL VALUE
UNION ALL
SELECT 'MY' State, 87 DUAL FROM VALUE
UNION ALL
SELECT 'MY' State, 23 FROM DUAL VALUE
UNION ALL
SELECT 'MY' State, 234 DUAL FROM VALUE
UNION ALL
SELECT 'MY' State, 789 FROM DUAL VALUE
UNION ALL
SELECT "HD" State, VALUE FROM DUAL 54321).
-End of test data
AS T1
(SELECT State,
NVL (COUNT (DECODE (VALUE, 0, 0)), 0) '< 100 ',.
NVL (COUNT (DECODE (VALUE, 1, 1)), 0) '100-199.
NVL (COUNT (DECODE (VALUE, 2, 2)), 0) '200-299.
NVL (COUNT (DECODE (VALUE, 3, 3)), 0) '300-399.
NVL (COUNT (DECODE (VALUE, 4, 4)), 0) '400-499.
NVL (COUNT (DECODE (VALUE, 5, 5)), 0) '500-599,'
NVL (COUNT (DECODE (VALUE, 6, 6)), 0) '600-699.
NVL (COUNT (DECODE (VALUE, 7, 7)), 0) '700-799.
NVL (COUNT (DECODE (VALUE, 8, 8)), 0) '800-899.
NVL (COUNT (DECODE (VALUE, 9, 9)), 0) '900-999. "
NVL (COUNT (DECODE (VALUE, 10, 10)), 0) ' > = 1000.
(SELECT STATE,
CASE
WHAT VALUE < 100 THEN 0
WHAT A VALUE BETWEEN 100 AND 199 THEN 1
WHAT VALUE BETWEEN 200 AND 299, THEN 2
WHAT VALUE BETWEEN 300 AND 399 THEN 3
WHAT VALUE BETWEEN 400 AND 499 THEN 4
WHAT VALUE BETWEEN 500 AND 599 5 THEN
WHAT VALUE BETWEEN 600 AND 699 6 THEN
WHAT VALUE BETWEEN 700 AND 799 THEN 7
WHAT VALUE BETWEEN 800 AND 899 8 THEN
WHAT VALUE FROM 900 TO 999 9 THEN
WHAT VALUE > = 10 THEN 1000
END
VALUE
T)
GROUP BY State)
SELECTION STATE,
"< 100."
"100-199.
"200 299",
"300-399.
"400-499.
'500-599,'
"600-699.
"700-799.
"800-899.
"900-999."
"> = 1000."
'< 100 '.
+ "100-199.
+ "200-299.
+ '300-399.
+ '400-499.
+ "500-599.
+ '600-699.
+ "700-799.
+ "800-899.
+ '900-999 ".
+ ' > = 1000.
in total,.
less ("< 100",)
"100-199.
"200 299",
"300-399.
"400-499.
'500-599,'
"600-699.
"700-799.
"800-899.
"900-999."
("> = 1000 ') min_val,.
largest ("< 100",)
"100-199.
"200 299",
"300-399.
"400-499.
'500-599,'
"600-699.
"700-799.
"800-899.
"900-999."
("> = 1000 ') max_val
FROM t1
/Why not keep it simple?
WITH t AS (SELECT 'AL' state, 12 VALUE FROM DUAL UNION ALL SELECT 'AL' state, 67 VALUE FROM DUAL UNION ALL SELECT 'AL' state, 23 VALUE FROM DUAL UNION ALL SELECT 'AL' state, 12 VALUE FROM DUAL UNION ALL SELECT 'AL' state, 12 VALUE FROM DUAL UNION ALL SELECT 'AL' state, 78 VALUE FROM DUAL UNION ALL SELECT 'AL' state, 34 VALUE FROM DUAL UNION ALL SELECT 'AL' state, 4 VALUE FROM DUAL UNION ALL SELECT 'AL' state, 12 VALUE FROM DUAL UNION ALL SELECT 'AL' state, 15 VALUE FROM DUAL UNION ALL SELECT 'AZ' state, 6 VALUE FROM DUAL UNION ALL SELECT 'AZ' state, 123 VALUE FROM DUAL UNION ALL SELECT 'AZ' state, 123 VALUE FROM DUAL UNION ALL SELECT 'MA' state, 23 VALUE FROM DUAL UNION ALL SELECT 'MA' state, 120 VALUE FROM DUAL UNION ALL SELECT 'MA' state, 456 VALUE FROM DUAL UNION ALL SELECT 'MA' state, 11 VALUE FROM DUAL UNION ALL SELECT 'MA' state, 24 VALUE FROM DUAL UNION ALL SELECT 'MA' state, 34 VALUE FROM DUAL UNION ALL SELECT 'MA' state, 87 VALUE FROM DUAL UNION ALL SELECT 'MA' state, 23 VALUE FROM DUAL UNION ALL SELECT 'MA' state, 234 VALUE FROM DUAL UNION ALL SELECT 'MA' state, 789 VALUE FROM DUAL UNION ALL SELECT 'MH' state, 54321 VALUE FROM DUAL) SELECT state , NVL( COUNT( case when VALUE < 100 then 0 end ), 0 ) "<100" , NVL( COUNT( case when VALUE between 100 and 199 then 0 end ), 0 ) "100-199" , NVL( COUNT( case when VALUE between 200 and 299 then 0 end ), 0 ) "200-299" , NVL( COUNT( case when VALUE between 300 and 399 then 0 end ), 0 ) "300-399" , NVL( COUNT( case when VALUE between 400 and 499 then 0 end ), 0 ) "400-499" , NVL( COUNT( case when VALUE between 500 and 599 then 0 end ), 0 ) "500-599" , NVL( COUNT( case when VALUE between 600 and 699 then 0 end ), 0 ) "600-699" , NVL( COUNT( case when VALUE between 700 and 799 then 0 end ), 0 ) "700-799" , NVL( COUNT( case when VALUE between 800 and 899 then 0 end ), 0 ) "800-899" , NVL( COUNT( case when VALUE between 900 and 999 then 0 end ), 0 ) "900-999" , NVL( COUNT( case when VALUE >= 1000 then 0 end ), 0 ) ">=100" , count( value ) "total" , min( VALUE ) "min" , max( VALUE ) "max" , avg( VALUE ) "avg" , median( value ) "median" from t group by state
-
by selecting specific days of the week for the date range?
I have a table with a number of clients for about a year, but I want to only select Wednesday and Thursday of
every week, since the beginning of the dates. Table is simple and has two columns. Each line is separate from a Date
There is no duplicate of Date, it is counted for every day of the year.
column 1: number of clients, count (customer_id)
column 2: Date
Need help with the best way to achieve this.
Not sure if it is even possible to select a date in the name of the day?
Basically, I want to select every Wednesday and Thursday of each week and compare the counts during the week, the week during
week for the whole week see if charges go upwards or downwards, to get trends, thank you!Hello
Kodiak_Seattle wrote:
I have a table with a number of clients for about a year, but I want to only select Wednesday and Thursday of
every week, since the beginning of the dates. Table is simple and has two columns. Each line is separate from a Date
There is no duplicate of Date, it is counted for every day of the year.column 1: number of clients, count (customer_id)
column 2: DateNeed help with the best way to achieve this.
Not sure if it is even possible to select a date in the name of the day?
Sorry, we don't know what you want.
To see if a date given (dt) is a Wednesday or Thursday, you can use:
WHERE TO_CHAR ( dt , 'DY' , 'NLS_DATE_LANGUAGE=ENGLISH' -- If necessary ) IN ('WED', 'THU')
I hope that answers your question.
If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum {message identifier: = 9360002} -
How to pass the date range as in URL filter go
Hello
I am trying to build a Url go that has two filters, date range & text. I built the url below, but he continues to throw an error. The url is not from the date max and the app starts following error:
Error: Status: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error occurred. [nQSError: 46048] Month DateTime value 0 0000-00-00 is off limits. (HY000)
Go to Url: https:companyUrl? GB & Options = rfd & Path = / shared/CompanyID/link & P0 = 2 & P1 = eq & P2=CustomObject4.%22Indexed%20Pick%201%22 & P3 = Leasing & bet = P4 & P5 = ""-CustomObject4 Custom Attributes '. " ZDate_26 & P6 = 2 + Date % 20'2014-08-01'+ day % 20'2014-12-31'
Please suggest.
Thank you
Kiran.It seems that you convert the data type of char to date in the URL, I don't think that this is possible.
Your code is like
& P6 = 2 + Date % 20'2014-08-01'+ day % 20'2014-12-31'It suppose to be & P6 = 2 + 2014-08-01 + 2014-12-31
I suggest doing the formatting for this filed using column properties and try.
Hope this help, pls mark if yes ;)
-
Recover data to leave the date range Table
Hi all
We leave detail table for each employee contains information of beach to leave as follows.
EmpID, leaveFromDt, leaveToDt
We must identify no.. sheets for each employee from the date of the day & current date + group 2 weeks per each week.
If data should look like,
Name of the EMP of leaves
Week 1 semaine2
0 5 emp1
3 2 EMP2
How can this be achieved?
Here are the possible scenarios assuming
Date of the day = 10 may 2012
Current date plus 2 weeks is 24 may 2012
(1) absent from = 20 may 2012
Missing = may 25, 2012
(2) absent from = May 16, 2012
Missing = may 20, 2012
(3) = 6 may 2012 absent
Absent to = 30 may 2012
(4) missing = may 8, 2012
Absent in = 12 may 2012Hello
The preliminary motion should be changed to the definitions of the new week.
The main request must add the number of days, rather than counting sheets.
To include employees who did not leave during these 2 weeks, you should do an outer join:WITH got_weeks AS ( SELECT 1 AS week_num, TRUNC (SYSDATE) AS from_dt, TRUNC (SYSDATE) + 6 AS to_dt FROM dual UNION ALL SELECT 2, TRUNC (SYSDATE) + 7, TRUNC (SYSDATE) + 13 FROM dual ) SELECT e.emp_id , SUM ( CASE WHEN w.week_num = 1 THEN 1 + LEAST (w.to_dt, e.leave_to_dt) - GREATEST (w.from_dt, e.leave_from_dt) ELSE 0 END ) AS &week_1 , SUM ( CASE WHEN w.week_num = 2 THEN 1 + LEAST (w.to_dt, e.leave_to_dt) - GREATEST (w.from_dt, e.leave_from_dt) ELSE 0 END ) AS &week_1 FROM empleavedtls e LEFT OUTER JOIN got_weeks w ON w.from_dt <= e.leave_to_dt AND w.to_dt >= e.leave_from_dt GROUP BY e.emp_id ORDER BY e.emp_id ;
Instead to make 2 essentially the same CASE expressions, with FEWER and more calculations in each of them, you could do that once, in a subquery, and then, since you have Oracle 11, you can use SELECT... PIVOT function to get the totals in two columns. This would make it easier to add additional weeks. This is another good exercise.
-
get all the dates in a beach in oracle resultset
Hello
I need to know how to do all the dates in a date range in Oracle11g query resultset.
It should be something similar to the following pseudocode
Select "All DATES" of? where date between TO_DATE('date-val','format') and TO_DATE ('date-val', ' format').
It may require a different logic, but if I give a range like 5 February 2011, March 2, 2011
It must return me all dates in this range in the result set.
IE resultset = February 5, 2011, February 6, 2011,... February 28, 2011, March 1, 2011, 2 March 2011Hello
You are looking for something like this?
SQL> with a as (select to_date('05-FEB-2012','dd-MON-yyyy') start_date, 2 to_date('02-MAR-2012','dd-MON-yyyy') end_date from dual) 3 select a.start_date + level - 1 dt 4 from a 5 connect by level <= to_date('02-MAR-2012','dd-MON-yyyy') - 6 to_date('05-FEB-2012','dd-MON-yyyy') + 1 7 order by level; DT ----------- 05-FEB-2012 06-FEB-2012 07-FEB-2012 08-FEB-2012 09-FEB-2012 10-FEB-2012 11-FEB-2012 12-FEB-2012 13-FEB-2012 14-FEB-2012 15-FEB-2012 DT ----------- 16-FEB-2012 17-FEB-2012 18-FEB-2012 19-FEB-2012 20-FEB-2012 21-FEB-2012 22-FEB-2012 23-FEB-2012 24-FEB-2012 25-FEB-2012 26-FEB-2012 DT ----------- 27-FEB-2012 28-FEB-2012 29-FEB-2012 01-MAR-2012 02-MAR-2012 27 rows selected. SQL>
-
What is the fastest way bulk load the data from ACE / 400 to Oracle?
Asked me to move data from the AS / 400 to Oracle11gR2 as fast that ODI may eventually. Quinte just no mapping, no transformation, no membership.
An ODI11g agent is started on the computer of Oracle target, but being new ODI, I don't know how to use SQL for Oracle LKM loading in a scene and then updated incremental Oracle IKM layout from staging to the target table.
It took 50 minutes to move recorded about 4 million. I need to get this in about 10 minutes. So guys, if there is a best practice to do this, please let me know, but now I'll try any suggestion you might think.
Thank you in advance.Means the faster is to use a combination of ODI interface and ODI tool named OdiSqlUnload.
N ° 1). Use the ODI OdiSqlUnload tool to export the data from the AS / 400 files in a flat file of the BONES.
Step 2.) Use this flat file as source and LKM file for Oracle (SQLLDR) and Oracle IKM incremental update to load Oracle data.Your current path is slow because it operates on a row by row basis.
-
When you change the date range, some data refresh some is not the case.
In looking at some the report explore end-user (EU - FxM cartridge), I noticed that some data are updated based on the data and the time I selected. I noticed that the response time service level and measures processing time service level (metric in the green circle) doesn't refresh at all. I noticed the same behavior when you look at some different indicators in the report to explore end-user. Anyone encountered this?
I think you are referring to this point of view, but I don't know how you got there from the browser of the end user:
Looking at the Design tab in the right pane of Action and selecting the view "user end/FxM/Applications/Application Service level Layout" to inspect, it turns out that "jelly bean" service level indicators are configured to display:
/ responseTimeServiceLevel/value/latest/min / processingTimeServiceLevel/value/latest/min As the notes of Osama, the "last" value here will not change when the time interval of page is updated.
Contrary to what he says, if this dashboard has been configured to display the "current" value, these indicators would show the last value not expired before the end of the time range of page.
You can:
-Open a session to demand that this configuration of the dashboard be changed in a future release, a matter of pension
-change this system view (which will not survive an upgrade of the FxM cartridge)
-(deep) to copy the view "User end/FxM/Applications/FxM information request" and change the copied view (which survive and upgrade). You must also change the type mapping "FxM Application result" in Applications/FxM/end user to point to your point of view, updated the.
Kind regards
Brian Wheeldon
Maybe you are looking for
-
is there a way to put a "New tab" button in the toolbar?
I was wondering is there a way to put a "New tab" button in the toolbar?
-
Mountain Lion Vs Mavericks (local sync services)
Greetings! I'm currently under Mountain Lion. I would use the last Safari and have places works again in iPhoto. I understand that this requires upgrading at least Mavericks. I read elsewhere on this forum that will disable sync services local to the
-
Although Internet Explorer seems to work and is usable, I get an error that says Internet Explorer is not working properly and will be closed. . Is not always close because it threatens too but sometimes it is. Any solution please? I have Windows
-
How I my HP printer wireless remote control to enlarge a photo/doc that I send it via ePrint
Can't seem to find a way to get there. Impossible to find all the controls in the application ePrint that allow me to perform this function. Help! Is it even possible without physically go the printer & seizes this command, or will this even work as
-
Cannot delete the old folder separate disk windows
I had a system OS 3 for a while, Vista, Win7 RC and Win7 Pro. Win7 RC is pleased and I want to delete records from his drive to free up space. I took possession of the folder (including subfolders) windows and my account is an administrator with full