Urgent need for sql query
Hi allSorry I can't speak English very well
=======================
I have a table that contains two columns
table name: total_sal
column name: hire_date
column name: salary
table syntax
create table total_sal (hire_date date
number (6.2)) of salary;
_________________________________________
Example of data in table format
hire_date | salary
01/01/2011 | 1000
01/02/2011 | 2000
01/05/2011 | 500
01/09/2011 | 400
I NEED a SQL QUERY to display the table, as in this example
OF | TO|||||||||||| TOTALSALAY
01/01/2011 | 01/02/2011 | 3000
07/05/2011 | 01/09/2011 | 900
|||||||||||||||||||||||||||||||||| 3900
/* Formatted on 9/23/2011 10:14:40 AM (QP5 v5.149.1003.31008) */
WITH t
AS (SELECT TO_DATE ('1/1/2011', 'mm/dd/yyyy') hire_date, 1000 salary
FROM DUAL
UNION
SELECT TO_DATE ('2/1/2011', 'mm/dd/yyyy'), 2000 FROM DUAL
UNION
SELECT TO_DATE ('5/1/2011', 'mm/dd/yyyy'), 500 FROM DUAL
UNION
SELECT TO_DATE ('9/1/2011', 'mm/dd/yyyy'), 400 FROM DUAL)
SELECT "From", "To", totalsalary
FROM (SELECT hire_date "From",
LEAD (hire_date) OVER (ORDER BY hire_date) "To",
salary + LEAD (salary) OVER (ORDER BY hire_date) totalsalary,
ROW_NUMBER () OVER (ORDER BY hire_date) rn
FROM t)
WHERE MOD (rn, 2) = 1
UNION ALL
SELECT NULL, NULL, SUM (salary) FROM t
From To TOTALSALARY
1/1/2011 2/1/2011 3000
5/1/2011 9/1/2011 900
3900
Tags: Database
Similar Questions
-
Need for SQL query to get the result.
Region
Month Trx type Summary of the resolution AMERICAS -13 may Adjustments Fix EMEA -13 may Adjustments Incorrect AMERICAS -13 may Credit memo Incorrect EMEA -13 may Invoice Fix AMERICAS -13 may Credit memo Fix OFD -13 may Adjustments Fix AMERICAS -13 may Invoice Incorrect DVL -13 may Adjustments Fix DVL -13 may Adjustments Fix OFD -13 may Adjustments Fix Above my Table and here is the result required. Similarly for other regions as well. Can someone help me with the SQL query?
Region Summary of the resolution Setting Credit memo Invoice Total general AMERICAS Fix 1 1 2 Incorrect 0 1 1 2 Like this?
SQL > select * from transaction_audit;
MTH TRX_TYPE REGION BOARD
-------- ------ ----------- ---------
AMERICAS-13 may SETTINGS CORRECT
EMEA-13 may INCORRECT ADJUSTMENT
AMERICAS-13 may CREDIT MEMO INCORRECT
EMEA-13 may INVOICE CORRECT
AMERICAS-13 may CREDIT MEMO CORRECT
OFD-13 may SETTINGS CORRECT
AMERICAS-13 may INVOICE INCORRECTE
LAD-13 may SETTINGS CORRECT
LAD-13 may SETTINGS CORRECT
OFD-13 may SETTINGS CORRECT10 selected lines.
SQL > select region
2, resolution_summary
3, count (decode (trx_type, "ADJUSTMENTS", trx_type)) adjustments
4, County (decode (trx_type, 'HAVING', trx_type)) credit_memo
5, County (decode (trx_type, "BILL", trx_type)) Bill
transaction_audit 6
Group 7
8 by region
9, resolution_summary
10 Decree
11 by region
12, resolution_summary
13.REGION TAKE ADJUSTMENTS CREDIT_MEMO INVOICE
-------- --------- ----------- ----------- ----------
CORRECT THE AMERICAS 1 1 0
0 1 1 INCORRECT AMERICAS
EMEA CORRECT 0 0 1
INCORRECT EMEA 1 0 0
DAL ADDRESS 2 0 0
OFD CORRECT 2 0 06 selected lines.
SQL >
-
Need to SQL query to filter records by limited rows and certain condition
Hello guru (s).
I need a SQL query for help.
For an example table t1 as below, I want to find the maximum of 5 larger, but there should be no more than 2 name of the same position. The "BOLD" is the response of desire.
Name Position size
N1 P1 5
N2 P2 50
N3 P3 500
N4 P1 6
N5 P2 60
N6 P3 600
N7 P1 7
N8 P2 70
N9 P3 700
Thank you.not tested!
select name,position,size, from (select name,position,size, row_number() over (order by size desc) a_count from (select name,position,size, row_number() over (partition by position order by size desc) a_count from your_table ) where a_count <= 2 ) where a_count <= 5
Concerning
Etbin
-
Hello
I went through this link:
Ask about the creation and filling I$ table on different condition
But I read in the case of IKM SQL FOR SQL add no I$ table is created.
If this is true please tell me why not I$ is created for this IKM?
So please tell me how the Frother is checked it to Check Knowledge Module (CKM)?
Thank you
Sébastien
PS:
I'm a freshness in tech ODI. So I can fool me please don't bother me1. you need to create a mapping. Next, you need to see the code generated at each stage of all.
Try to analyze it. Then you will have a clear idea.If see vedio carefully as given below, you can find staging area is on the source. So its directly select all the columns in the source tab and the insertion of these value in the tab target. No need to use I$ table. Yet once there is no option of flow_control. You can find the static_control.
http://S3.amazonaws.com/ora/ODI-Simple_SELECT_and_INSERT-interface.swfTo learn more about flow_control and static_control please go through
http://odiexperts.com/flow-control-and-static-control/Thank you.
-
VERY VERY URGENT SOLUTION NEEDED for SQL
Dear Sir.
I have a table structure which is
SQL > fof desc;
Name Null? Type
----------------------------------------- -------- ----------------------------
FOFID NUMBER (12)
PERSONID NUMBER (12)
RELATIONSHIPID NUMBER (2)
FPERSONID NUMBER (12)
RESISTANCE NUMBER (1)
RELATIONSTATE VARCHAR2 (15)
CTIME DATE
UTIME DATE
NUMBER (1) DELETED
EDITEDBY NUMBER (12)
The table has duplicate entries I will explain:
PersonID fpersonid
1 2
2 1
3 4
4 3
I want to keep only the lines with each duplicate entry
fpersonid PersonID and not personid fpersonid
1 2 1 2
2 1
Keep in other words a-> b and remove b-> a
Is there any way geeks can you help I'm ripping my hair thinking about it
Please answer
:(You can use this:
delete fof where a.personid in (select b.fpersonid from fof b where b.personid=a.fpersonid and b.fpersonid=a.personid) and a.fpersonid
Max
[My Italian blog Oracle | http://oracleitalia.wordpress.com/2009/12/31/estrarre-i-dati-in-formato-xml-seconda-parte/] -
Hi friends,
Can someone me posts sub queries SQL:
1 need a query to find locked users and name of the table to each scheme.
2. a query need to know the user using tables in each schema.
Thank you
Lazar T
Hello
1. What do you mean under the user table and it is locked?
2 search for locked objects
SELECT a.sid,a.serial#, a.username,c.os_user_name,a.terminal,
b.object_id,substr(b.object_name,1,40) object_name,sysdate
from v$session a, dba_objects b, v$locked_object c
where a.sid = c.session_id
and b.object_id = c.object_id----
Ramin Hashimzde
-
Hello
I need assistance with SQL... My version of the database is Oracle 10 g Release 1.2.
I have two tables with the same exact structure as follows...
create table t1 (cust_id, number (5), zone_number number (2), part_number varchar2 (10))
create table t2 (cust_id, number (5), zone_number number (2), part_number varchar2 (10))
I need a query that would give me a two count indictment by pairs of customer between t1 and t2...
1. part_number County matches between the same areas in table 1 and table 2 for the pairs of customers
for customer 1 and 10 for zone 1 this total shoulb be 2 because there are two matches part A numbers between 1 and 10 for Zone 1 cust and B.
for customer 1 and 10 for zone 2 this total shoulb be 0 because between 1 and 10 for Zone 2 cust, there is no part number match
for customer 1 and 20 for the zone 1 this total shoulb be 0 because between 1 and 20 for Zone 1 cust, there is no part number match
for 1 client and client 20 zone 2 this total shoulb be 0 because between 1 and 20 to Zone 2 cust is a part number, it's 'F'
for 1 client and client 20 zone 3 of this total shoulb be 0 because there is no zone 3 for client 1
same way
.. Cust 2 and cust 10 zone2 and Zone 1 figures account
.. 2 and cust 20 zones 1, 2 and 3 counts
2. the unique total part nmbers between the same areas for customers in table 1 pairs and the table2
for example
part numbers only between 1 and 10 for zone 1 cust are A, B and C so the count should be 3
part numbers only between 1 and 10 for zone 2 cust are B, F, D, and E the county should be 3
unique piece between 1 and 20 for the zone 1 cust numbers A, B, C and G so the count should be 4
and so on so forth
insert into t1 values (1, 1, 'A')
insert into t1 values (1, 1, 'B')
insert into t1 values (1, 1, "C")
insert into t1 values (1, 2, 'B')
insert into t1 values (1, 2, 'F')
insert into t1 values (1, 2, has ')
insert into t1 values (1, 2, 'E')
insert into t1 values (2, 1, 'F')
insert into t1 values (2, 2, 'G')
insert into t1 values (2, 2, 'H')
insert into t2 values (10, 1, 'A')
insert into t2 values (10, 1, 'B')
insert into t2 values (10, 2, null)
insert into t2 values (20, 1, 'G')
insert into t2 values (20, 2, 'F')
insert into t2 values (20, 2, 'H')
insert into t2 values (20, 3, 'I')
insert into t2 values (20, 3, 'J')
My query result should be as follows...
cust1 cust2 area pn_match_count total_unique_pn_count
1 10 1 2 3
1 10 2 0 4
1 20 1 0 4
1 20 2 1 5
1 20 3 0 2
2 10 1 0 3
2 10 2 0 2
2 20 1 0 2
2 20 2 1 3
2 20 3 0 2
I would appreciate your help in the drafting of this query.
Thanks in advanceOr leave the 'where' clause, so we get each combination of customer:
SQL> with c as 2 (select distinct t1.cust_id cust1, t2.cust_id cust2, t1.zone_number zone, t1.part_number p1, t2.part_number p2 3 from t1, t2 4 where t1.zone_number=t2.zone_number 5 and t1.part_number = t2.part_number 6 union 7 select distinct t1.cust_id cust1, t2.cust_id cust2, t1.zone_number zone, t1.part_number p1, null p2 8 from t1, t2 9 where not exists (select 1 from t2 t02 where t02.zone_number=t1.zone_number 10 and t02.cust_id = t2.cust_id 11 and t02.part_number = t1.part_number) 12 union 13 select distinct t1.cust_id cust1, t2.cust_id cust2, t2.zone_number zone, null p1, t2.part_number p2 14 from t1, t2 15 where not exists (select 1 from t1 t01 where t01.zone_number=t2.zone_number 16 and t01.cust_id = t1.cust_id 17 and part_number = t2.part_number)) 18 select cust1, cust2, zone, sum(decode(p1,p2,1,0)) pn_match_count, count(*) unique_pn_count 19 from c 20 group by cust1, cust2,zone; CUST1 CUST2 ZONE PN_MATCH_COUNT UNIQUE_PN_COUNT ---------- ---------- ---------- -------------- --------------- 1 10 1 2 3 1 10 2 1 5 1 20 1 0 4 1 20 2 1 5 1 20 3 0 2 2 10 1 0 3 2 10 2 1 3 2 20 1 0 2 2 20 2 1 3 2 20 3 0 2 10 rows selected.
-
Need a sql query to get several dates in rows
Hi all
I need a query to get the dates of the last 7 days and each dates must be in a line...
but select sysdate double... gives a line...
Output of expexcted
Dates:
October 1, 2013
30 sep-2013
29 sep-2013
28 sep-2013
27 sep-2013
26 sep-2013
Try:
SQL > SELECT sysdate-7 + LEVEL FROM DUAL
2. CONNECT BY LEVEL<=>=>
3 * ORDER BY 1 DESC
SQL > /.
SYSDATE-LEVEL 7 +.
-----------------------------
October 1, 2013 13:04:52
30 - Sep - 2013 13:04:52
29 - Sep - 2013 13:04:52
28 - Sep - 2013 13:04:52
27 - Sep - 2013 13:04:52
26 - Sep - 2013 13:04:52
25 - Sep - 2013 13:04:52
7 selected lines.
-
Hi all
Required clarification of Oracle sql
Example table:
EmpNo empname mgr_id hire_date deptno salary Job
7788 SCOTT ANALYST 7566 3000 APRIL 19, 87 20
7902 7566 3000 3 DECEMBER ANALYST FORD 81 20
7934 MILLER COMMITTED JANUARY 7782 1300 23 82 10
7900 7698 DECEMBER 3, CLERK JAMES 81 950 30
7369 SMITH COMMITTED 7902 17 DECEMBER 20 800 80
7876 ADAMS 7788 1100 23 MAY CLERK 87 20
Need of ' single / one ' sql for this statement of the obligation:
There will be 2 dropdown boxes (1 - work list, 2nd - empno) in the form in which the next set of results is expected
(1) when the user selects the value of the 1st drop down box (employment) as "ANALYST", leaving the second dropdown not selected, the expected result is 2 (No. lines for this work)
(2) when the user selects the value of the 1st drop-down list (job) as "ANALYST" and the value in the 2nd drop-down box like 7902, the expected result is 1 (no lines for this job and empno)
SQLs I tried on my side (given below) gave the expected result and do please help me fix this
Select count (1) in the scott.emp where job = 'ANALYST' and (empno =: empno or empno is null);
Please help for this requirement. Any help is deeply appreciated.
Thank you
Zakari1007144 wrote:
SQLs I tried on my side (given below) gave the expected result and do please help me fix this
Select count (1) in the scott.emp where job = 'ANALYST' and (empno =: empno or empno is null);
You check "IS NULL" on EMPNO clolumn. You should check on the value passed: EMPNO. It should be
select count(1) from scott.emp where job='ANALYST' and ( empno = :empno or :empno is null ) ;
Published by: JAC on May 21, 2013 19:32
Hope that the: value of EMPLOYMENT is required... -
AWR show this sql as more CPU consuming sql. Is - this need for sql tunning?
Hello
Awr showing this sql as the consumer of CPU above reports
Please consider me as a newbie and help me understand this.
Thanking you...
SQL full = >SQL ordered by CPU Time DB/Inst: Snaps: -> Resources reported for PL/SQL code includes the resources used by all SQL statements called by the code. -> % Total DB Time is the Elapsed Time of the SQL statement divided into the Total Database Time multiplied by 100 CPU Elapsed CPU per % Total Time (s) Time (s) Executions Exec (s) DB Time SQL Id ---------- ---------- ------------ ----------- ------- ------------- 2,658 2,665 1 2658.18 5.7 5aawbyzqjk8by select distinct trp.site_id from tas_receipts_process trp , tas_tsa_info tti, ta s_site ts where trp.tsa_id = tti.tsa_id and tti.status = 1 and ts.site_id = trp .site_id and (tti.max_install != trp.pushed_rsn and ((tti.max_install = 0 and (trp.pushed_rsn - trp.curr_rsn) < ts.workahead_count * :1) or (tti.max_install
get the plan of the explain for the above sql command = >select distinct trp.site_id from tas_receipts_process trp , tas_tsa_info tti, tas_site ts where trp.tsa_id = tti.tsa_id and tti.status = 1 and ts.site_id = trp.site_id and ( tti.max_install != trp.pushed_rsn and ( (tti.max_install = 0 and (trp.pushed_rsn - trp.curr_rsn) < ts.workahead_count * :1 ) or (tti.max_install > 0 and (trp.pushed_rsn - trp.curr_rsn) < ts.workahead_count * :2 ) or (tti.max_install = trp.pushed_rsn and tti.max_install <> 0 ) ) ) or (trp.pushed_time != ( to_date(tti.created_date,'dd-MON-yyhh24:mi:ss') + (1/24/60) * ts.workahead_time ) and ( ( to_date(sysdate,'dd-MON-yyhh24:mi:ss') + (1/24/60) * :3 ) > trp.pushed_time ) )
sizes of the objects concerned = >QL> SELECT plan_table_output FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR('g6c8y31xr06vp',0,'ALL')); PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ SQL_ID g6c8y31xr06vp, child number 0 ------------------------------------- select distinct trp.site_id from tas_receipts_process trp , tas_tsa_info tti, tas_site ts where trp.tsa_id = tti.tsa_id and tti.status = 1 and ts.site_id = trp.site_id and (tti.max_install != trp.pushed_rsn and ((tti.max_install = 0 and (trp.pushed_rsn - trp.curr_rsn) < ts.workahead_count * :1) or (tti.max_install > 0 and (trp.pushed_rsn - trp.curr_rsn) < ts.workahead_count * :2) or (tti.max_install = trp.pushed_rsn and tti.max_install <> 0 ) )) or (trp.pushed_time != (to_date(tti.created_date,'dd-MON-yy hh24:mi:ss') + (1/24/60) * ts.workahead_time) and ((to_date(sysdate,'dd-MON-yy hh24:mi:ss') + (1/24/60) * :3) > trp.pushed_time)) Plan hash value: 2862358316 ------------------------------------------------------------------------------------------------ | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ------------------------------------------------------------------------------------------------ | 0 | SELECT STATEMENT | | | | 601K(100)| | | 1 | HASH UNIQUE | | 4 | 216 | 601K (10)| 02:00:14 | | 2 | CONCATENATION | | | | | | | 3 | NESTED LOOPS | | 200M| 10G| 579K (6)| 01:55:52 | | 4 | MERGE JOIN CARTESIAN| | 2849 | 99715 | 12 (0)| 00:00:01 | | 5 | TABLE ACCESS FULL | TAS_SITE | 7 | 70 | 3 (0)| 00:00:01 | | 6 | BUFFER SORT | | 407 | 10175 | 9 (0)| 00:00:01 | |* 7 | TABLE ACCESS FULL | TAS_RECEIPTS_PROCESS | 407 | 10175 | 1 (0)| 00:00:01 | |* 8 | TABLE ACCESS FULL | TAS_TSA_INFO | 70411 | 1306K| 203 (6)| 00:00:03 | |* 9 | HASH JOIN | | 2 | 108 | 203 (2)| 00:00:03 | |* 10 | HASH JOIN | | 407 | 14245 | 7 (15)| 00:00:01 | | 11 | TABLE ACCESS FULL | TAS_SITE | 7 | 70 | 3 (0)| 00:00:01 | | 12 | TABLE ACCESS FULL | TAS_RECEIPTS_PROCESS | 407 | 10175 | 3 (0)| 00:00:01 | |* 13 | TABLE ACCESS FULL | TAS_TSA_INFO | 21474 | 398K| 196 (2)| 00:00:03 | ------------------------------------------------------------------------------------------------ Query Block Name / Object Alias (identified by operation id): ------------------------------------------------------------- 1 - SEL$1 5 - SEL$1_1 / TS@SEL$1 7 - SEL$1_1 / TRP@SEL$1 8 - SEL$1_1 / TTI@SEL$1 11 - SEL$1_2 / TS@SEL$1_2 12 - SEL$1_2 / TRP@SEL$1_2 13 - SEL$1_2 / TTI@SEL$1_2 Predicate Information (identified by operation id): --------------------------------------------------- 7 - filter("TRP"."PUSHED_TIME"<TO_DATE(TO_CHAR(SYSDATE@!),'dd-MON-yy hh24:mi:ss')+.000694444444444444444444444444444444444445*:3) 8 - filter("TRP"."PUSHED_TIME"<>TO_DATE(INTERNAL_FUNCTION("TTI"."CREATED_DATE"),'dd-M ON-yy hh24:mi:ss')+.000694444444444444444444444444444444444445*"TS"."WORKAHEAD_TIME") 9 - access("TRP"."TSA_ID"="TTI"."TSA_ID") filter(("TTI"."MAX_INSTALL"<>"TRP"."PUSHED_RSN" AND (("TTI"."MAX_INSTALL"=0 AND "TRP"."PUSHED_RSN"-"TRP"."CURR_RSN"<"TS"."WORKAHEAD_COUNT"*:1) OR ("TTI"."MAX_INSTALL">0 AND "TRP"."PUSHED_RSN"-"TRP"."CURR_RSN"<"TS"."WORKAHEAD_COUNT"*:2 ) OR ("TTI"."MAX_INSTALL"="TRP"."PUSHED_RSN" AND "TTI"."MAX_INSTALL"<>0)) AND (LNNVL("TRP"."PUSHED_TIME"<TO_DATE(TO_CHAR(SYSDATE@!),'dd-MON-yy hh24:mi:ss')+.000694444444444444444444444444444444444445*:3) OR LNNVL("TRP"."PUSHED_TIME"<>TO_DATE(INTERNAL_FUNCTION("TTI"."CREATED_DATE"),'dd-MON-yy hh24:mi:ss')+.000694444444444444444444444444444444444445*"TS"."WORKAHEAD_TIME")))) 10 - access("TS"."SITE_ID"="TRP"."SITE_ID") 13 - filter("TTI"."STATUS"=1) Column Projection Information (identified by operation id): ----------------------------------------------------------- 1 - "TRP"."SITE_ID"[NUMBER,22] 2 - "TS"."SITE_ID"[NUMBER,22], "TS"."WORKAHEAD_COUNT"[NUMBER,22], "TS"."WORKAHEAD_TIME"[NUMBER,22], "TRP"."TSA_ID"[NUMBER,22], "TRP"."SITE_ID"[NUMBER,22], "TRP"."CURR_RSN"[NUMBER,22], "TRP"."PUSHED_RSN"[NUMBER,22], "TRP"."PUSHED_TIME"[DATE,7], "TTI"."TSA_ID"[NUMBER,22], "TTI"."STATUS"[NUMBER,22], "TTI"."MAX_INSTALL"[NUMBER,22], "TTI"."CREATED_DATE"[DATE,7] 3 - "TS"."SITE_ID"[NUMBER,22], "TS"."WORKAHEAD_COUNT"[NUMBER,22], "TS"."WORKAHEAD_TIME"[NUMBER,22], "TRP"."TSA_ID"[NUMBER,22], "TRP"."SITE_ID"[NUMBER,22], "TRP"."CURR_RSN"[NUMBER,22], "TRP"."PUSHED_RSN"[NUMBER,22], "TRP"."PUSHED_TIME"[DATE,7], "TTI"."TSA_ID"[NUMBER,22], "TTI"."STATUS"[NUMBER,22], "TTI"."MAX_INSTALL"[NUMBER,22], "TTI"."CREATED_DATE"[DATE,7] 4 - "TS"."SITE_ID"[NUMBER,22], "TS"."WORKAHEAD_COUNT"[NUMBER,22], "TS"."WORKAHEAD_TIME"[NUMBER,22], "TRP"."TSA_ID"[NUMBER,22], "TRP"."SITE_ID"[NUMBER,22], "TRP"."CURR_RSN"[NUMBER,22], "TRP"."PUSHED_RSN"[NUMBER,22], "TRP"."PUSHED_TIME"[DATE,7] 5 - "TS"."SITE_ID"[NUMBER,22], "TS"."WORKAHEAD_COUNT"[NUMBER,22], "TS"."WORKAHEAD_TIME"[NUMBER,22] 6 - (#keys=0) "TRP"."TSA_ID"[NUMBER,22], "TRP"."SITE_ID"[NUMBER,22], "TRP"."CURR_RSN"[NUMBER,22], "TRP"."PUSHED_RSN"[NUMBER,22], "TRP"."PUSHED_TIME"[DATE,7] 7 - "TRP"."TSA_ID"[NUMBER,22], "TRP"."SITE_ID"[NUMBER,22], "TRP"."CURR_RSN"[NUMBER,22], "TRP"."PUSHED_RSN"[NUMBER,22], "TRP"."PUSHED_TIME"[DATE,7] 8 - "TTI"."TSA_ID"[NUMBER,22], "TTI"."STATUS"[NUMBER,22], "TTI"."MAX_INSTALL"[NUMBER,22], "TTI"."CREATED_DATE"[DATE,7] 9 - (#keys=1) "TRP"."TSA_ID"[NUMBER,22], "TTI"."TSA_ID"[NUMBER,22], "TS"."SITE_ID"[NUMBER,22], "TRP"."SITE_ID"[NUMBER,22], "TS"."WORKAHEAD_TIME"[NUMBER,22], "TS"."WORKAHEAD_COUNT"[NUMBER,22], "TRP"."PUSHED_RSN"[NUMBER,22], "TRP"."PUSHED_TIME"[DATE,7], "TRP"."CURR_RSN"[NUMBER,22], "TTI"."CREATED_DATE"[DATE,7], "TTI"."STATUS"[NUMBER,22], "TTI"."MAX_INSTALL"[NUMBER,22] 10 - (#keys=1) "TS"."SITE_ID"[NUMBER,22], "TRP"."SITE_ID"[NUMBER,22], "TS"."WORKAHEAD_TIME"[NUMBER,22], "TS"."WORKAHEAD_COUNT"[NUMBER,22], "TRP"."TSA_ID"[NUMBER,22], "TRP"."PUSHED_TIME"[DATE,7], "TRP"."CURR_RSN"[NUMBER,22], "TRP"."PUSHED_RSN"[NUMBER,22] 11 - "TS"."SITE_ID"[NUMBER,22], "TS"."WORKAHEAD_COUNT"[NUMBER,22], "TS"."WORKAHEAD_TIME"[NUMBER,22] 12 - "TRP"."TSA_ID"[NUMBER,22], "TRP"."SITE_ID"[NUMBER,22], "TRP"."CURR_RSN"[NUMBER,22], "TRP"."PUSHED_RSN"[NUMBER,22], "TRP"."PUSHED_TIME"[DATE,7] 13 - "TTI"."TSA_ID"[NUMBER,22], "TTI"."STATUS"[NUMBER,22], "TTI"."MAX_INSTALL"[NUMBER,22], "TTI"."CREATED_DATE"[DATE,7] 105 rows selected.
Please suggest how to tune this above SQLOWNER SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME EXTENTS BYTES_ --------------- ------------------------------ -------------------- -------------------- ------- ---------------- AZD_SCHM TAS_TSA_INFO TABLE TATSU_DATA_TS 22 7,340,032 AZD_SCHM TAS_TSA_INFO_PK INDEX TATSU_DATA_TS 17 2,097,152 --------------- ------------------------------ -------------------- -------------------- ------- ---------------- AZD_SCHM TAS_RECEIPTS_PROCESS TABLE TATSU_DATA_TS 1 65,536 AZD_SCHM TAS_RECEIPTS_PROCESS_IDX INDEX TATSU_INDEX_TS 1 65,536 --------------- ------------------------------ -------------------- -------------------- ------- ---------------- AZD_SCHM TAS_SITE TABLE TATSU_DATA_TS 1 65,536 AZD_SCHM TAS_SITE_NAME_UNQ INDEX TATSU_INDEX_TS 1 65,536 AZD_SCHM TAS_SITE_PK INDEX TATSU_DATA_TS 1 65,536 --------------- ------------------------------ -------------------- -------------------- ------- ----------------
Above sql plan looks good
Any comment and help is appreciated highely.
Thank you and best regards,
IVWHello
It is a production system?
Are you a license to use the AWR?concerning
Alan
-
Very interesting problem, urgent need for resolution
Hi guys,.
I have weird and interesting problem I repair emergency. Appreciate any help you guys can provide.
I have a query that is running in all our database but Prod. Our UAT is updated every fortnight by Prod, so I'm sure it's not a data problem. I even tried for very small dataset making sure to select the same data in UAT and Prod.
Error:
ORA-00932: inconsistent data types: expected NUMBER obtained -
Query:
If we remove outermost connect, it works so not a problem of xmlelement as well. Any idea?select level ,--works if we reomve this xmlelement("L1", XMLATTRIBUTES(resource_name as "L1" ,resource_id as "p_resource_id",resource_manager_id as "p_rm_id",FTE, project_hrs , misc_hrs , total_hrs, avg_tot_hrs, Perc_utilization)) from ( SELECT resource_id, resource_name, resource_manager_id, trim(to_char(round(SUM (FTE),1), '999,999,999,999.9')) FTE, trim(to_char(round(SUM (project_hrs),1), '999,999,999,999.9')) project_hrs, trim(to_char(round(SUM (misc_hrs),1), '999,999,999,999.9')) misc_hrs, trim(to_char(round(SUM (total_hrs),1), '999,999,999,999.9')) total_hrs, trim(to_char(round(SUM (total_hrs)/decode(SUM (FTE),0,1,SUM (FTE)),1), '999,999,999,999.9')) avg_tot_hrs, trim(to_char(ROUND (SUM (project_hrs) * 100 / decode(SUM (expected_project_hrs),0,1,SUM (expected_project_hrs)), 1), '999,999,999,999.9')) perc_utilization FROM ( SELECT CONNECT_BY_ROOT resource_name AS resource_name, CONNECT_BY_ROOT resource_id AS resource_id, CONNECT_BY_ROOT resource_manager_id AS resource_manager_id, employee_type_code, FTE, project_hrs, misc_hrs, total_hrs, avg_tot_hrs, expected_project_hrs FROM ( SELECT r.username resource_name, resource_id, resource_manager_id, employee_type_code, fte, project_hrs, misc_hrs, total_hrs, avg_tot_hrs, expected_project_hrs FROM TIME_UTILILIZ_ORG_SUM_L3M_MV r START WITH resource_id = 129523 CONNECT BY PRIOR r.resource_id = r.resource_manager_id) CONNECT BY PRIOR resource_id = resource_manager_id) GROUP BY resource_id, resource_name, resource_manager_id) start with resource_id =129523 connect by prior resource_id=resource_manager_id; --works if we remove this
Published by: 783830 on July 22, 2010 06:58I don't know if this will help, but:
with my_tab as (select 1 resource_id, 0 resource_manager_id, 1 project_hrs from dual union all select 2 resource_id, 1 resource_manager_id, 1 project_hrs from dual union all select 3 resource_id, 1 resource_manager_id, 1 project_hrs from dual union all select 4 resource_id, 2 resource_manager_id, 1 project_hrs from dual union all select 5 resource_id, 2 resource_manager_id, 1 project_hrs from dual union all select 6 resource_id, 0 resource_manager_id, 2 project_hrs from dual union all select 7 resource_id, 6 resource_manager_id, 2 project_hrs from dual union all select 8 resource_id, 7 resource_manager_id, 2 project_hrs from dual), --- end of mimicking some data results as (select resource_id, project_hrs, prior resource_id prev_resource_id, level lvl, sum(project_hrs) over (partition by connect_by_root (resource_id)) tot_project_hrs from my_tab connect by prior resource_id = resource_manager_id), results2 as (select resource_id, connect_by_root resource_id top_resource_id, project_hrs, prior resource_id prev_resource_id, level lvl from my_tab connect by prior resource_id = resource_manager_id start with resource_manager_id = 0) select r1.resource_id, r1.project_hrs, r1.tot_project_hrs, r2.top_resource_id, r2.prev_resource_id, r2.lvl from results r1, results2 r2 where r1.resource_id = r2.resource_id and r1.lvl = 1 order by resource_id; RESOURCE_ID PROJECT_HRS TOT_PROJECT_HRS TOP_RESOURCE_ID PREV_RESOURCE_ID LVL ----------- ----------- --------------- --------------- ---------------- ---------- 1 1 5 1 1 2 1 3 1 1 2 3 1 1 1 1 2 4 1 1 1 2 3 5 1 1 1 2 3 6 2 6 6 1 7 2 4 6 6 2 8 2 2 6 7 3
-
Hello
I am trying to query data in my database to do the following...
' Create a query to show all members of the staff who were working on a Monday and worked for more than 86 weeks.
I did the following and it works...
SELECT employe_id, Employee_Name, Hire_Date
The EMPLOYEE
WHERE months_between(sysdate,Hire_Date) > 12 * 1.52;
The query returns all that was necessarily over 86 weeks.
What I would do, is to understand Monday in the query, but I don't know how to do this.
Could someone help?-Try this:
SELECT employe_id, Employee_Name, Hire_Date
The EMPLOYEE
WHERE months_between(sysdate,Hire_Date) > 12 * 1.52
and to_char (hire_date, 'fmDAY') = 'MONDAY ';Published by: P@K on April 14, 2009 18:26
-
Help urgently needed for the transmission of FM/RDS
I develop a VI to transmit FM/RDS signals using 2920 USRP project last year, and the deadline to submit soon to the VI. I bought the kit FM/RDS, but I'm running into very few problems. I am aware that the FM/RDS Toolbox is designed for RFSG devices, but I'm working on the migration of the screw of the example provided to work on the USRP.
I tried two approaches: the first approach uses the FM/RDS VI tools provided by the box example, and another approach integrates the example VI (only RDS features) with a VI of 'work' to transmit FM signals (takes a file input audio .wav - what is required by my project).
FM transmission:
(1) in the examlpe VI to transmit the signals FM/RDS tools provided by the box, I can not understand how/where at the entrance of my own audio file to the FM transmitter block (instead of the number of FM tones)
(2) where it is not possible to transmit my own audio file using the VI example, how can I integrate the two transmission FM VI I acquired of the forum with the last example VI (outputs have different types: 'Message Signal' vs "niFM SG session")
RDS transmission:
(1) how can I configure RDS block (niFM SG configure RDS groups 2A and 0 b VI) to correctly transmit RDS? --including the frequency of PI and deviation call letters.
Please note that I live outside the United States (in Lebanon) and apparently the IP call letters are designed only for the US?
I've attached a snapshot of the VI where I worked on. It shows how I integrated the example VI and VI of the FM FM/RDS only. Any assistance on all issues is very much appreciated.
Thank you very much!
-
BlackBerry smartphones urgent needs for assistance to 8707G - able facebook and gmail?
Here is a link to Pockmac, there is a download link.
http://NA.BlackBerry.com/eng/services/desktop/Mac.jsp
Watch for the Desktop Manager for Mac come out, you'll like it much better, and on this same page is link to be emailed updates on this version.
-
Hi all
CREATE TABLE PXX_CUST_TABLE
(NUMBER OF PERSON_ID,
DATE OF DATE_START,
DATE OF DATE_END,
ATTRIBUTE1 VARCHAR2 (30),
ATTRIBUT2 VARCHAR2 (30),
ATTRIBUT3 VARCHAR2 (30))
Insert into PXX_CUST_TABLE
(PERSON_ID, DATE_START, DATE_END, ATTRIBUT1, ATTRIBUT2, ATTRIBUT3)
Values
(3619, TO_DATE (1 JULY 2015 00:00:00 ',' ' HH24:MI:SS JJ/MM/AAAA), TO_DATE (27 JULY 2015 00:00:00 ',' MM/DD/YYYY HH24:MI:SS'), ' 2015/07/12 00:00:00 ', ' 2015/07/13 00:00:00 ', ' 2015-07-14 00:00:00 ');
Insert into PXX_CUST_TABLE
(PERSON_ID, DATE_START, DATE_END, ATTRIBUT1, ATTRIBUT2, ATTRIBUT3)
Values
(3619, TO_DATE (1 JULY 2015 00:00:00 ',' ' HH24:MI:SS JJ/MM/AAAA), TO_DATE (JULY 30, 2015 00:00:00 ',' MM/DD/YYYY HH24:MI:SS'), ' 2015/07/01 00:00:00 ', ' 2015/07/05 00:00:00 ', ' 2015/07/07 00:00:00 ');
Insert into PXX_CUST_TABLE
(PERSON_ID, DATE_START, DATE_END, ATTRIBUT1, ATTRIBUT2, ATTRIBUT3)
Values
(3619, TO_DATE (AUGUST 1, 2015 00:00:00 ',' ' HH24:MI:SS JJ/MM/AAAA), TO_DATE (AUGUST 22, 2015 00:00:00 ',' MM/DD/YYYY HH24:MI:SS'), ' 2015/08/01 00:00:00 ', ' 2015/08/02 00:00:00 ', ' 2015-08-09 00:00:00 ')
Insert into PXX_CUST_TABLE
(PERSON_ID, DATE_START, DATE_END, ATTRIBUT1, ATTRIBUT2, ATTRIBUT3)
Values
(3619, TO_DATE (AUGUST 1, 2015 00:00:00 ',' ' HH24:MI:SS JJ/MM/AAAA), TO_DATE (AUGUST 29, 2015 00:00:00 ',' MM/DD/YYYY HH24:MI:SS'), ' 2015/08/03 00:00:00 ', ' 08/2015/04 00:00:00 ', ' 2015/08/05 00:00:00 ');
COMMIT;
SELECT * FROM PXX_CUST_TABLE
PERSON_ID DATE_START, DATE_END ATTRIBUTE1 ATTRIBUT2 ATTRIBUT3
3619 12/07/2015 27/07/2015 2015/07/01 00:00:00 00:00:13 / 07/2015 00 2015-07-14 00:00:00
3619 01/07/2015 30/07/2015 2015/07/01 00:00:00 00:00:05 / 07/2015 00 2015/07/07 00:00:00
3619 01/08/2015 22/08/2015 2015/08/01 00:00:00 00:00:02 / 08/2015 00 2015-08-09 00:00:00
3619 03/08/2015 29/08/2015 2015/08/01 00:00:00 00:00:04 / 08/2015 00 2015/08/05 00:00:00
Requirement:
You want to count the dates (attributes) only if the parameter falls between date_start and date_end.
Tested:
Select sum (attribut1, attribut2 + attribut3) Total_days
Of
(
Select
person_id, date_start, date_end,
-CHECK WITH THE CASE IF THE DATES OF THE ATTRIBUTE HAS ENTERED FALLS DATES IN THE GIVEN INTERVAL
cases where TO_DATE (SUBSTR (attribute1, 1, 10), ' YYYY/MM/DD') between TO_DATE('27-JUL-2015') AND TO_DATE('10-SEP-2015') then 1 end attribute1
case when TO_DATE (SUBSTR (attribute2, 1, 10), ' YYYY/MM/DD') between TO_DATE('27-JUL-2015') AND TO_DATE('10-SEP-2015') then 1 end attribut2
case when TO_DATE (SUBSTR (attribute3, 1, 10), ' YYYY/MM/DD') between TO_DATE('27-JUL-2015') AND TO_DATE('10-SEP-2015') then 1 end attribut3
-Intended for don't check unique records
Of
PXX_CUST_TABLE
where DATE_START BETWEEN TO_DATE('27-JUL-2015') AND TO_DATE('10-SEP-2015')
and DATE_END BETWEEN TO_DATE('27-JUL-2015') AND TO_DATE('10-SEP-2015')
)
Output:
Total_days
6
Output must be 5 as date "01/08/2015 ' is twice as much."
Please suggest.
Kind regards
Afzal.
with
pxx_cust_table as
(select 3619 person_id, to_date('07/01/2015','mm/dd/yyyy') date_start, to_date('07/27/2015','mm/dd/yyyy') date_end, to_date('2015/07/12','yyyy/mm/dd') attribute1, attribute2, to_date('2015/07/14','yyyy/mm/dd') attribut3 of all to_date('2015/07/13','yyyy/mm/dd') the double union)
Select 3619, to_date (' 07/01/2015 ',' mm/dd/yyyy'), to_date (' 07/30/2015 ',' mm/dd/yyyy'), to_date('2015/07/01','yyyy/mm/dd'), to_date('2015/07/05','yyyy/mm/dd'), to_date('2015/07/07','yyyy/mm/dd') in all the double union
Select 3619, to_date (' 01/08/2015 ',' mm/dd/yyyy'), to_date (' 08/22/2015 ',' mm/dd/yyyy'), to_date('2015/08/01','yyyy/mm/dd'), to_date('2015/08/02','yyyy/mm/dd'), to_date('2015/08/09','yyyy/mm/dd') in all the double union
Select 3619, to_date('08/01/2015','mm/dd/yyyy'), to_date('08/29/2015','mm/dd/yyyy'), to_date('2015/08/01','yyyy/mm/dd'), to_date('2015/08/04','yyyy/mm/dd'), double to_date('2015/08/05','yyyy/mm/dd')
)
Select person_id, count (distinct attribute_value) count_distinct
(select person_id, attribute_name and attribute_value
of pxx_cust_table
UNPIVOT (attribute_name attribute_value in (attribut1 1, attribut2 as 2, attribut3 3))
)
where attribute_value between date "2015-07-27' and the date ' 2015-09-10. '"
Person_id group
PERSON_ID COUNT_DISTINCT 3619 5 Concerning
Etbin
Maybe you are looking for
-
Database does not connect LV2014
Hi all Sorry I'm new to databases, but I spent the day trying to get LabVIEW 2014 to connect to a database from Microsoft Access 2013. I tried a .mdb and .accdb but no work. I tried to do a udl but it was 64-bit and would not load, I tried the fix on
-
How can I create a loop with delays in the series?
Hi all So I wrote a Labview program to control both machines. Very simply, one is a source of tension, and the other is a Lock-In amplifier. What I want to do is change the applied voltage, wait a few seconds for the response of GARLIC to settle, the
-
After that I deleted a playlist, they still appear on my Fuze
The "rocket" is in MSC mode, I use .m3u playlists and playlists that I deleted (am entered and removed the .m3u file) are always shown as empty playlists on my screen of playlist on the "rocket". is it possible to fix this?
-
I have several versions of Visual c ++ installed and my question is can I uninstall the 2005 and 2008 versions and keep 2010? I don't have a programmer or developer so should I keep older versions? is the latest version of backward compatibility and
-
The bloody sound issue with XP (DV7-2000 series)
OK, if someone has managed to get IDT Audio Codec 100% functional under Windows XP? 100%, I mean:-work the three speakers-headhones jack sound-cut the touch button turns on properly It's the box of dirty work, or nothing but box works... sp41398 - is