Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 10th, 2005, 03:24 PM
fkoskotas fkoskotas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 56 fkoskotas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 26 m 16 sec
Reputation Power: 4
report building in sqlplus

why does this code only return one 'compute' statement:

l06db > get formatted_system_test_project.sql
1 clear breaks
2 clear computes
3 break on profile_id skip 3
4 compute max of test_time on profile_id
5 compute min of test_time on profile_id
6 select distinct(track_id), meas_seq,test_results.meas_code,test_time, stn_id, test_count, test_header.profile_id,test_hea
der.profile_ver from test_header,test_results,meas_spec
7 where test_results.test_link_id in (select test_link_id from test_header
8 where track_id = 'LPB0340138')
9 and test_header.test_link_id = test_results.test_link_id
10 and test_results.meas_code = meas_spec.meas_code
11 and test_header.profile_id = meas_spec.profile_id
12 and test_header.profile_ver = meas_spec.profile_ver
13 group by test_results.meas_code,meas_seq,test_count,test_time,track_id,stn_id, test_header.profile_id,test_header.profile
_ver
14* order by meas_seq
15

OUTPUT from above script:

TRACK_ID MEAS_SEQ MEAS_COD TEST_TIME STN_ID TEST_COUNT PROFILE_ID PROFILE_
---------------- ---------- -------- ---------- -------- ---------- ------------ --------
LPB0340138 102 SCCpACTG .77 L2S01ABT 4 PBBL_BT_1 20050122
---------- ************
.77 minimum



LPB0340138 102 SCCpACTG .79 L2S05ABT 5 PBBL_BT_1_89 20050122
---------- ************
.79 minimum

Reply With Quote
  #2  
Old February 11th, 2005, 10:56 AM
shafique shafique is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Canada
Posts: 305 shafique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 20 sec
Reputation Power: 5
according to oracle specification, If multiple COMPUTE commands reference the same column in the ON clause, only the last COMPUTE command applies. but you can use multiple function in COMPUTE clause by using space in the same COMPUTE, for example

Code:
BREAK ON DEPTNO
COMPUTE MIN MAX OF SAL ON DEPTNO

SELECT empno, ename, sal, deptno
FROM emp
ORDER BY deptno
/

Reply With Quote
  #3  
Old February 14th, 2005, 09:08 AM
fkoskotas fkoskotas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 56 fkoskotas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 26 m 16 sec
Reputation Power: 4
Quote:
Originally Posted by shafique
according to oracle specification, If multiple COMPUTE commands reference the same column in the ON clause, only the last COMPUTE command applies. but you can use multiple function in COMPUTE clause by using space in the same COMPUTE, for example

Code:
BREAK ON DEPTNO
COMPUTE MIN MAX OF SAL ON DEPTNO

SELECT empno, ename, sal, deptno
FROM emp
ORDER BY deptno
/




Thanks! Works great. Now a new question, for the same script:
clear breaks
clear computes

break on profile_id skip 3


compute min max avg of test_time on profile_id

select distinct(track_id), meas_seq,test_results.meas_code,test_time, stn_id, test_count, test_header.profile_id,test_header.p
rofile_ver from test_header,test_results,meas_spec
where test_results.test_link_id in (select test_link_id from test_header
where track_id = 'LPB0340138')
and test_header.test_link_id = test_results.test_link_id
and test_results.meas_code = meas_spec.meas_code
and test_header.profile_id = meas_spec.profile_id
and test_header.profile_ver = meas_spec.profile_ver
group by test_results.meas_code,meas_seq,test_count,test_time,track_id,stn_id, test_header.profile_id,test_header.profile_ver
order by meas_seq
/

output is:

l06db > @formatted_system_test_project.sql

TRACK_ID MEAS_SEQ MEAS_COD TEST_TIME STN_ID TEST_COUNT PROFILE_ID PROFILE_
---------------- ---------- -------- ---------- -------- ---------- ------------ --------
LPB0340138 1 STRT_TST 0 L2S07ABT 1 PBBL_BT_1 20050122
LPB0340138 1 STRT_TST 0 L2S01ABT 2 20050122
LPB0340138 1 STRT_TST .05 L2S01ABT 3 20050122
LPB0340138 1 STRT_TST .01 L2S01ABT 4 20050122
---------- ************
.015 avg
0 minimum
.05 maximum



LPB0340138 1 STRT_TST .01 L2S05ABT 5 PBBL_BT_1_89 20050122
---------- ************
.01 avg
.01 minimum
.01 maximum



How can i get the difference of the two averages?

Reply With Quote
  #4  
Old February 21st, 2005, 04:55 PM
shreya shreya is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 2 shreya User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 16 sec
Reputation Power: 0
some info

Did you get an answer to this,

I also have two totals and want to calculate average from two totals:

total1*100/total2 should be displayed in the avg field.

Let me know how u can help

Quote:
Originally Posted by fkoskotas
Thanks! Works great. Now a new question, for the same script:
clear breaks
clear computes

break on profile_id skip 3


compute min max avg of test_time on profile_id

select distinct(track_id), meas_seq,test_results.meas_code,test_time, stn_id, test_count, test_header.profile_id,test_header.p
rofile_ver from test_header,test_results,meas_spec
where test_results.test_link_id in (select test_link_id from test_header
where track_id = 'LPB0340138')
and test_header.test_link_id = test_results.test_link_id
and test_results.meas_code = meas_spec.meas_code
and test_header.profile_id = meas_spec.profile_id
and test_header.profile_ver = meas_spec.profile_ver
group by test_results.meas_code,meas_seq,test_count,test_time,track_id,stn_id, test_header.profile_id,test_header.profile_ver
order by meas_seq
/

output is:

l06db > @formatted_system_test_project.sql

TRACK_ID MEAS_SEQ MEAS_COD TEST_TIME STN_ID TEST_COUNT PROFILE_ID PROFILE_
---------------- ---------- -------- ---------- -------- ---------- ------------ --------
LPB0340138 1 STRT_TST 0 L2S07ABT 1 PBBL_BT_1 20050122
LPB0340138 1 STRT_TST 0 L2S01ABT 2 20050122
LPB0340138 1 STRT_TST .05 L2S01ABT 3 20050122
LPB0340138 1 STRT_TST .01 L2S01ABT 4 20050122
---------- ************
.015 avg
0 minimum
.05 maximum



LPB0340138 1 STRT_TST .01 L2S05ABT 5 PBBL_BT_1_89 20050122
---------- ************
.01 avg
.01 minimum
.01 maximum



How can i get the difference of the two averages?

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > report building in sqlplus


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway