Query internal within a select if statement
I would like to know how to write an if condition inside a select statement of the presentb.inventory_item_id in(
select distinct inventoryid
from lcm.sis_inventario_new
where fec_envio > to_date('28/01/2010','DD/MM/YYYY'))
I mean something likeselect b.inventory_item_id as id,
b.segment1 as c,
b.segment2 as "Código",
b.description as "Descripción",
tl.description as "Descripción Larga",
b.attribute1 as "Descripción Corta",
c.segment1 as "Departamento",c.segment2 as "Familia", c.segment3 as "Subfamilia",
b.creation_date as "Creado",
b.INVENTORY_ITEM_STATUS_CODE as "Status",
case b.attribute5 when '4' then 'Si' else 'No' end as "Pesado",
case b.inventory_item_id when in select distinct inventoryid
from lcm.sis_inventario_new
where fec_envio > to_date('28/01/2010','DD/MM/YYYY')) then 'Si' else 'No' end as "Existe"
There are a number of ways, and the best solution for you will depend on several factors, including the index, the number of rows in the tables, etc..
Go using analytical functions;
with b as (
select rownum inventory_item_id from dual
connect by rownum <=2),
lcm as (
select 1 inventoryid, to_date('28/01/2000', 'DD/MM/YYYY') fec_envio from dual union all
select 1, to_date('31/12/2010', 'DD/MM/YYYY') from dual union all
select 2, to_date('28/01/2000', 'DD/MM/YYYY') from dual union all
select 2, to_date('28/01/2008', 'DD/MM/YYYY') from dual)
select b.inventory_item_id id,
case
when max(fec_envio) over(partition by b.inventory_item_id) >
to_date('28/01/2010', 'DD/MM/YYYY') then
'Si'
else
'No'
end as existe
from b, lcm
where b.inventory_item_id = lcm.inventoryid;
ID EXISTE
---------- ------
1 Si
1 Si
2 No
2 No
Tags: Database
Similar Questions
-
How to simplify this query in sql simple select stmt
Hello
Please simplify the query
I want to convert this query in a single select statement. Is this possible?
If uarserq_choice_ind is not null then
Select ubbwbst_cust_code
From ubbwbst,utrchoi
Where utrchoi_prop_code=ubbwbst_cancel_prod
Else
Select max(utvsrvc_ranking)
From utvsrvc,ubbwbst
Where utvsrvc_code=ubbwbst_cancel_prod
End ifSelect ubbwbst_cust_code as val From ubbwbst,utrchoi Where utrchoi_prop_code=ubbwbst_cancel_prod AND uarserq_choice_ind is not null union all Select max(utvsrvc_ranking) as val From utvsrvc,ubbwbst Where utvsrvc_code=ubbwbst_cancel_prod and uarserq_choice_ind is null
Without more information, we are unable to combine the two queries in 1 without a union.
Looks like you select values totally disperate of totally different tables -
Select Into statement in the function db - query issued schema table
problem with "select into" in the function db to point 10.2
There are two schemas. "mdbdev" is the master database, and 'devusr' is granted SELECT access table to run queries in the mdbdev schema.
with devusr, in SQL, I am able to run the following query
Select wm_concat (strConcatedCountryList)
from (select country_name as mdbdev.country_master mdbcm strConcatedCountryList
where mdbcm.country_ship_status = < param? >
order of country_name)
but when I use the same procedure/function with 'select into' motion, failed to compile with error * "table or view does not exist."
FUNCTION GETCOUNTRYLISTTOSHIP (SHIP_STATUS NUMBER)
RETURN VARCHAR2
IS
var2CountryList VARCHAR2 (1000);
BEGIN
Select wm_concat INTO var2CountryList (strConcatedCountryList)
from (select country_name as mdbdev.country_master mdbcm strConcatedCountryList
where mdbcm.country_ship_status = value < SHIP_STATUS >
order of country_name);
Return var2CountryList;
END;
Please advise/help/suggestion :)You don't have to ask for the DBA, you can run a query to find out:
select * from all_tab_privs_recd where owner = 'MDBDEV' and table_name = 'COUNTRY_MASTER'
What give you?
-
How to create a sequence within a select statement
I have the following query
He will return for exampleselect t.id_trato2 as DEAL_ID, -- 1 as SEQ_NO from treats t order by id_trato2, seq_no
id_trato2 seq_no
1 s
1 s
4 1
4 1
4 1
I need to return
id_trato2 seq_no
1 s
3 2
4 1
1 W
4 3
Can how I do this?Try this:
select t.id_trato2 as DEAL_ID, row_number() over (partition by t.id_trato2 order by t.id_trato2) as SEQ_NO from treats t order by 1, 2
Published by: kendenny on November 23, 2010 11:40
-
conditional select into statement
Hi people.I'm trying to implement a conditional block in a select statement. I browsed the forums and seen the suggestions with the DECODING and the recurrent insistence that IF/ELSE do not or cannot work within the PL/SQL, which is what it would be.
I'm trying to connect a simple string value if the value of a column is null. The block WHEN either does not either or I'm doing it wrong, but I would take any suggestions that you that you better informed than me on this.
Here is the block:
------------------
SELECT c.CHCTRLID 'CC ID', c.STATUS3, b.VPTIMSTAMP,
a.VP_DATE AS 'Submit Date', a.CRITI_EXP_DT AS 'Critical Date', c.REQ_TYPE, c.SUBJLETTER,c.PGCOUNT AS 'Total Page', c.EFFECT_PGCOUNT,
c.PUBTYPE AS "Type of Publication", c.COMPLEXITYLEVEL,.
c.PUBDATE, a.BRANCH, a.BRANCH_SEC, a.PRIORITY, c.WRITER, a.REQ_INFO_DESCRIPT, a.DEPT,ABS (Round ((pubDate-VPTIMSTAMP), 0)) AS 'level of SLA in days. "
-WHEN PUBDATE IS NULL
- then return "n/a" AS "secondary ALS."
-WHILE OTHERS THEN
-BACK Abs (Round (SYSDATE-VPTIMSTAMP), 0)) AS 'secondary ALS. "a.OPS_MAN_CHG, a.OPS_MAN_PPCHAP, a.STRATEGY_UPDATE, a.CRITICAL_EXP
B INNER JOIN CHG_CTRL_USR one CHG_CTRL_ADM
ON b.CHCTRLID = a.CHCTRLID
C INNER JOIN ADM_SUPP_INDX ON b.CHCTRLID = c.CHCTRLIDWHERE c.STATUS3! = 'Cancelled' AND a.VP_DATE > 4 April 11 '
ORDER BY a.CHCTRLID---------------------------
I commented on the block ONCE because it wouldn't work, but basically, that's what I'm trying to accomplish.
Thank you.
Decode is possible, but the CASE is more readable.
Try this as a column value
CASE WHEN PUBDATE IS NULL then 'n/a' else to_char(Abs(Round(SYSDATE-VPTIMSTAMP),0)) ) end AS "Secondary SLA",
second possibility to check NULL is use NVL or NVL2.
The data type of these two results must match.
as in
nvl2(PUBDATE, to_char(Abs(Round(SYSDATE-VPTIMSTAMP))) , 'n/a')
-
Select SQL statement - See all the value of the range of month of entry
Hi all
I have a vision that is a union of other views
But the description of the view is as below
-current data in the viewdesc dashboard_monthly_view Name Null Type ------------------------------ ---- ------------ MONTHS VARCHAR2(17) NUM_DEPENDENT_IN_ASSESSMENT NUMBER NUM_REFERRED_AODTC NUMBER NUM_AT_DETERMINATION_HEARING NUMBER NUM_ACCEPTED NUMBER NUM_NOT_ACCEPTED NUMBER NUM_EXITED_SUCCESS NUMBER AVERAGE_DAY_TO_EXIST NUMBER NUM_EXITED_UNSUCCESS NUMBER AVERAGE_DAY_TO_EXIST_UNSUCCESS NUMBER COURT_NAME VARCHAR2(9)
-My select query isMONTHS NUM_DEPENDENT_IN_ASSESSMENT NUM_REFERRED_AODTC NUM_AT_DETERMINATION_HEARING NUM_ACCEPTED NUM_NOT_ACCEPTED NUM_EXITED_SUCCESS AVERAGE_DAY_TO_EXIST NUM_EXITED_UNSUCCESS AVERAGE_DAY_TO_EXIST_UNSUCCESS COURT_NAME ----------------- --------------------------- ---------------------- ---------------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ------------------------------ ---------- AUG 2012 1 0 0 0 0 0 0 0 0 AAA OCT 2012 8 1 3 1 1 1 44 1 4 AAA SEP 2012 2 0 2 2 0 0 0 0 0 AAA *UNDEFINED* 0 11 7 1 1 0 0 1 0 AAA NOV 2012 0 0 0 0 0 0 0 1 54 BBB OCT 2012 4 1 2 1 1 1 9 0 0 BBB SEP 2012 1 0 0 0 0 1 14 0 0 BBB *UNDEFINED* 0 5 4 1 0 0 0 1 0 BBB AUG 2012 1 0 0 0 0 0 0 0 0 COMBINED NOV 2012 0 0 0 0 0 0 0 1 54 COMBINED OCT 2012 12 2 5 2 2 2 26.5 1 4 COMBINED SEP 2012 3 0 2 2 0 1 14 0 0 COMBINED *UNDEFINED* 0 16 11 2 1 0 0 2 0 COMBINED 13 rows selected
- And the result isDEFINE startmonth = "Aug 2012"; DEFINE endmonth = "Nov 2012"; with all_months as ( select to_char(which_month, 'MON YYYY') month from (select add_months(to_date('&startmonth','MON YYYY'), rownum-1) which_month from all_objects where rownum <= months_between(to_date(NVL('&endmonth', '&startmonth'),'MON YYYY'), add_months(to_date('&startmonth','MON YYYY'), -1)) order by which_month ) ) select nvl(months, '**ALL**') AS "MONTHS", TO_DATE(MONTHS, 'MON YYYY') AS MONTH_SORT , sum(num_dependent_in_assessment) AS num_dependent_in_assessment , sum(num_referred_aodtc) AS num_referred_aodtc , sum(num_at_determination_hearing) as num_at_determination_hearing , sum(num_accepted) AS num_accepted , sum (num_not_accepted) AS num_not_accepted , sum(num_exited_success) as num_exited_success , sum(average_day_to_exist) as average_day_to_exist , sum(num_exited_unsuccess) as num_exited_unsuccess , sum (average_day_to_exist_unsuccess) as average_day_to_exist_unsuccess from DASHBOARD_MONTHLY_VIEW right outer join all_months on DASHBOARD_MONTHLY_VIEW.months = all_months.month --where months in (select month from all_months) and upper(court_name) like 'AAA' group by (months) order by month_sort
-The requirement of results I have to produce isMONTHS MONTH_SORT NUM_DEPENDENT_IN_ASSESSMENT NUM_REFERRED_AODTC NUM_AT_DETERMINATION_HEARING NUM_ACCEPTED NUM_NOT_ACCEPTED NUM_EXITED_SUCCESS AVERAGE_DAY_TO_EXIST NUM_EXITED_UNSUCCESS AVERAGE_DAY_TO_EXIST_UNSUCCESS ----------------- ------------------------- --------------------------- ---------------------- ---------------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ------------------------------ AUG 2012 01/08/12 1 0 0 0 0 0 0 0 0 SEP 2012 01/09/12 2 0 2 2 0 0 0 0 0 OCT 2012 01/10/12 8 1 3 1 1 1 44 1 4 **ALL**
On the tota (* EVERYTHING *) l, I tried to use the rollup but he total average too, which is not correct. I think the reason because he cannot read the form that was used to calculate the column.MONTHS MONTH_SORT NUM_DEPENDENT_IN_ASSESSMENT NUM_REFERRED_AODTC NUM_AT_DETERMINATION_HEARING NUM_ACCEPTED NUM_NOT_ACCEPTED NUM_EXITED_SUCCESS AVERAGE_DAY_TO_EXIST NUM_EXITED_UNSUCCESS AVERAGE_DAY_TO_EXIST_UNSUCCESS ----------------- ------------------------- --------------------------- ---------------------- ---------------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ------------------------------ AUG 2012 01/08/12 1 0 0 0 0 0 0 0 0 SEP 2012 01/09/12 2 0 2 2 0 0 0 0 0 OCT 2012 01/10/12 8 1 3 1 1 1 44 1 4 NOV 2012 01/11/12 0 0 0 0 0 0 0 0 0 **ALL**
How can I fix this, should I create, select another below one, with the sum of each column and the average for the other columns.
Also, the business analyst want to show all the months between the start and end of the month.
I used the right outer join, but apparently does not produce the right result.
If anyone of you have any ideas, please advise.
We use Oracle 11 g, it is a select statement for an Oracle APEX report.
The APEX version is 4.0.2. I'm a junior developer of the APEX and I still have to learn a lot about SQL Oracle analytic function.
Thank you very much in advance.
AnnHi, Ann.
Ann586341 wrote:
... I created a table to contain a simplified version of this viewThank you. It is much easier to work with.
... My query is
DEFINE startmonth = "Aug 2012"; DEFINE endmonth = "Nov 2012"; with all_months as ( select to_char(which_month, 'MON YYYY') month from (select add_months(to_date('&startmonth','MON YYYY'), rownum-1) which_month from all_objects where rownum <= months_between(to_date(NVL('&endmonth', '&startmonth'),'MON YYYY'), add_months(to_date('&startmonth','MON YYYY'), -1)) order by which_month ) ) , tbl_dashboard_active as ( select * from tbl_dashboard_monthly where months != '**UNDEFINED**' ) select tbl.months AS "MONTHS" --, TO_DATE(tbl.MONTHS, 'MON YYYY') AS MONTH_SORT , tbl.num_hearing , tbl.num_exited_success , tbl.avg_day_success_exist , tbl.num_exited_unsuccess , tbl.avg_day_unsuccess_exist from tbl_dashboard_active tbl right outer join all_months am on tbl.months = am.month and upper(tbl.court_name) like 'BBB' UNION ALL select 'ALL' AS "TOTAL" , SUM(tbl.num_hearing) , SUM(tbl.num_exited_success) , round(AVG(tbl.avg_day_success_exist),2) , SUM(tbl.num_exited_unsuccess) , round(AVG(tbl.avg_day_unsuccess_exist),2) --order by to_date(am.month,'MON YYYY') from tbl_dashboard_monthly tbl right outer join all_months am on tbl.months = am.month and upper(tbl.court_name) like 'BBB'
- And the result I got
MONTHS NUM_HEARING NUM_EXITED_SUCCESS AVG_DAY_SUCCESS_EXIST NUM_EXITED_UNSUCCESS AVG_DAY_UNSUCCESS_EXIST ----------------- ----------- ------------------ --------------------- -------------------- ----------------------- AUG 2012 1 0 0 0 0 OCT 2012 1 0 0 2 35 SEP 2012 1 0 0 0 0 ALL 3 0 0 2 11.67
I don't know why even I already filter all lines that the month is undefined, I still have a blank line in the result set.
This is the line for November. You do an outer join, in order to ensure that each value of am.month is displayed, even if it does not match what anyone in tbl. When it does not match anything, then all the columns tbl is supposed to provide will be NULL. You decide to view tbl. months, which is one of the following columns will be NULL. You should display mod. monmth instead.
But if I run for handset Court, I don't see this problem. The reason is that the Court combined have given for all four months?
When you say "on behalf of the combined Court", do you mean the unconditional "upper (tbl.court_name) as"BBB "?
If Yes, that would explain it.Also is it possible to list all the months between the start and end month assuring the user even if the statistics are 0.
Once again, in the case of lines that are present, even if they do not have the status of outer join, all of these columns will be NULL. Use NVL to map these nulls to 0.
and how to sort the month
GROUP OF two expressions, which depend on each other: one for sorting and the other for display.
For the sort expression, you can use months as a DATE. (It seems that you have tried this, but commented on the ORDER BY clause in your query is before the FROM clause.) The ORDER BY clause is always at the end of the query, after the FROM clause.)
Another expression of sorting is the number you used to generate the first month. That's what I used below.Here's a way to get the results you requested:
WITH got_months AS ( SELECT TO_DATE ('&startmonth', 'Mon YYYY') AS startmonth_dt , TO_DATE ( NVL ( '&endmonth' , '&startmonth' ) , 'Mon YYYY' ) AS endmonth_dt FROM dual ) , all_months AS ( SELECT rownum AS month_num , TO_CHAR ( ADD_MONTHS ( m.startmonth_dt , ROWNUM - 1 ) , 'MON YYYY' ) AS months FROM got_months m CROSS JOIN all_objects WHERE ROWNUM <= 1 + MONTHS_BETWEEN ( m.endmonth_dt , m.startmonth_dt ) ) SELECT NVL ( am.months , 'All' ) AS months , SUM (NVL (tbl.num_hearing, 0)) AS num_hearing , SUM (NVL (tbl.num_exited_success, 0)) AS num_exited_success , AVG (NVL (tbl.avg_day_success_exist, 0)) AS avg_day_success_exist , SUM (NVL (tbl.num_exited_unsuccess, 0)) AS num_exited_unsuccess , AVG (NVL (tbl.avg_day_unsuccess_exist, 0)) AS avg_day_unsuccess_exist FROM all_months am LEFT OUTER JOIN tbl_dashboard_monthly tbl ON am.months = tbl.months AND UPPER (tbl.court_name) = 'BBB' GROUP BY GROUPING SETS ( (am.month_num, am.months) , () ) ORDER BY am.month_num ;
Again, I used two GROUP BY expressions: one for sorting, the other for display. These depend on each other, that is, given one, you could derive from each other, and it is not sensible to dependent ROLLUP GROUP BY expressions like that, so I used GROUPING SETS ROLLUP instead, so it would be only 1 rank of great aggregate (in other words, 'all').
Output:
` AVG_ AVG_ NUM_ DAY_ NUM_ DAY_ NUM_ EXITED_ SUCCESS EXITED_ UNSUCCESS MONTHS HEARING SUCCESS _EXIST UNSUCCESS _EXIST --------- ------- ------- ---------- --------- ---------- AUG 2012 1 0 0 0 0 SEP 2012 1 0 0 0 0 OCT 2012 1 0 0 2 35 NOV 2012 0 0 0 0 0 All 3 0 0 2 8.75
-
Dynamic report query table based on selected LOV
Hello
Need some suggestions and Tips how to query dynamically table via lov to report.
Scenario:
Table, TABLE_LIST, a tablename (table in DB) and filter (for where clause) column. The TABLENAME_LOVE is derived from the table TABLE_LIST.
D SELECT TABLENAME TABLENAME TABLE_LIST R
On Page 2, a select list item, page P2_TABLENAME use TABLENAME_LOV
All data tables in the table_list has an identical structure (columns, triggers, primary key and so on).
I want to have the query area of the report of the table based on selected LOV.
Example,
TableName Filter
WBR
CD2 ACTIVE = 'Y '.
When select TB1, regin report ask TB1 on the base.
When select CD2, will interview the report based on CD2 regin WHERE ACTIVE = 'Y '.
Question:
How can I query function & P2_TABLENAME. WHERE & P2_FILTER.
As
Select col1, col2 from P2_TABLENAME WHERE & P2FILTER
Appreciate any suggestions and tips.
TigerwapaHello
You should always put your version of the Apex, version of DB and such other information as suggested in the FAQ.
And now wherever you are referring to report, you need to answer if it's IR or classic.Regarding your query, have you explored the kind of statement "SQL Query (body of function from PL/SQL returning SQL query)"?
This could be a good target for what you're trying to reach.Kind regards
-
Query by running the Diffrence of STATS$ EVENT_HISTOGRAM
I am tiring to perform an analysis on STATS$ EVENT_HISTOGRAM (created in PERFSTAT).
I would like to end up with a result like this;
The rules are (I know so far):SNAP_ID SNAP_TIME DB_RESTART WAIT_COUNT_LE_7MS WAIT_COUNT_GT_7MS TOTAL_WAIT_COUNT WAIT_COUNT_PERCENT_LE_7MS WAIT_COUNT_PERCENT_GT_7MS 397 2/9/2012 2:02:39 PM NO 3,311 16,261 19,572 16.92 83.08 398 2/9/2012 2:35:03 PM NO 10,040 11,499 21,539 46.61 53.39 399 2/9/2012 5:02:22 PM YES 11,137 113,916 225,053 49.38 50.62 400 2/9/2012 5:32:21 PM NO 5,880 5,047 10,927 53.81 46.19 401 2/9/2012 6:02:21 PM NO 1,342 3,004 4,346 30.88 69.12
1. all values correspond to the difference of the previous SNAP_ID
2. the first SNAP_ID has no precedential value, so it will not appear in the result set. In our case, it was SNAP_ID 396.
3. when the STATS$ SNAPSHOT. STARTUP_TIME the row changes previous this indicates a DB_RESTART = YES.
4. when DB_RESTART = YES do not subtract the values of previous SNAP_ID.
I'm on Oracle 11.1.0.7
Create the table EVENT_HISTOGRAM STATS$:
Load my data in the table EVENT_HISTOGRAM STATS$:CREATE TABLE STATS$EVENT_HISTOGRAM ( SNAP_ID NUMBER, DBID NUMBER, INSTANCE_NUMBER NUMBER, EVENT_ID NUMBER, WAIT_TIME_MILLI NUMBER, WAIT_COUNT NUMBER );
Create STATS$ snapshot table:Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI,WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 1,47088592); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 2, 7397910); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 4, 1049509); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 8, 2384662); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 16, 12446589); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 32, 6698196); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 64, 934431); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 128, 655758); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 256, 213053); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 512, 73814); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 1024, 6088); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 2048, 1825); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 4096, 2169); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 8192, 3122); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 16384, 4144); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 32768, 330); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 65536, 662); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 131072, 9); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 262144, 28); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 524288, 22); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 1, 47091161); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 2, 7398497); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 4, 1049664); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 8, 2386574); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 16, 12454531); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 32, 6701651); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 64, 934831); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 128, 656657); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 256, 213223); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 512, 74218); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 1024, 6167); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 2048, 1869); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 4096, 2237); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 8192, 3317); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 16384, 4779); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 32768, 358); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 65536, 663); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 131072, 12); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 262144, 47); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 524288, 29); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 1, 47100463); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 2, 7399116); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 4, 1049783); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 8, 2387726); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 16, 12459548); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 32, 6704135); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 64, 935351); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 128, 657496); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 256, 213525); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 512, 74515); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 1024, 6224); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 2048, 1898); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 4096, 2323); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 8192, 3503); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 16384, 5229); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 32768, 381); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 65536, 671); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 131072, 20); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 262144, 68); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 524288, 49); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 1, 86466); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 2, 20937); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 4, 3734); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 8, 11128); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 16, 58220); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 32, 33902); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 64, 5707); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 128, 3308); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 256, 1149); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 512, 413); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 1024, 40); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 2048, 25); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 4096, 12); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 8192, 7); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 16384, 4); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 32768, 0); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 65536, 1); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 1, 88335); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 2, 24658); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 4, 4024); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 8, 11678); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 16, 61227); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 32, 35252); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 64, 5821); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 128, 3316); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 256, 1158); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 512, 421); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 1024, 41); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 2048, 25); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 4096, 12); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 8192, 7); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 16384, 4); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 32768, 0); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 65536, 1); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 1, 89498); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 2, 24811); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 4, 4050); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 8, 11919); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 16, 62776); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 32, 36157); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 64, 5993); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 128, 3424); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 256, 1181); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 512, 427); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 1024, 41); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 2048, 25); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 4096, 12); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 8192, 7); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 16384, 4); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 32768, 0); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 65536, 1); COMMIT;
Load my data in the snapshot table $ STATS:CREATE TABLE STATS$SNAPSHOT ( SNAP_ID NUMBER, DBID NUMBER, INSTANCE_NUMBER NUMBER, SNAP_TIME DATE, STARTUP_TIME DATE, SESSION_ID NUMBER, SERIAL# NUMBER, SNAP_LEVEL NUMBER, UCOMMENT VARCHAR2(160 BYTE), EXECUTIONS_TH NUMBER, PARSE_CALLS_TH NUMBER, DISK_READS_TH NUMBER, BUFFER_GETS_TH NUMBER, SHARABLE_MEM_TH NUMBER, VERSION_COUNT_TH NUMBER, SEG_PHY_READS_TH NUMBER, SEG_LOG_READS_TH NUMBER, SEG_BUFF_BUSY_TH NUMBER, SEG_ROWLOCK_W_TH NUMBER, SEG_ITL_WAITS_TH NUMBER, SEG_CR_BKS_RC_TH NUMBER, SEG_CU_BKS_RC_TH NUMBER, SEG_CR_BKS_SD_TH NUMBER, SEG_CU_BKS_SD_TH NUMBER, SNAPSHOT_EXEC_TIME_S NUMBER, ALL_INIT VARCHAR2(5 BYTE), BASELINE VARCHAR2(1 BYTE) );
Insert into STATS$SNAPSHOT (SNAP_ID, DBID, INSTANCE_NUMBER, SNAP_TIME, STARTUP_TIME, SESSION_ID, SERIAL#, SNAP_LEVEL, EXECUTIONS_TH, PARSE_CALLS_TH, DISK_READS_TH, BUFFER_GETS_TH, SHARABLE_MEM_TH, VERSION_COUNT_TH, SEG_PHY_READS_TH, SEG_LOG_READS_TH, SEG_BUFF_BUSY_TH, SEG_ROWLOCK_W_TH, SEG_ITL_WAITS_TH, SEG_CR_BKS_RC_TH, SEG_CU_BKS_RC_TH, SNAPSHOT_EXEC_TIME_S, ALL_INIT) Values (396, 2359907137, 1, TO_DATE('02/09/2012 13:32:26', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('01/05/2012 20:33:22', 'MM/DD/YYYY HH24:MI:SS'), 0, 0, 7, 100, 1000, 1000, 10000, 1048576, 20, 1000, 10000, 100, 100, 100, 1000, 1000, 21.92, 'FALSE'); Insert into STATS$SNAPSHOT (SNAP_ID, DBID, INSTANCE_NUMBER, SNAP_TIME, STARTUP_TIME, SESSION_ID, SERIAL#, SNAP_LEVEL, EXECUTIONS_TH, PARSE_CALLS_TH, DISK_READS_TH, BUFFER_GETS_TH, SHARABLE_MEM_TH, VERSION_COUNT_TH, SEG_PHY_READS_TH, SEG_LOG_READS_TH, SEG_BUFF_BUSY_TH, SEG_ROWLOCK_W_TH, SEG_ITL_WAITS_TH, SEG_CR_BKS_RC_TH, SEG_CU_BKS_RC_TH, SNAPSHOT_EXEC_TIME_S, ALL_INIT) Values (397, 2359907137, 1, TO_DATE('02/09/2012 14:02:39', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('01/05/2012 20:33:22', 'MM/DD/YYYY HH24:MI:SS'), 0, 0, 7, 100, 1000, 1000, 10000, 1048576, 20, 1000, 10000, 100, 100, 100, 1000, 1000, 70.49, 'FALSE'); Insert into STATS$SNAPSHOT (SNAP_ID, DBID, INSTANCE_NUMBER, SNAP_TIME, STARTUP_TIME, SESSION_ID, SERIAL#, SNAP_LEVEL, EXECUTIONS_TH, PARSE_CALLS_TH, DISK_READS_TH, BUFFER_GETS_TH, SHARABLE_MEM_TH, VERSION_COUNT_TH, SEG_PHY_READS_TH, SEG_LOG_READS_TH, SEG_BUFF_BUSY_TH, SEG_ROWLOCK_W_TH, SEG_ITL_WAITS_TH, SEG_CR_BKS_RC_TH, SEG_CU_BKS_RC_TH, SNAPSHOT_EXEC_TIME_S, ALL_INIT) Values (398, 2359907137, 1, TO_DATE('02/09/2012 14:35:03', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('01/05/2012 20:33:22', 'MM/DD/YYYY HH24:MI:SS'), 0, 0, 7, 100, 1000, 1000, 10000, 1048576, 20, 1000, 10000, 100, 100, 100, 1000, 1000, 14.28, 'FALSE'); Insert into STATS$SNAPSHOT (SNAP_ID, DBID, INSTANCE_NUMBER, SNAP_TIME, STARTUP_TIME, SESSION_ID, SERIAL#, SNAP_LEVEL, EXECUTIONS_TH, PARSE_CALLS_TH, DISK_READS_TH, BUFFER_GETS_TH, SHARABLE_MEM_TH, VERSION_COUNT_TH, SEG_PHY_READS_TH, SEG_LOG_READS_TH, SEG_BUFF_BUSY_TH, SEG_ROWLOCK_W_TH, SEG_ITL_WAITS_TH, SEG_CR_BKS_RC_TH, SEG_CU_BKS_RC_TH, SNAPSHOT_EXEC_TIME_S, ALL_INIT) Values (399, 2359907137, 1, TO_DATE('02/09/2012 17:02:22', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('02/09/2012 15:24:06', 'MM/DD/YYYY HH24:MI:SS'), 0, 0, 7, 100, 1000, 1000, 10000, 1048576, 20, 1000, 10000, 100, 100, 100, 1000, 1000, 15.92, 'FALSE'); Insert into STATS$SNAPSHOT (SNAP_ID, DBID, INSTANCE_NUMBER, SNAP_TIME, STARTUP_TIME, SESSION_ID, SERIAL#, SNAP_LEVEL, EXECUTIONS_TH, PARSE_CALLS_TH, DISK_READS_TH, BUFFER_GETS_TH, SHARABLE_MEM_TH, VERSION_COUNT_TH, SEG_PHY_READS_TH, SEG_LOG_READS_TH, SEG_BUFF_BUSY_TH, SEG_ROWLOCK_W_TH, SEG_ITL_WAITS_TH, SEG_CR_BKS_RC_TH, SEG_CU_BKS_RC_TH, SNAPSHOT_EXEC_TIME_S, ALL_INIT) Values (400, 2359907137, 1, TO_DATE('02/09/2012 17:32:21', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('02/09/2012 15:24:06', 'MM/DD/YYYY HH24:MI:SS'), 0, 0, 7, 100, 1000, 1000, 10000, 1048576, 20, 1000, 10000, 100, 100, 100, 1000, 1000, 2.77, 'FALSE'); Insert into STATS$SNAPSHOT (SNAP_ID, DBID, INSTANCE_NUMBER, SNAP_TIME, STARTUP_TIME, SESSION_ID, SERIAL#, SNAP_LEVEL, EXECUTIONS_TH, PARSE_CALLS_TH, DISK_READS_TH, BUFFER_GETS_TH, SHARABLE_MEM_TH, VERSION_COUNT_TH, SEG_PHY_READS_TH, SEG_LOG_READS_TH, SEG_BUFF_BUSY_TH, SEG_ROWLOCK_W_TH, SEG_ITL_WAITS_TH, SEG_CR_BKS_RC_TH, SEG_CU_BKS_RC_TH, SNAPSHOT_EXEC_TIME_S, ALL_INIT) Values (401, 2359907137, 1, TO_DATE('02/09/2012 18:02:21', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('02/09/2012 15:24:06', 'MM/DD/YYYY HH24:MI:SS'), 0, 0, 7, 100, 1000, 1000, 10000, 1048576, 20, 1000, 10000, 100, 100, 100, 1000, 1000, 1.72, 'FALSE'); COMMIT;
Hello
Sky13 wrote:
OK I got it to work,I'm glad that you guessed it work. When I tried to run your query later, I got an error. On line 7, I think you meant
when lag(SS.STARTUP_TIME) over (order by SS.SNAP_ID) != SS.STARTUP_TIME then 'YES'
This site do not display the <>inequality operator. When you post here, always use the other, equivalent more!, =.
When I fix it, I don't get 'no rows selected '.but it's ugly! Any ideas on simplification it?
It's a little shorter, but still pretty ugly:
WITH got_wait_time_grp AS ( SELECT snap_id , wait_count , CASE WHEN wait_time_milli <= 7 THEN '<= 7' ELSE '> 7' END AS wait_time_grp FROM stats$event_histogram WHERE event_id = 2652584166 ) , grouped_data AS ( SELECT ss.snap_id , ss.snap_time , eh.wait_time_grp , CASE WHEN ss.startup_time != LAG (ss.startup_time) OVER ( PARTITION BY eh.wait_time_grp ORDER BY ss.snap_id ) THEN 'YES' ELSE 'NO' END AS db_restart , SUM (eh.wait_count) - LAG ( SUM (eh.wait_count) , 1 , 0 ) OVER ( PARTITION BY ss.startup_time , eh.wait_time_grp ORDER BY ss.snap_id ) AS wait_dif , DENSE_RANK () OVER (ORDER BY ss.snap_id) AS dr FROM stats$snapshot ss , got_wait_time_grp eh WHERE ss.snap_id = eh.snap_id AND ss.snap_id BETWEEN 396 AND 401 GROUP BY GROUPING SETS ( (ss.snap_id, ss.snap_time, ss.startup_time, eh.wait_time_grp) , (ss.snap_id, ss.snap_time, ss.startup_time) ) ) SELECT snap_id, snap_time, db_restart , MIN (CASE WHEN wait_time_grp = '<= 7' THEN wait_dif END) AS wait_count_le_7ms , MIN (CASE WHEN wait_time_grp = '> 7' THEN wait_dif END) AS wait_count_gt_7ms , MIN (CASE WHEN wait_time_grp IS NULL THEN wait_dif END) AS total_wait_count , MIN (CASE WHEN wait_time_grp = '<= 7' THEN wait_dif END) * 100 / MIN (CASE WHEN wait_time_grp IS NULL THEN wait_dif END) AS wait_count_percent_le_7ms , MIN (CASE WHEN wait_time_grp = '> 7' THEN wait_dif END) * 100 / MIN (CASE WHEN wait_time_grp IS NULL THEN wait_dif END) AS wait_count_percent_gt_7ms FROM grouped_data WHERE dr > 1 GROUP BY snap_id, snap_time, db_restart ORDER BY snap_id ;
Output:
` WAIT_ WAIT_ WAIT_ WAIT_ COUNT_ COUNT_ DB_ COUNT_ COUNT_ TOTAL_ PERCENT PERCENT SNAP RE LE_ GT_ WAIT_ _LE_ _GT_ _ID SNAP_TIME START 7MS 7MS COUNT 7MS 7MS ---- ------------------- ----- ------- ------- ------- ------- ------- 397 2/9/2012 2:02:39 PM NO 3311 16261 19572 16.92 83.08 398 2/9/2012 2:35:03 PM NO 10040 11499 21539 46.61 53.39 399 2/9/2012 5:02:22 PM YES 111137 113916 225053 49.38 50.62 400 2/9/2012 5:32:21 PM NO 5880 5047 10927 53.81 46.19 401 2/9/2012 6:02:21 PM NO 1342 3004 4346 30.88 69.12
-
Hello
I'm getting out my select query. I can align the colum as output:
Statement:
Select substr(billdate,1,6), speciality, count (*) in the ipbill where billdate > = '20090401' and billdate < = '20090531'
IAM get the result below:
200904 CARDIOLOGY 10
200904 UROLOGY 20
200905 20 CARDIOLOGY
200905 30 UROLOGY
Is it possible to align my output as below, because it will be helpuful for ease of analysis:
200904 200905
10 20 CARDIOLOGY
20 30 UROLOGY
Thank you
SatyaThe number of specialties is flexible, the months are not. These must be in "hard"; for each month, you need to create a column.
What is the result, which means what frontend tool do you use to create this report. Most reporting frontend tools have a function PIVOT (as Excel - Oracle reports etc.)
-
SELECT SQLite statement failed
I've reached the point where I need to crowd source this error.
I try to run the following code:
uri = URI.create("file://" + _optionsData.getStorageURI() + OptionsData.DB_NAME); sqliteDB = DatabaseFactory.open(uri); Statement st = sqliteDB.createStatement("SELECT * FROM foo"); st.prepare(); Cursor c = st.getCursor(); Row r = c.getRow(); int size = r.getInteger(0);
Creates the URI end to the database of opening works very well. The statement is prepared. However, when I get the cursor, it is 'empty', containing no information line or column. c.getRow () returns a NULL reference and the following statement fails with a special Null pointer.
The SQL code has been checked with a SQLite spy program to the same database.
To check that I have all correct on the connection to the database, I changed the code to make an INSERT using st.execute (), and the values inserted in the database. Verified by SQLite Spy.
It will fail in the same way on the 9700 "Bold" standard simulator that comes with the Eclipse plugin and the specific Storm 2 Add-on Verizon Simulator.
Any suggestions?
Solved my problem.
The code snippet, before you start changing things to try to understand what wasn't in question a "SELECT MAX (id) foo" call. Thus, it only returns a single line.
I come from a background of Perl/MySQL, and I didn't know that when you have a line that is returned, you should always call the next() on a cursor before it will be initialized. Therefore, the above code should read as follows:
Statement st = sqliteDB.createStatement("SELECT MAX(id) FROM foo"); st.prepare(); Cursor c = st.getCursor(); if (c.next()){ Row r = c.getRow(); int size = r.getInteger(0); }
When c.next () is called, the cursor is on the first line.
-
Select the statement and the Group of
Hi all
I have this code to display the total number of orders by customer id:
Select customer_id, sum (order_total) total
of demo_orders
Customer_id group;
and it gives me this result:
CUSTOMER_ID TOTAL
----------- ----------
1 2380
2 2370
3 2420
4 1060
5 1090
6 950
7 2760
7 selected lines.
But instead of the ID, I want to display their names, like this:
CUSTOMER TOTAL
Brown, John 3450
... and so on
How do I do that?
I know I can't include these columns concatenated in the selection list, because I would have to be included in the GROUP BY clause...
Thank you.
I know I can't include these columns concatenated in the selection list, because I would have to include it in the
Huh? Why not you. Have you actually tried it?
Just do what you say - include names concatenated in the select group of clauses.
Or you can just join the query you have each other to get the names, since we have no idea where the names are still stored. If they are in the same table as the ID then just use the solution "you know you can't do '!
-
Hide the box operators in Query Advanced Panel mode selection
All HL,
I need to hide all operators in the query Panel Advanced view mode drop-down selection list.
Please help me.
Thank you
Barry Mucheli.
Hi Baro,
There is no command available to hide all operators both, individually, we need to hide the operators
You can follow the links below:
to hide the details:
The Middle Tier: How show/hide operators in advanced mode adf:query
for the operator:
Thank you
Prabhat
-
Internal mechanism behind a "update statement"
Suppose that I published an update statement to change the value of "salary" columns in a table, I does not issue of "committing" again, now when I select the column in my own session, I am able to see the new value, but other users in different sessions can not see the new value for them, I understand that old data is read in the undo tablespace , but for me, the new value source, please explain in detail the inside what is happening behind it.
Thanks in advance.Think of it this way:
No matter who's going to read a block will recover from the buffer cache (if is not in the cache, it must be read from the disk, but you will get it back in the end of the cache).
Now, the rules of consistency Oracle reading means that you can 'see' data that is compatible with the point in time that you are interested in (the snapshot SCN). If the data that you read from the buffer cache are 'too new', then your session automatically restores data in the block, by referencing the undo data. This is known as a coherent mode get, as the buffer is recovered pursuant to a specific point in time, or SNA.
Now, in the case of non-validated data, the transaction is marked as active, so, others Restore automatically, using undo, the previous version of the block. If the session that made the update and still holds the lock (i.e. data only has not yet been validated), Oracle can see that the transaction is the property of the current session and will not restore the data and returns the current data in the data block.
-Mark
-
'Go to the State' vs 'Go to the next State' for the selected button state
I have a series of image galleries in my publication that uses MSOs and buttons to "Go to another" - the thumbnails then have a small edge to have indicated that they are 'selected' - it works very well. The border is added to the click for each thumbnail button state.
I have a similar scenario is a YouTube embed of the video and an article as a MSO with two States: a State is the vid to youtube and the other State is the article of the text. I have a set place button to switch between these two States. This button is set to "Go to the next State" so he'll just between the two States MSO. Is there any way to have a selected State for this button so that the words under the button change to 'play' video in 'see article' while keeping this button set to "Go to the next State" - the only way I can think to do is with two buttons.
I realize, this is a very specific use case and I do not expect the features, but if there is a solution I am curious to know if anyone else has come across this.
Thanks in advance for your help.
Implement for the buttons in the different States. Then add an invisible button on it to the next State meetings.
Bob
-
Selecting correct state in the drop-down list.
Here is my delima. I have a form that gets repopulate when users come back to update their contact information. Name, address, etc. of the State. What I am having a problem with performs their State to be selected from a drop-down list. For example, if I'm from Ohio, so I want Ohio selected in the drop-down list. I don't want the user to have to select again the State if the information has not changed. Here's an example of how it is formatted.
< select tabIndex = "5" name = "State" >
< option value = "" selected = "selected" > < / option > "
< option value = 'AL' > Alabama < / option >
< option value = "AK" > Alaska < / option >
< option value = "AZ" > Arizona < / option >
< option value = "AR" > Arkansas < / option >
< option value = "CA" > California < / option >
< option value = "CO" > Colorado < / option >
Of course, the two-letter abbreviation is written and retrieved from the database.
Everyone works with this before?
Any help/information is appreciated.
BrianHere's how I made this...
Top of the page put
Then, when comes the time to put the list do that...
I hope this helps.
Maybe you are looking for
-
Since the update to iOS 10, I seem not to be able to set default widgets for when I swipe down from the top of the screen. I always receive notifications, and then get hit right swipe. Any help?
-
How to open port 80 and 443, and enable UPNP?
-
Reset to the factory settings without restoration. Why do I see previous contacts?
I have a new 5 iPhone. I added 6 contacts, 2 new downloaded applications. Saved on iCloud and iTunes. I had a very old Apple ID with an email address that I no longer use. I created a new Apple ID online by using this: Change your Apple - Apple Suppo
-
Satellite L40 PSL48L: No noise and Bios Update after installing XP
Hai guys I have a toshiba laptop psl48l-0200u and lowered the score on XP Professional, but realtek audio does not work.At the launch of the facility, there is an error message "realtek audio installation failed. I think that this may have to do some
-
Can not hear sound after you install Internet Explorer 9
Original title: loss of sound I'm trying to get my sound on my PC-, he disappeared after the installation of IE 9. Its still does not not after having started with IE 8. All my drivers audio etc seem to work when I click on the test button. Someone a