SQL Query to check which datafiles have AutoExtend on?
I want to turn autoextend off on almost all my datafiles(obviously not on system). Using the Java Enterprise Manager you can visually see which datafiles have autoextend on. I'd prefer to find out using sqlplus which files have autoextend on so I can script turning it off. I don't see it in the v$tablespace or v$datafile views.. Where can i find this??
Paul
Hi,
1* select substr(file_name,1,50), AUTOEXTENSIBLE from dba_data_files
SQL> /
SUBSTR(FILE_NAME,1,50) AUT
/data/ora/H89UCBAC/u05/system/system01.dbf YES
/data/ora/H89UCBAC/u05/rbs/psundots01.dbf YES
/data/ora/H89UCBAC/u01/psdefault/psdefault.dbf NO
/data/ora/H89UCBAC/u01/aaapp/aaapp.dbf NO
/data/ora/H89UCBAC/u01/aalarge/aalarge.dbf NO
/data/ora/H89UCBAC/u01/adapp/adapp.dbf NO
/data/ora/H89UCBAC/u01/amapp/amapp.dbf NO
/data/ora/H89UCBAC/u01/avapp/avapp.dbf NO
/data/ora/H89UCBAC/u01/bdapp/bdapp.dbf NO
/data/ora/H89UCBAC/u01/bnapp/bnapp.dbf NO
/data/ora/H89UCBAC/u01/bnlarge/bnlarge.dbf NO
...Nicolas.
Similar Messages
-
I want SQL query to check if any of our important concurrent programs
I want a sql query to check if any of our important concurrent programs are currently scheduled or not
SinghP wrote:
I want a sql query to check if any of our important concurrent programs are currently scheduled or notThat's nice,
What scheduling tool are you using? are you referring to dbms_job?
what version of Oracle are you using? are you using some custom job management system that involves writing to user created tables in your database? -
SQL query to know which users are working on which forms in APPS R12
Dear gurus
We need the SQL query to know which users are working on which forms in APPS R12, and how to get the user.name of those records.
thanks in advance
best regardsHi,
Please see this thread.
USERS CONNECTED
Re: USERS CONNECTED
Regards,
Hussein -
SQL Query to check window firewalls ports
Hi All,
I am looking for a sql query like below to check inbound sql ports opened in window firewall.
Below query display all firewall ports but my requirement is to display ports opened related to sql server.
EXECUTE [master].[dbo].[xp_cmdshell] 'netsh advfirewall firewall show rule name=any |find "sql"'
Thanks,
Nani.
NBTo find the answer, you would first find which ports that are "SQL ports", and this you can find by looking in the errorlog or the registry for each instance if you want to do it programmatically.
To check Windows firewall programmatically, I have no idea, and it is definitely not a question for an SQL Server forum. Find the suitable Windows forum.
And, no, there is no SQL query you can write to do this. But Powershell may work.
Erland Sommarskog, SQL Server MVP, [email protected] -
Need the SQL Query to check SQL time zone and change the time zone
Hi All,
I am using SQL Server 2008 SP2. My Ex SQL Admin said that the data which we query from our database gives the output in London time.
But the SQL server is located in USA and is having US time.
I would like to know how to find what time zone is the SQL application running on and how to change it ?
Is there any query which i can use to determine and change the time zone ?
Gautam.75801Refer the below two links
http://blog.sqlauthority.com/2014/02/15/sql-server-get-current-timezone-name-in-sql-server/
Check this link
http://dba.stackexchange.com/questions/39421/how-to-handle-timezone-properly-in-sql-server
SELECT [DateTimeUtil].[UDF_ConvertLocalToLocalByTimezoneIdentifier] (
'GMT Standard Time', -- the original timezone in which your datetime is stored
'Middle East Standard Time', -- the target timezone for your user
'2014-03-30 01:55:00' -- the original datetime you want to convert
--Prashanth -
SQL query to check continious records
With T1 As ( SELECT ‘E1’ as E ,1100 as T , 15.0787 as SM1 , 16.1345 as EM1 from dual union all
SELECT ‘E1’ ,1100 , 16.084 , 18.045 from dual union all
SELECT ‘E2’ ,1100 , 15.0787 , 16.1345 from dual union all
SELECT ‘E2’ ,1100 , 15.0327 , 18.045 from dual union all
SELECT ‘E3’ ,1100 , 15.0197 , 16.1445 from dual union all
SELECT ‘E3’ ,1100 , 16.1445 , 18.045 from dual union all
SELECT ‘E4’ ,1100 , 13.0787 , 14.0743 from dual union all
SELECT ‘E4’ ,1100 , 14.0743 , 34.0843 from dual union all
SELECT ‘E4’ ,1100 , 34.0843 , 54.0743 from
SELECT ‘E4’ ,1110 , 13.0787 , 14.0743 from dual union all
SELECT ‘E4’ ,1110 , 14.0743 , 34.0843 from dual union all
SELECT ‘E4’ ,1110 , 34.0843 , 54.0743 from union all
SELECT ‘E1’ ,1100 , 19.084 , 20.045 from )
Main Output should be come as
E1 1100 15.0787 18.045
E2 1100 15.0787 16.1345
E2 1100 15.0327 18.045
E3 1100 15.0197 18.045
E4 1100 13.0787 54.0743
E4 1110 13.0787 54.0743
E1 1100 19.084 20.045
could you help me with an sql to get the first output ?
Logic to derive the above output:
For a particular set of E and T as long as the EM1 of previous record <=SM1 of next record and SM1 of previous record < = SM2 of next record then consider it as a continious record. So record will become for this set
‘E1’ 1100 15.0787 16.1345
‘E1’ ,1100 , 16.084 , 18.045
temporary Output wll be : E1 1100 15.0787 18.045Hi,
user5698021 wrote:
With T1 As ( SELECT ‘E1’ as E ,1100 as T , 15.0787 as SM1 , 16.1345 as EM1 from dual union all
SELECT ‘E1’ ,1100 , 16.084 , 18.045 from dual union all
SELECT ‘E2’ ,1100 , 15.0787 , 16.1345 from dual union all
SELECT ‘E2’ ,1100 , 15.0327 , 18.045 from dual union all
SELECT ‘E3’ ,1100 , 15.0197 , 16.1445 from dual union all
SELECT ‘E3’ ,1100 , 16.1445 , 18.045 from dual union all
SELECT ‘E4’ ,1100 , 13.0787 , 14.0743 from dual union all
SELECT ‘E4’ ,1100 , 14.0743 , 34.0843 from dual union all
SELECT ‘E4’ ,1100 , 34.0843 , 54.0743 from
SELECT ‘E4’ ,1110 , 13.0787 , 14.0743 from dual union all
SELECT ‘E4’ ,1110 , 14.0743 , 34.0843 from dual union all
SELECT ‘E4’ ,1110 , 34.0843 , 54.0743 from union all
SELECT ‘E1’ ,1100 , 19.084 , 20.045 from )Thanks for posting this. Please test (and, if necessary, correct) your code before you post it. The code above has syntax errors.
Use only straight single-quotes (CHR (39)) around string literals. That is, don't say:
SELECT ‘E1’ , ...instead, say:
SELECT 'E1' , ...
Main Output should be come as
E1 1100 15.0787 18.045
E2 1100 15.0787 16.1345
E2 1100 15.0327 18.045
E3 1100 15.0197 18.045
E4 1100 13.0787 54.0743
E4 1110 13.0787 54.0743
E1 1100 19.084 20.045
could you help me with an sql to get the first output ?
Logic to derive the above output:
For a particular set of E and T as long as the EM1 of previous record <=SM1 of next record and SM1 of previous record < = SM2 of next record What is sm2?
then consider it as a continious record. So record will become for this setWhat does "previous" mean in this case? If you look at 2 rows, how can you tell which comes first? Remember, there is no built-in order to rows in a relational database. Are there other significant columns in the table that you haven't shown?
‘E1’ 1100 15.0787 16.1345
‘E1’ ,1100 , 16.084 , 18.045
temporary Output wll be : E1 1100 15.0787 18.045You can use LEAD or LAG to see when a new group starts, creating a new column with 0 or 1. Use the analytic SUM function on that column to see how many groups have already begun, and then GROUP BY that number; something like this:
WITH got_grp_start AS
SELECT e, t, sm1, em1
, order_col
, CASE
WHEN e = LAG (e) OVER (ORDER BY order_col)
AND t = LAG (t) OVER (ORDER BY order_col)
AND sm1 BETWEEN LAG (sm1) OVER (ORDER BY order_col)
AND LAG (em1) OVER (ORDER BY order_col)
THEN 0
ELSE 1
END AS grp_start
FROM t1
, got_grp AS
SELECT e, t, sm1, em1
, SUM (grp_start) OVER (ORDER BY order_col) AS grp
FROM got_grp_start
SELECT e
, t
, MIN (sm1) AS start_sm1
, MAX (em1) AS end_em1
FROM got_grp
GROUP BY grp, e, t
ORDER BY grp
;I couldn't test this, of course.
I assume there's another column, order_col, in the table, that determines what "previous" means.
Edited by: Frank Kulash on Dec 7, 2012 6:15 AM -
SQL QUERY TO CHECK FIREWALL PORTS
Hi All,
These is Nani..I am looking for a sql script to show inbound sql ports opened under windows firewall.
Thank You in Advance for your help.
Thanks,
Nani.
NBHi Nani55,
Please refer to the following query:
select distinct local_net_address, local_tcp_port from sys.dm_exec_connections
where local_net_address is not null
The query will return the local IP as well as the listening Port number. For more information, please see:
sys.dm_exec_connections (Transact-SQL):
http://msdn.microsoft.com/en-us/library/ms181509.aspx
Elvis Long
TechNet Community Support -
Hi i have to update a table for like 1000, 2000 items..normally this takes around....50-55 minutes...the way we are doing is like using a For loop and traversing for each item which has to be updated...
eg :- for (i=0; i<n;i++)
(update item_table set XXXXXXXXXXX where item_id=item)
i want to know would it be more efficient to just run one single update command... like ...
update item_table set XXXXXXXXXX where item_id in (item1,item2,................)
since the changes done are the same for all the items.
ThanksIt would be efficient because it will save the trips to the database that are currently happening in the loop. The downside is that you may not be able to add as many elements to the IN clause because databases have some limit to the set of values you could specify in the IN clause.
I would recommend using batches of items in manageable sizes (like 200 or so) and use the batch update facility provided in JDBC.
http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/JDBC20.html#JDBC2015 -
Snote, how to check in which notes have been implemented
hi guys,
how can i check which notes have been implemented in a particular system ?Hi,
Go to SNOTE -> Click on SAP Note Browser (Ctrl+F9)
Here search all the notes in system
Regards,
Atish -
Problem With SQL Query (updateable report)
Hi,
I have a report which I have set as type 'SQL Query (updateable report)'. I have added a 'row selector' to the report but when I run it I get the following error message:
failed to parse SQL query:
ORA-00904: "COL60": invalid identifier
The report works fine if I remove the row selector. Any ideas as to why the error is being produced?
Cheers
SimonI don't have the apex_application.g_f01(i) referenced in the page source...In the page source you wouldn't find anything by that name
Identify the tabular form's checkbox column in the page(firebug/chrome developer panel makes this easy)
It should be like
<input id="..." value="" type="checkbox" name="fXX" >we are interested in the name attribute , get that number (between 01 and 50)
Replace that number in the code, for instance if it was f05 , the code would use
apex_application.g_f05
--i'th checked record' primary keyWhen you loop through a checkbox array, it only contains the rows which are checked and it is common practice to returns the record's primary key as the value of the checkbox(available as the the i'th array index as apex_application.g_f05(i) , where i is sequence position of the checked row) so that you can identify the record. -
Query on Checks deposited for the day
Hi Experts,
Can I have a query on checks which were deposited on-date. Columns would be: Dep No. Customer code, Customer Name, Check date, Check No., Bank code and Amount. Parameter would be the Deposit date.
Many thanks.
DonHello Don - maybe try this out to see if it works...Regards, Zal
SQL G BK Daily Check Deposit Report Detail by Date Range Ver 2 ZP 2009 01 20
--DESCRIPTION: SQL reports on deposit, incoming payment, check numbers, and customer invoice information. This SQL is the basis for the Daily Deposit Report Summary by Date Range.
--AUTHOR(s):
--Version 1 Zal Parchem 12 Jan 2009
--Version 2 Zal Parchem 20 Jan 2009 Added Bank Code
--PROBLEM(s):
--[P1] ZP 2008 11 18 - SAP does not have a direct link to provide all of the information. See how SQL places info together in the JOIN statements before making any changes.
SELECT
T0.[DeposDate] AS 'Deposit Date',
T3.CardName AS 'Vendor/Customer Name',
T3.CardCode AS 'Vendor/Customer Number',
T1.CheckNum As 'Check Number',
T3.DocNum AS 'Inv/Cred Memo',
CASE
WHEN (T2.InvType = 14)
THEN (T2.SumApplied * -1)
ELSE (T2.SumApplied *1)
END AS 'Sum Applied to',
T1.[DpstAbs] AS 'Deposit Number',
T1.BankCode AS u2018Bank Codeu2019
--T2.DocNum AS 'Inc Payment',
--T0.[DeposNum] AS 'Filter Number'
FROM ODPS T0
INNER JOIN OCHH T1
ON T0.DeposId = T1.DpstAbs
LEFT OUTER JOIN RCT2 T2
ON T1.RcptNum = T2.DocNum
LEFT OUTER JOIN OINV T3
ON T2.DocEntry = T3.DocEntry
WHERE T0.DeposDate >= '[%0]'
AND T0.DeposDate <= '[%1]'
ORDER BY T3.CardName -
SQL Query Cost Report..
Hi all,
I am novice to OEM. I wanted to do / run sql query cost report.. How can i do it in OEM.?? Is it possible to do in OEM..??? Please guide me to solve this problem.??
Your suggestion will be helpful.
Thanks,
-Mahesh.Hi,
Thanks for your reply, but I want info about Oracle Enterprise Manager 10g.
Actual requirement is like this,
We have script files written in Linux Shell scripts, which are related to DB activities like Startup DB, Shutdown DB, perfstat, checking free space etc etc. These we want to migrate into OEM using OEM built-in features, few of which we've already migrated. We have analyzed scripts. One of the script is for SQL Query Cost Report (Which i didn't get what it does..)
So is there any option/inbuilt feature through which we can do "SQL Cost Report".
Once again thanks for your reply.
-Mahesh. -
Resolve column names in a sql Query
Hi Folks,
I’m upgrading an application and there are database columns that have major changes that could affect production reports. I would like to survey v$SQL for a few days to see if these columns are affected. Here’s the problem.
Looking at a SQL query to determine which columns are used is not nearly as easy as it sounds. Are there any oracle functions or 3rd party tools that can be used to list the columns used by a sql query? (this gets extremely tricky when subqueries become involved)
For instance.
select
name, b.dep_id, employee_id
From emp a
Inner join v_department b on a.dep_id=b.dep_id
Columns used:+
Emp.name+
Departments.dep_id (under the view)+
Emp.employee_id+
Emp.dep_id (from the join)+If you're on > 10g, you can use dbms_xplan with "all" option.
It shows "column projection information" which is exactly what you want.
UKJA@ukja102> set serveroutput on
UKJA@ukja102>
UKJA@ukja102> drop table t1 purge;
Table dropped.
Elapsed: 00:00:00.03
UKJA@ukja102> create table t1(c1 int, c2 int);
Table created.
Elapsed: 00:00:00.03
UKJA@ukja102>
UKJA@ukja102> explain plan for
2 select
3 t1.c1, t1.c2, v.cnt
4 from t1,
5 (select /*+ no_merge */ c1, count(*) as cnt
6 from t1
7 group by c1) v
8 where
9 t1.c1 = v.c1
10 ;
Explained.
Elapsed: 00:00:00.01
UKJA@ukja102>
UKJA@ukja102> @plan_all
UKJA@ukja102> select * from table(dbms_xplan.display(null,null,'all'))
2 /
PLAN_TABLE_OUTPUT
Plan hash value: 536125944
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 52 | 6 (34)| 00:00:01 |
|* 1 | HASH JOIN | | 1 | 52 | 6 (34)| 00:00:01 |
| 2 | TABLE ACCESS FULL | T1 | 1 | 26 | 2 (0)| 00:00:01 |
| 3 | VIEW | | 1 | 26 | 3 (34)| 00:00:01 |
| 4 | HASH GROUP BY | | 1 | 13 | 3 (34)| 00:00:01 |
| 5 | TABLE ACCESS FULL| T1 | 1 | 13 | 2 (0)| 00:00:01 |
Query Block Name / Object Alias (identified by operation id):
1 - SEL$1
2 - SEL$1 / T1@SEL$1
3 - SEL$2 / V@SEL$1
4 - SEL$2
5 - SEL$2 / T1@SEL$2
Predicate Information (identified by operation id):
1 - access("T1"."C1"="V"."C1")
Column Projection Information (identified by operation id):
1 - (#keys=1) "T1"."C1"[NUMBER,22], "T1"."C2"[NUMBER,22],
"V"."CNT"[NUMBER,22]
2 - "T1"."C1"[NUMBER,22], "T1"."C2"[NUMBER,22]
3 - "V"."C1"[NUMBER,22], "V"."CNT"[NUMBER,22]
4 - (#keys=1) "C1"[NUMBER,22], COUNT(*)[22]
5 - "C1"[NUMBER,22]
Note
- dynamic sampling used for this statement
40 rows selected.
Elapsed: 00:00:00.01
UKJA@ukja102>
UKJA@ukja102>
UKJA@ukja102> @end
UKJA@ukja102> set echo offDion Cho -
How to Use the Procedures in a Sql Query
Hi Friends,
Can anyone help me out whether can we use the procedure in the sql query..
if yes help me out with an example
my requirement is
i have one sql query .. in which i need to use the procedure which returns multiple values... how can i overcome it,can anyone help me out for this..
for your reference i am pasting the sql query
SELECT paf.person_id
FROM per_all_assignments_f paf START WITH paf.person_id = p_person_id
AND paf.primary_flag = 'Y'
AND paf.assignment_type IN('E', 'C')
AND l_effective_date BETWEEN paf.effective_start_date
AND paf.effective_end_date
CONNECT BY PRIOR paf.supervisor_id = paf.person_id
AND paf.primary_flag = 'Y'
AND paf.assignment_type IN('E', 'C')
AND l_effective_date BETWEEN paf.effective_start_date
AND paf.effective_end_date
and paf.person_id not in (>>>I HAVE TO USE THE PROCEDURE HERE<<<<);
Thanks in advanceWe never saw your procedure, but maybe you could wrap it in a function
SQL> create or replace procedure get_members(in_something IN number, out_members OUT sys_refcursor)
is
begin
open out_members for
'select level member_id from dual connect by level <= :num' using in_something;
end get_members;
Procedure created.
SQL> create or replace type numbers as table of number;
Type created.
SQL> create or replace function members(in_something IN number)
return numbers
as
member_cur sys_refcursor;
members numbers;
begin
get_members(in_something, member_cur);
fetch member_cur bulk collect into members;
close member_cur;
return members;
end;
Function created.
SQL> select * from table(members(4));
COLUMN_VALUE
1
2
3
4
4 rows selected.Variant on same using piplined function
SQL> create or replace function members_piped(in_something IN number)
return numbers pipelined
as
member_cur sys_refcursor;
rec number;
begin
get_members(in_something, member_cur);
loop
fetch member_cur into rec;
exit when member_cur%notfound;
pipe row(rec);
end loop;
close member_cur;
return;
end;
Function created.
SQL> select * from table(members_piped(4));
COLUMN_VALUE
1
2
3
4
4 rows selected.
SQL> drop function members_piped;
Function dropped.
SQL> drop function members;
Function dropped.
SQL> drop type numbers;
Type dropped.
SQL> drop procedure get_members;
Procedure droppedEdit:
Sorry Blu, had not seen you already posted similar thing
Edited by: Peter on Jan 27, 2011 5:38 AM -
Sql query/function problem??
Hi ,
I have problems writing a difficult sql query, please help me
I have a table t in which there are 50000 records
the table has columns like
create table t
(MATCH_ID NUMBER(4) NOT NULL,
TEAM_ID NUMBER(4),
PLAYER_ID NUMBER(4),
RUNS NUMBER(3))
here match_id, player_id and team_id are jointly primary key
SQL> SELECT * FORM T WHERE MATCH_ID < 10
MATCH_ID TEAM_ID PL_ID RUNS
1 2 1228 8
1 2 1203 82
1 2 1316 24
1 1 1150 27
1 1 1278 13
1 1 1243 60
2 1 1278 37
2 1 1291 0
2 1 1243 53
2 2 1228 25
2 2 1285 103
2 2 1316 60
3 2 1228 8
3 2 1285 25
3 2 858 43
3 1 1278 52
3 1 1394 6
3 1 1243 31
4 1 1278 61
4 1 1394 6
4 1 1243 3
4 2 1228 41
4 2 1285 40
4 2 858 5
6 2 1228 20
6 2 1285 100
6 2 1408 0
7 2 1228 15
7 2 1285 34
7 2 1408 44
8 2 1228 0
8 2 1420 31
8 2 1340 66
9 2 1420 19
9 2 1385 28
9 2 1340 0
.....so on upto 50000 records..
the problem is that I want to extract how many times each player_id in each
match exists in the table, prior to that match_id (or current_match_id)
along with that in another column, I also want the sum of 'RUNS' for each
player_id prior to that match_id (or current_match_id)
my disired output is:
MATCH_ID TEAM_ID player_ID RUNS NO_OF_OCCURENCES SUM(RUNS)
BEFORE_THIS_MATCH BEFORE_THIS_MATCH
FOR_THIS_PLAYER_ID FOR_THIS_PLAYER_ID
1 2 1228 8 0 0
1 2 1203 82 0 0
1 2 1316 24 0 0
1 1 1150 27 0 0
1 1 1278 13 0 0
1 1 1243 60 0 0
2 1 1278 37 1 13
2 1 1291 0 0 0
2 1 1243 53 1 60
2 2 1228 25 1 8
2 2 1285 103 0 0
2 2 1316 60 1 24
3 2 1228 8 2 33
3 2 1285 25 1 103
3 2 858 43 0 0
3 1 1278 52 2 50
3 1 1394 6 0 0
3 1 1243 31 2 113
4 1 1278 61 3 102
4 1 1394 6 1 6
4 1 1243 3 3 144
4 2 1228 41 3 41
4 2 1285 40 2 128
4 2 858 5 1 43
6 2 1228 20 4 82
6 2 1285 100 3 168
6 2 1408 0 0 0
7 2 1228 15 5 102
7 2 1285 34 4 268
7 2 1408 44 1 0
8 2 1228 0 6 117
8 2 1420 31 0 0
8 2 1340 66 0 0
9 2 1420 19 1 31
9 2 1385 28 0 0
9 2 1340 0 1 66
as you can see from the above data (5TH COLUMN), i have mentioned the
existance of each player_id in each match prior to the current_match_id
since match_id = 1 is the 1st match in the table so no player_id comes in the
table before match number 1.
In match number 2 , player_id = 1278 was also present in match_id = 1 so
thats why Number_OF_OCCURENCES = 1 for player_id = 1278 in match_id = 2
and so on..
same is the case with 'RUNS' column but here RUNS are the SUM of each
player_id's 'RUNS' before the current match
Note: if some player_id does not exist in the table before the current
match_ID then the query should return zero for that player_id ( as in 4th and
5th columns of no_of_occurances and sum(runs) respectively)
for example: in above data
MATCH_ID TEAM_ID PLayer_ID RUNS NO_OF_OCCURENCES SUM(RUNS)
BEFORE_THIS_MATCH BEFORE_THIS_MATCH
FOR_THIS_PLAYER_ID FOR_THIS_PLAYER_ID
9 2 1385 28 0 0
I hope this will clear my problem
i would be extremely grateful if someone helps me out??
here is sample ddl of the above data
create table t
(MATCH_ID NUMBER(4) NOT NULL,
TEAM_ID NUMBER(4),
PLAYER_ID NUMBER(4),
RUNS NUMBER(3))
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (1, 2, 1228, 8);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (1, 2, 1203, 82);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (1, 2, 1316, 24);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (1, 1, 1150, 27);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (1, 1, 1278, 13);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (1, 1, 1243, 60);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (2, 1, 1278, 37);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (2, 1, 1291, 0);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (2, 1, 1243, 53);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (2, 2, 1228, 25);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (2, 2, 1285, 103);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (2, 2, 1316, 60);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (3, 2, 1228, 8);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (3, 2, 1285, 25);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (3, 2, 858, 43);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (3, 1, 1278, 52);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (3, 1, 1394, 6);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (3, 1, 1243, 31);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (4, 1, 1278, 61);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (4, 1, 1394, 6);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (4, 1, 1243, 3);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (4, 2, 1228, 41);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (4, 2, 1285, 40);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (4, 2, 858, 5);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (6, 2, 1228, 20);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (6, 2, 1285, 100);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (6, 2, 1408, 0);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (7, 2, 1228, 15);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (7, 2, 1285, 34);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (7, 2, 1408, 44);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (8, 2, 1228, 0);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (8, 2, 1420, 31);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (8, 2, 1340, 66);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (9, 2, 1420, 19);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (9, 2, 1385, 28);
insert into t (MATCH_ID, TEAM_ID, PLAYER_ID, RUNS) values (9, 2, 1340, 0);regards
ramis.Ramis,
SQL> select * from tt;
MATCH_ID TEAM_ID PLAYER_ID RUNS
1 2 1228 8
1 2 1203 82
1 2 1316 24
1 1 1150 27
1 1 1278 13
1 1 1243 60
2 1 1278 37
2 1 1291 0
2 1 1243 53
2 2 1228 25
2 2 1285 103
2 2 1316 60
3 2 1228 8
3 2 1285 25
3 2 858 43
3 1 1278 52
3 1 1394 6
3 1 1243 31
4 1 1278 61
4 1 1394 6
4 1 1243 3
4 2 1228 41
4 2 1285 40
4 2 858 5
6 2 1228 20
6 2 1285 100
6 2 1408 0
7 2 1228 15
7 2 1285 34
7 2 1408 44
8 2 1228 0
8 2 1420 31
8 2 1340 66
9 2 1420 19
9 2 1385 28
9 2 1340 0
36 rows selected.
SQL> select tt.match_id,
tt.team_id,
tt.player_id,
tt.runs,
nvl(a.sum_player,0) OCC,
nvl(b.sum_runs,0) SUM_RUNS
from
tt,
(select a.match_id,a.team_id,a.player_id,a.runs,count(*) sum_player
from tt a,
(select match_id,player_id
from tt
group by match_id,player_id) b
where a.match_id>b.match_id
and a.player_id=b.player_id
group by a.match_id,a.team_id,a.player_id,a.runs
) a,
(select a.match_id,a.team_id,a.player_id,a.runs,sum(b.runs) sum_runs
from tt a,
(select match_id,player_id,runs
from tt) b
where a.match_id>b.match_id
and a.player_id=b.player_id
group by a.match_id,a.team_id,a.player_id,a.runs
) b
where tt.match_id=a.match_id(+)
and tt.team_id=a.team_id(+)
and tt.player_id=a.player_id(+)
and tt.match_id=b.match_id(+)
and tt.team_id=b.team_id(+)
and tt.player_id=b.player_id(+)
MATCH_ID TEAM_ID PLAYER_ID RUNS OCC SUM_RUNS
1 1 1150 27 0 0
1 1 1243 60 0 0
1 1 1278 13 0 0
1 2 1203 82 0 0
1 2 1228 8 0 0
1 2 1316 24 0 0
2 1 1243 53 1 60
2 1 1278 37 1 13
2 1 1291 0 0 0
2 2 1228 25 1 8
2 2 1285 103 0 0
2 2 1316 60 1 24
3 1 1243 31 2 113
3 1 1278 52 2 50
3 1 1394 6 0 0
3 2 858 43 0 0
3 2 1228 8 2 33
3 2 1285 25 1 103
4 1 1243 3 3 144
4 1 1278 61 3 102
4 1 1394 6 1 6
4 2 858 5 1 43
4 2 1228 41 3 41
4 2 1285 40 2 128
6 2 1228 20 4 82
6 2 1285 100 3 168
6 2 1408 0 0 0
7 2 1228 15 5 102
7 2 1285 34 4 268
7 2 1408 44 1 0
8 2 1228 0 6 117
8 2 1340 66 0 0
8 2 1420 31 0 0
9 2 1340 0 1 66
9 2 1385 28 0 0
9 2 1420 19 1 31
36 rows selected.
SQL> Is this do you want ?
Nicolas.
Maybe you are looking for
-
Similar with FB05,how should i process 'transfer posting with clearing'?
Hi my friends, Customers provide an excel file that contains detial of invoices paid(Doc No, Customer No, Invoice No, Payment Amount), then i need to implement FB05 Function and transfer posting with clearing. I'd like to use FM 'Posting_i
-
Problem starting mac-Bundle containing Director app
Hi I've created a Mac-bundle from Director-project using standard Adobe guideline http://kb2.adobe.com/cps/167/tn_16743.html It works fine But now the customer wants to change the name of projector to some another name If I change for example stubX t
-
** Not able to import IDoc from SAP ECC system
Hi Friends, I am not able to import the IDoc from SAP ECC system in IR. I have checked that, hostname, client, server no. everthing is correct. I checked in SLD also. Host Name is correct. While import (after giving the user name and password), I am
-
Mute background track so you can hear video clip sound?
Using iMovie '11, on a project with mixed stills and video, I want to mute the background music I have added while the video clips are playing so you can hear the audio on the clip and them=n bring the volume back up for the still shots. I can see h
-
Need help with setting the entry point for application
Hi there, I am kinda new to creating JAR files for application. I checked out the tutorials for creating the jar files, and I understood most of the concepts. There is one part in the tutorial which I still don't understand it says: We want to execut