Delete statement that uses a sub-select with the statement in the cursor
Hi all,
How to write write a delete statement that uses a sub-select with the statement in the cursor?
CURSOR excluded_dates IS
SELECT TO_TIMESTAMP(report_parameter_value, in_date_format_mask)
INTO my_current_date_time
FROM report_parameters
WHERE report_parameters.report_parameter_id = in_report_parameter_id
AND report_parameters.report_parameter_group = 'DATE_TIME'
AND report_parameters.report_parameter_name = 'EXCLUDED_DATE';
OPEN excluded_dates;
LOOP
FETCH excluded_dates INTO my_excluded_date;
EXIT WHEN excluded_dates%NOTFOUND;
DELETE FROM edr_rpt_tmp_inclusion_table
WHERE TO_CHAR(date_time, 'mm/dd/yyyy') = TO_CHAR(my_excluded_date, 'mm/dd/yyyy');
END LOOP;
CLOSE excluded_dates;Thanks
Hi,
In such case I think is better to create a view an perform the delete using it. Example (using HR schema):
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr
SQL> create or replace view v_employees as select * from employees where first_name like 'J%';
View created
SQL> select * from v_employees;
EMPLOYEE_ID FIRST_NAME LAST_NAME EMAIL PHONE_NUMBER HIRE_DATE JOB_ID SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
110 John Chen JCHEN 515.124.4269 28/09/1997 FI_ACCOUNT 8200,00 108 100
112 Jose Manuel Urman JMURMAN 515.124.4469 07/03/1998 FI_ACCOUNT 7800,00 108 100
125 Julia Nayer JNAYER 650.124.1214 16/07/1997 ST_CLERK 3200,00 120 50
127 James Landry JLANDRY 650.124.1334 14/01/1999 ST_CLERK 2400,00 120 50
131 James Marlow JAMRLOW 650.124.7234 16/02/1997 ST_CLERK 2500,00 121 50
133 Jason Mallin JMALLIN 650.127.1934 14/06/1996 ST_CLERK 3300,00 122 50
139 John Seo JSEO 650.121.2019 12/02/1998 ST_CLERK 2700,00 123 50
140 Joshua Patel JPATEL 650.121.1834 06/04/1998 ST_CLERK 2500,00 123 50
145 John Russell JRUSSEL 011.44.1344.429268 01/10/1996 SA_MAN 14000,00 0,40 100 80
156 Janette King JKING 011.44.1345.429268 30/01/1996 SA_REP 10000,00 0,35 146 80
176 Jonathon Taylor JTAYLOR 011.44.1644.429265 24/03/1998 SA_REP 8600,00 0,20 149 80
177 Jack Livingston JLIVINGS 011.44.1644.429264 23/04/1998 SA_REP 8400,00 0,20 149 80
181 Jean Fleaur JFLEAUR 650.507.9877 23/02/1998 SH_CLERK 3100,00 120 50
186 Julia Dellinger JDELLING 650.509.3876 24/06/1998 SH_CLERK 3400,00 121 50
189 Jennifer Dilly JDILLY 650.505.2876 13/08/1997 SH_CLERK 3600,00 122 50
200 Jennifer Whalen JWHALEN 515.123.4444 17/09/1987 AD_ASST 4400,00 101 10
16 rows selected
SQL> delete from v_employees where hire_date >= to_date('01/06/1998', 'dd/mm/yyyy');
2 rows deleted
SQL> regards,
Similar Messages
-
PLease guide me to use vendor sub range with functionality
Dear All,
PLease guide me to use vendor sub range with functionality
thxHi,
The basic concept of Vendor Sub Range is to use different Purchasing Data as well as Partner Functions for a particular range of products supplied by individual your vendor.
In SPRO you can activate Vendor Sub-range in following path
SPRO->Logistic General->Business Partner->Vendors->Control->Define Account Group & Field Selection
In this screen Select your Vendor account group and double click, sys will take to new screen and here you select check box of Vendor sub-range relevant in data retention level-poaching tab and save.
Now create following master data:
Lets say youre purchasing two pumps from your Vendor (V), HDPE and SS manufactured by different company (HDPE and SS ) & they have different purchasing data like payment terms, delivery term etc
1. Create two materials HDPE and SS
2. Create Vendor (V)
3. Create Info record (ME11) M1 & M2 with vendor (V) and here in each material maintain vendor sub range
4. Now create PO (ME21), all related data you will get in PO w.r.t. material and save.
Regards,
Biju K -
My iPhone 4s notified me that I had to manage my storage so I deleted apps that used a lot of space I deleted almost all my picture and it still keeps telling me I don't have enough storage is there any other way I can make room on my phone ? Were it shows how much storage I have available it still says 9.9 even after all that I have done so I don't know if I need to change my storage plan or what but anything will help I guess
Check for 'others' in iTunes against your iPhone.
Restore from a previous backup to reclaim some of it.
Still want more, Restore in iTunes, setup as New. -
hi, my firefox and safari are both having difficulty loading certain parts of web pages. previous to this my firefox would freeze and state that a script was not responding. i would stop the script and reload the page and everything would be fine. now though the pages just load very very slowly or load leaving out certain pictures and video content. i've tried clearing my cache's and cookies, resetting my browser etc, but it seems like its a system issue as both safari and firefox are having issues. i've run Avast to screen for malware and it came up empty. any suggestions?
10.4.8's been a pain for Networking... not sure of all the reasons though, or whether all the complaints might not be MS working around Bugs/Non-compliance, but at this point I think you should get Applejack...
http://www.versiontracker.com/dyn/moreinfo/macosx/19596
After installing, boot holding down CMD+s, then when the prompt shows, type in...
applejack AUTO
Then let it do all 5 of it's things.
Fixes a lot of problems, and besides, if your Mac ever gets to the point it won't Boot... this is a life saver!
After you run that... let's see where we are.
BTW, several ISPs seem to have trouble with their DNS Servers lately, might try these insead...
208.67.222.222
208.67.220.220 -
When I try to use 'Stacked Column Bar'. with data assigned in the graphs, and want to see it in the 'Preview' mode in Xeclsius, I unable to see the graphs apart from the Axes ans Series Value, the graphs becomes totally invisible why So ?
Hi Ranendra,
For basic understanding of Dashboards and Models you can use standard Templates or samples which ll come along with dashboard designer(Formly Xcelsius) installation.
For path File-->Templates(or Samples).
Under Templates you ll have different categories and for each you ll find the dashboard Templates.
Regards,
Venkat P -
I use 1 Icloud account with 2 devise but the other devise arrest out my devise throue find my iphone, than my devise was not able to connect to itune anymore. My devise still can swich on but it always restart after afew seconds. So can it fix ?
Looking at the error message "The Network Adapter could not establish the connection" , It appears hostname and port may be incorrect. Review the targets.xml under E:\oracle\product\10.2.0\db_1\SAP_solman_SDB\emd and
emoms.properties under E:\oracle\product\10.2.0\db_1\SAP_solman_SDB\config folder to make sure host ( sap_solman) and port (1527) are correct.
As far as setting the environment variables goes, you can go to control panel -> system -> advanced -> environment variables and set the ORACLE_HOME and ORACLE_SID
-Ramesh -
I've just downloaded the ipad manual which states that it is for OS 10.4.3 but the manual states that I need 10.5.8 does this mean that I need an intel machine!
No, 10.5 still supports PPC. 10.6 supports Intel only.
-
How to use a event structure with a state machine
First, I would like to inform you that I only work on LabView part time, and have much to learn. Anything I do learn, I usually forget until I need it again, because I only work on it part time.
Using your StopWhileLoopMOD[1].vi, I am trying to put a state machine inside the event structure.
Related link: http://forums.ni.com/t5/LabVIEW/How-to-stop-while-loop-in-Event-case/td-p/465564/page/2
Here is my application: on the front panel, the user can select any combination of 7 different tests. I have created cases to perform each step of each test in the correct order, but if the user presses stop, the tests won't stop because some of the cases have a while loop inside the event structure (like you mentioned is a bad idea). The user should be able to stop the test, reselect tests to perform, and re-start the tests.
When the start button is pressed for the event structure, I need all the cases to run in the proper order, unless stop is pressed.
In the past I have indexed an array and used that to run the state machine, but it won't stop immediately.
I have sub VIs that are built in while loops because the outputs of the product needs time to stabilize. The state machine stops and waits up to a certain number of iterations. If it passes the test, the while loop stops and the next state starts. If it takes too long, it exits and reports an error. Maybe I need to just use the state machine and not an event structure?
Is there a good example of an event structure?
metzler CLAD
Solved!
Go to Solution.I'm not sure exactly what you are asking, but it sounds like you want to script a bunch of tests and if the user says stop, to immediately stop the current test and abandon the others? I'm going to assume that you know how to clear the array so that it will abandon the others, so I'm guessing that you are having trouble abandoning the current test? If this is indeed the case, then the problem is that you are not able to propagate the message from the main VI FP which is the GUI to the sub vi which is the test, where the test may or may not have a GUI (FP visible) of it's own. Threading was the first thing to come to mind, but this may not be necessary using events.
You can do this by passing a refnum of the stop button to the subVI, where you can then add that wait to the event case structure.
I've attached 2 VIs, mainvi.vi which is just a loop displays the count*2 (number of seconds passed since running) that will call subvi.vi and then check to see if the stop button is pressed. mainvi.vi is by no means a state engine, it is just a simple loop for demonstration purposes. subvi.vi just waits 2 seconds and leaves, it is a better structured state engine with an init state to start a poll case to wait for events and an exit state to clean up. You can modify this any way you wish to get it to do what you want. You will note that even if subvi.vi is being executed, it will terminate immediately when the stop button is pressed.
Hope this helps.
A
Attachments:
mainvi.vi 17 KB
subvi.vi 33 KB -
I've been doing a lot of reading the last couple of days on how we can encrypt db communication between our product app and a customer's SQL Server db, but cannot make it work as expected. The app uses a ODBC/DSN to connect to the SQL Server db. I use this
ODBC app to setup the DSN (on a Windows 7 PC):
C:\Windows\SysWOW64\odbcad32.exe
The DSNconnection uses the SQL Server driver 6.01.7601.17514 and has these properties:
- WinNT authentication.
- Client Config button: TCP/IP to <server-name>\<instance.-name>
- Change to default db: <name-of-app-db>
- Everything else is default setting.
SQL Server is on the same Windowns 7 PC and has a self-signed cert installed (used IIS to generate it) and has the Force Enryption set to "yes".
I have a test C# program that uses the ADODB 2.7.0.0 COM-wrapper, made by Visual Studio after adding a reference to the ADO 2.7 library version 6.1.7601.17857. The program creates an ADODB.Connection object that has a simple connection string: "DSN=<san-name>;UID=<user>;PWD=<password>". The
program then creates an ADODB.Recordset object and reads and displays a field from a table.
Works fine.
If I go into SQL Server and set Force Encryption to "no," clear the cert, restart the SQL service, and then re-run the program, it works fine.
Here's the kick. If I go into the DSN and select "Use strong encryption for data" the Test button on the DSN works—why does it work? The SQL Server is no longer encrypting the connection so an error should occur. If I run the test program, it works
as well—why? I can look at the connection properties in the test program and see that ADODB has added the ";Encrypt-yes" stuff to the end of the connection string. Yet that option seems to have no effect.
If I set the SQL instance back to Force Encryption:yes, enable the cert, restart the SQL service, and clear the DSN's "Use strong encryption for data" option, I can still connect to the db with the
test program—why?
What am I doing wrong? I need to be able to ensure that the communication between our app product and the SQL instance is encrypted, and that we get an error if the SQL instance does not support encrypted communications. We really don't want the customer
to have to enable Force Encryption because they have other db's on their SQL Server that do not use encrypted communication, but they want to know that our product's communication channel with the db is encrypted.
No, I can't change the app product's code at this point in time. I'm stuck with working with what a DSN called from ADODB has to offer.
Also, how can I be sure that communications are encrypted? I mean, I've tried things like "SELECT * FROM sys.dm_exec_connections" but that doesn't help because I have no idea how to tie the list of sessions shown back to my test program, although
I guess it's a good thing that some of the sessions listed show encrypt_option as TRUE.
-glenn-Ah yes, very good point. It's easy to miss because you have to delete then recreate the DSN in order to change drivers. So I switched the DSN over to the SQL Native 11 driver.
Now when I try to connect to the SQL instance as <computer-name>\<instance-name>, and without a cert on the server, I get "the target principal name is incorrect". Perfect; now we're getting somewhere!
Change my DSN to use <fqdn>\<instance-name> and it works. This tells me that SQL Server has auto-generated a cert and named it <fqdn>. I would have expected the "cert fail" error, not a cert
name mismatch, because I'm not using Trust Server Cert.
So I load up my self-signed cert, and that works too.
I am still confused as to why I'm not seeing the "cert fail" error when I have no cert loaded on the SQL Server. I am not using Force Encryption on the server at all, so wouldn't expect SQL Server to auto-create a cert when an Encrypt=yes request comes in,
but apparently it does?
I also ran into a problem with this:
select c.session_id, c.encrypt_option, s.client_interface_name
from sys.dm_exec_connections c
join sys.sysprocesses s
on c.session_id = s.session_id
where s.dbid = db_id('MyDatabase')
There is no s.client_interface_name, probably should be s.hostname. There's also no s.session_id. I thought maybe this should be s.sid, but then no rows ever come back. The c.session_id looks like 51 and 52, but the s.sid looks like a very long binary number,
so these two fields cannot be joined. I don't know how to convert the sid's properly so that the join would work. Ah wait, I just found the s.spid column; the join works when that column is used (I assume that's correct anyhow).
If I add a Thread.Sleep(30 seconds) to my C# program just before the connection is closed, this query shows me the session for the correct hostname has encrypt_option=TRUE.
And I have to keep my fingers crossed that all the app I/O will still work properly after
changing the driver. Probably a safe bet though.
Think I'm ready to throw in the towel on getting the "cert fail/no SSL" error to appear.
It does look like I am able to sufficiently show that the connection is encrypted when Encrypt=yes is used with the newer driver.
Thank for all the help!
-glenn- -
Hi. I recently changed my MacBook Pro password, and now I don't recall what it is. My hope is that I can somehow gain access without deleting everything currently on it. I do not have the MAC disk that it came with. Is there something I can do myself? Should I take it to the MAC store? Thanks in advance for your help.
It helps with this kind of question to state which system version you are using on the computer as the answer will vary.
Mac OS X: Changing or resetting an account password - http://support.apple.com/kb/HT1274 - resetting password on regular and administrator accounts if you have the installer disc (OSX 10.1-10.6.8) or AppleID (OSX 10.7-10.8) [Of course Apple has changed this document since I asaved the link so it is no longer useful for newer system versions. ]
Reset administrator password in Lion - https://discussions.apple.com/message/16460076
Reset a Mac OS X 10.7 Lion Password - http://osxdaily.com/2011/08/24/reset-mac-os-x-10-7-lion-password/
Message was edited by: Limnos -
Delete entries that are not in select option
hi
My select query is getting a values that were not in one of my select option. what is the statement to delete those entries from the internal table that were not in select optionHi,
Please check the where conditon correctly.
You may not be considering the all select option fileds in where condition.
Check.
or Use ..
Delete from Itab where <field> not in <S_field>.
Regards,
Anji
Message was edited by:
Anji Reddy Vangala -
Can we use dbms_output.put_line package with forall statement
Hello Everybody
Can we use dbms_output.put_line package with forall or can we use insert,update and delete only
declare
type emp_rec is table of emp%rowtype
index by binary_integer;
t emp_rec;
begin
select * bulk collect into t from emp;
forall i in t.first..t.last
dbms_output.put_line(t(i).name);
end;Thanks & Regards
peeyush
Edited by: Peeyush on Nov 25, 2010 11:45 PMMichaelS wrote:
Well as the docs explain (though not very clear and detailed, I admit) you can use a dynamic sql statement (execute immediate) with FORALL.You got me interested in the performance side doing this Michael - running PL/SQL code via a FORALL loop.
It is faster than using a normal FOR loop to execute dynamic PL/SQL - a bit surprising as I expected another context switch to be in there. But seems like the PL/SQL engine is a more clever at optimisation than what I originally credited it with.. ;-)
Of course - pre-compiled/static PL/SQL code in a FOR loop is the fastest, as expected.
SQL> declare
2 type TNumbers is table of number;
3
4 type TTimes is record(
5 for_all number,
6 for_dynamic number,
7 for_static number
8 );
9
10 type TTimesTable is table of TTimes;
11
12 MAX_ITERATIONS constant number := 10;
13
14 plBlock varchar2(1000) :=
15 'declare i number;
16 begin i:= :var / 10; end;';
17
18 performance TTimesTable;
19 t1 number;
20 bindVar TNumbers;
21 n number;
22 begin
23 select
24 level bulk collect into bindVar
25 from dual
26 connect by level <= 10000;
27
28 dbms_output.put_line( 'Iterations: '||bindVar.Count||' for loop cycle(s)' );
29
30 performance := new TTimesTable();
31 performance.Extend( MAX_ITERATIONS );
32
33 for j in 1..MAX_ITERATIONS
34 loop
35 t1 := dbms_utility.get_time;
36 forall i in 1..bindVar.Count
37 execute immediate plBlock using bindVar(i);
38 performance(j).for_all := dbms_utility.get_time-t1;
39
40 t1 := dbms_utility.get_time;
41 for i in 1..bindVar.Count
42 loop
43 execute immediate plBlock using bindVar(i);
44 end loop;
45 performance(j).for_dynamic := dbms_utility.get_time-t1;
46
47 t1 := dbms_utility.get_time;
48 for i in 1..bindVar.Count
49 loop
50 n := bindVar(i) / 10;
51 end loop;
52 performance(j).for_static := dbms_utility.get_time-t1;
53 end loop;
54
55 dbms_output.put_line( 'Times in 100th of a second' );
56 dbms_output.put_line( rpad('for all',15) || rpad('for dynamic',15) || rpad('for static',15) );
57 for i in 1..performance.Count
58 loop
59 dbms_output.put_line(
60 rpad( performance(i).for_all, 15 )||' '||
61 rpad( performance(i).for_dynamic, 15 )||' '||
62 rpad( performance(i).for_static, 15)
63 );
64 end loop;
65
66 end;
67 /
Iterations: 10000 for loop cycle(s)
Times in 100th of a second
for all for dynamic for static
10 72 0
6 37 0
6 37 0
6 37 0
6 36 0
6 37 1
5 37 0
5 37 0
6 37 1
5 37 0
PL/SQL procedure successfully completed.
SQL> -
OpenAL, Every game install that uses it overwrites it with an older version.
Hello, I have a Auzentech Forte using Daniel_K's latest Auzen pack driver set which has as far as I know the newest version of OpenAl (2.1.0.0 dated /9/2009).
Most games that I install that use OpenAl like Unreal Tournament 3 want to install their own, and it seems like it just overwrites the install folder in program files (just a Folder named OpenAl with the exe inside it) with its bundled version which is usually significantly older and then runs that (the version in add remove programs changes too so its just being overwritten it seems)
Is it common practice to just replace the file with the newest one after every game install that overwrites it and then re run (install) it's Windows 7 makes it easy by just right clicking the file and selecting "Restore Previous Version" and then running that.
Are there major differences between versions aside from age? Like is the version bundled with games a pure software version of OpenAl, and the one that comes with the Drivers a hardware implementation?
ThanksP. the installer is in same shape how rest of OpenAL project and many other things around ...
sad to watch
Creative Labs never explained what's new in the 'drivers only' OpenAL 2..0.0 installer
versus the OpenAL website latest 2.0.7.0 installer.
and people are surprised that game and software developers are just ignoring OpenAL or leaving after supporting it in past ... -
How can i replace an apple id that uses a gmail account with my icloud address?
Greetings,
I have an Apple ID that uses a gmail address, which i used to create an iCloud email account. However, I cannot seem to replace my gmail Apple ID with the iCloud address. Is it possible to separate the iCloud email from the gmail address, and make it my only Apple ID i.e. can i scrap the gmail ID and only use my iCloud username as my ID?
KimI'm afraid you can't do this. You can change the ID to another non-Apple address, but you can't make your @icloud.com address the ID.
-
Using Subquery in Select with Rollup (or some way to get grand total)
I am trying to do the following (simplified the query):
SELECT s.SYSTEM,
(SELECT COUNT(cp1.cid) FROM cfrs cp1, systems sp1, subsystems ssp1 where cp1.priority = 'P1' AND cp1.subsystem = ssp1.subsystem AND sp1.system = ssp1.system AND sp1.system = s.system) AS P1
FROM cfrs c, systems s, subsystems ss
WHERE c.subsystem = ss.subsystem
AND s.system = ss.system
GROUP BY ROLLUP(s.SYSTEM)
But the result of the Rollup on the P1 column is always 0 (it is not summing it up)
How can I accomplish a Rollup (or get a grand total) of the subquery result?
Thanks,How about this then:
SQL > WITH SYSTEMS AS
2 (
3 SELECT 'A' AS SYSTEM FROM DUAL UNION ALL
4 SELECT 'B' AS SYSTEM FROM DUAL UNION ALL
5 SELECT 'C' AS SYSTEM FROM DUAL
6 ),
7 SUBSYSTEMS AS
8 (
9 SELECT 'A' AS SYSTEM, '1' AS SUBSYSTEM FROM DUAL UNION ALL
10 SELECT 'A' AS SYSTEM, '2' AS SUBSYSTEM FROM DUAL UNION ALL
11 SELECT 'A' AS SYSTEM, '3' AS SUBSYSTEM FROM DUAL UNION ALL
12 SELECT 'B' AS SYSTEM, '4' AS SUBSYSTEM FROM DUAL UNION ALL
13 SELECT 'B' AS SYSTEM, '5' AS SUBSYSTEM FROM DUAL UNION ALL
14 SELECT 'B' AS SYSTEM, '6' AS SUBSYSTEM FROM DUAL UNION ALL
15 SELECT 'C' AS SYSTEM, '7' AS SUBSYSTEM FROM DUAL UNION ALL
16 SELECT 'C' AS SYSTEM, '8' AS SUBSYSTEM FROM DUAL UNION ALL
17 SELECT 'C' AS SYSTEM, '9' AS SUBSYSTEM FROM DUAL
18 ),
19 CFRS AS
20 (
21 SELECT 10 AS CID, '1' AS SUBSYSTEM, 'HIGH' AS PRIORITY FROM DUAL UNION ALL
22 SELECT 11 AS CID, '1' AS SUBSYSTEM, 'LOW' AS PRIORITY FROM DUAL UNION ALL
23 SELECT 12 AS CID, '1' AS SUBSYSTEM, 'MED' AS PRIORITY FROM DUAL UNION ALL
24 SELECT 13 AS CID, '2' AS SUBSYSTEM, 'HIGH' AS PRIORITY FROM DUAL UNION ALL
25 SELECT 14 AS CID, '2' AS SUBSYSTEM, 'MED' AS PRIORITY FROM DUAL UNION ALL
26 SELECT 15 AS CID, '2' AS SUBSYSTEM, 'HIGH' AS PRIORITY FROM DUAL UNION ALL
27 SELECT 16 AS CID, '3' AS SUBSYSTEM, 'LOW' AS PRIORITY FROM DUAL UNION ALL
28 SELECT 17 AS CID, '3' AS SUBSYSTEM, 'HIGH' AS PRIORITY FROM DUAL UNION ALL
29 SELECT 18 AS CID, '4' AS SUBSYSTEM, 'MED' AS PRIORITY FROM DUAL UNION ALL
30 SELECT 19 AS CID, '5' AS SUBSYSTEM, 'HIGH' AS PRIORITY FROM DUAL UNION ALL
31 SELECT 20 AS CID, '5' AS SUBSYSTEM, 'LOW' AS PRIORITY FROM DUAL UNION ALL
32 SELECT 21 AS CID, '6' AS SUBSYSTEM, 'HIGH' AS PRIORITY FROM DUAL UNION ALL
33 SELECT 31 AS CID, '7' AS SUBSYSTEM, 'LOW' AS PRIORITY FROM DUAL UNION ALL
34 SELECT 41 AS CID, '8' AS SUBSYSTEM, 'HIGH' AS PRIORITY FROM DUAL UNION ALL
35 SELECT 51 AS CID, '9' AS SUBSYSTEM, 'MED' AS PRIORITY FROM DUAL UNION ALL
36 SELECT 61 AS CID, '9' AS SUBSYSTEM, 'MED' AS PRIORITY FROM DUAL
37 )
38 SELECT DECODE(SYSTEM,'ALL_SYSTEMS','Grand Total',SYSTEM) AS SYSTEM
39 , MAX(DECODE(PRIORITY,'LOW',CNT,0)) AS LOW
40 , MAX(DECODE(PRIORITY,'MED',CNT,0)) AS MED
41 , MAX(DECODE(PRIORITY,'HIGH',CNT,0)) AS HIGH
42 , MAX(DECODE(PRIORITY,'ALL_PRIOR',CNT,0)) AS SYSTEM_TOTAL
43 FROM
44 (
45 SELECT DECODE(GROUPING(SYSTEMS.SYSTEM),1,'ALL_SYSTEMS',SYSTEMS.SYSTEM) AS SYSTEM
46 , DECODE(GROUPING(CFRS.PRIORITY),1,'ALL_PRIOR',CFRS.PRIORITY) AS PRIORITY
47 , COUNT(*) AS CNT
48 FROM SYSTEMS
49 JOIN SUBSYSTEMS ON SYSTEMS.SYSTEM = SUBSYSTEMS.SYSTEM
50 JOIN CFRS ON SUBSYSTEMS.SUBSYSTEM = CFRS.SUBSYSTEM
51 GROUP BY CUBE(SYSTEMS.SYSTEM,CFRS.PRIORITY)
52 ORDER BY SYSTEMS.SYSTEM, CFRS.PRIORITY
53 )
54 GROUP BY DECODE(SYSTEM,'ALL_SYSTEMS','Grand Total',SYSTEM)
55 ORDER BY DECODE(SYSTEM,'ALL_SYSTEMS','Grand Total',SYSTEM)
56 /
SYSTEM LOW MED HIGH SYSTEM_TOTAL
A 2 2 4 8
B 1 1 2 4
C 1 2 1 4
Grand Total 4 5 7 16Oh, BTW, use "code" wrapped in "{}" on either side to post nicely formatted code.
Maybe you are looking for
-
Facing problem to Use a custom Java class in UCCX
/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in
-
SharePoint 2010 Search "Did You Mean" | How does it work?
My customer has raised a concern that "Did you mean" functionality works inconsistently and issue is explained as below: 1. When I search for misspelled word such as "Maketting" , search page displays the option "Did you mean ""Marketting"? 2. When I
-
Editor extensions in 3.0 - several questions
We use editor extensions for several types of objects. It's not clear how to add extensions to PL/SQL objects. In my XML file I use for packages/procedures : node="PlSqlBaseNode" This works, but it's only showing my first extension. My second extensi
-
Just archived & installed to fix OSX, now what's the best way to restore?
So recently my OSX stopped working for reasons unknown to me, but an archive and install saved my life, thank god. However, now I have this folder with all my previous files and applications, I'm wondering if there's an easy way to restore my compute
-
Determing database availaibility.
Hi. I am a junior dba and am really finding it hard to put things in correct order. By boss wants me to provide some statistical data regarding database availability! Would like to know if there are scripts that will give an oracle database availabil