How to limit the lines on the union of two sqls
Hi allThe sql below returns two lines when the column value 3 (VALUE2) has a value other than 0 in the second sql.
I want that the result set to return the second row, when there is a match in the first row.
Thanks for you help,
Hozy
---------------------------
with options like
(
Select the PROPERTY 'AUDIT_CREATE_ROLE', "CREATE ROLE" VALUE, VALUE2 0 in union double
Select the PROPERTY 'AUDIT_DROP_ANY_ROLE', 'DROP ANY ROLE' VALUE, 0 VALUE2 to double union
Select the PROPERTY 'AUDIT_EXECUTE_PROCEDURE', 'PROCEDURE' VALUE, VALUE2 0 in double union
Select the PROPERTY 'AUDIT_SELECT_ANY_DICTIONARY', "SELECT ANY DICTIONARY" VALUE, 0 union double VALUE2
Select the PROPERTY 'AUDIT_GRANT_ANY_OBJECT', 'GRANT ANY OBJECT' VALUE, 0 VALUE2 to double union
Select the PROPERTY 'AUDIT_CREATE_LIBRARY', 'CREATE LIBRARY' VALUE, VALUE2 0 in union double
Select ' AUDIT_AUD$ ' PROPERTY 'AUD$ ' VALEUR0, VALUE2 to double union
Select the PROPERTY 'AUDIT_ALTER_ANY_TABLE', 'ALTER ANY TABLE' VALUE, 0 VALUE2 to double union
Select the PROPERTY 'AUDIT_ALTER_USER', 'ALTER USER' VALUE, VALUE2 0 in union double
Select the PROPERTY 'AUDIT_CREATE_USER', "CREATE USER" VALUE, VALUE2 0 in union double
Select the PROPERTY 'AUDIT_CREATE_SESSION', "CREATE SESSION" VALUE, VALUE2 0 in double union
Select the PROPERTY 'AUDIT_DROP_ANY_PROCEDURE', 'DROP ANY PROCEDURE' VALUE, 0 VALUE2 to double union
Select the PROPERTY 'AUDIT_DROP_ANY_TABLE', 'DROP ANY TABLE' VALUE, 0 VALUE2 to double union
Select the PROPERTY 'AUDIT_GRANT_ANY_PRIVILEGE', 'GRANT ANY PRIVILEGE' VALUE, 0 VALUE2 to double union
Select the PROPERTY 'AUDIT_GRANT_ANY_LIBRARY', 'CREATE ANY LIBRARY' VALUE, 0 double VALUE2
)
Select the PROPERTY VALUE, value2
one of the options
Union
SELECT "AUDIT_ | REPLACE (audit_option, ", '_') as a PROPERTY.
audit_option as VALUE, COUNT (*) as VALUE2 - how can I get this information from County?
OF dba_stmt_audit_opts
WHERE UPPER (audit_option) IN ('EDIT ANY TABLE', 'ALTER USER', 'CREATE a ROLE', 'CREATE a USER', 'CREATE THE SESSION', "DROP ANY PROCEDURE', 'DROP no matter WHAT TABLE", 'GRANT NO PRIVILEGE', "DROP no matter WHAT ROLE", "PROCEDURE", "SELECT ANY DICTIONARY", "No matter WHAT PURPOSE of the GRANT", 'CREATE any WHAT LIBRARY', 'CREATE LIBRARY')
AND the success = "BY ACCESS.
AND failure = "BY ACCESS.
AND user_name IS NULL
AND proxy_name IS NULL
Audit_option group
Hozy says:
This is what the original sql looks like and now I don't know how to insert it in your suggested sql.
Where I put your original query in a subquery with an alias by dsao, just replace this application with your new query.
Another thing - you use 'union '; I think this safely could be replaced by "union all", as it seems that the lines will not be duplicated between the two queries.
with options as (select 'AUDIT_CREATE_ROLE' property, 'CREATE ROLE' value from dual union all
select 'AUDIT_DROP_ANY_ROLE' property, 'DROP ANY ROLE' value from dual union all
select 'AUDIT_EXECUTE_PROCEDURE' property, 'EXECUTE PROCEDURE' value from dual union all
select 'AUDIT_SELECT_ANY_DICTIONARY' property, 'SELECT ANY DICTIONARY' value from dual union all
select 'AUDIT_GRANT_ANY_OBJECT' property, 'GRANT ANY OBJECT' value from dual union all
select 'AUDIT_CREATE_LIBRARY' property, 'CREATE LIBRARY' value from dual union all
select 'AUDIT_AUD$' property, 'AUD$' value from dual union all
select 'AUDIT_ALTER_ANY_TABLE' property, 'ALTER ANY TABLE' value from dual union all
select 'AUDIT_ALTER_USER' property, 'ALTER USER' value from dual union all
select 'AUDIT_CREATE_USER' property, 'CREATE USER' value from dual union all
select 'AUDIT_CREATE_SESSION' property, 'CREATE SESSION' value from dual union all
select 'AUDIT_DROP_ANY_PROCEDURE' property, 'DROP ANY PROCEDURE' value from dual union all
select 'AUDIT_DROP_ANY_TABLE' property, 'DROP ANY TABLE' value from dual union all
select 'AUDIT_GRANT_ANY_PRIVILEGE' property, 'GRANT ANY PRIVILEGE' value from dual union all
select 'AUDIT_CREATE_ANY_LIBRARY' property, 'CREATE ANY LIBRARY' value from dual),
dsao as (select 'AUDIT_'||replace(audit_option, ' ', '_') as property,
audit_option as value,
count(*) as value2
from dba_stmt_audit_opts
WHERE UPPER(audit_option) IN ('ALTER ANY TABLE',
'ALTER USER',
'CREATE ROLE',
'CREATE USER',
'CREATE SESSION',
'DROP ANY PROCEDURE',
'DROP ANY TABLE',
'GRANT ANY PRIVILEGE',
'DROP ANY ROLE',
'EXECUTE PROCEDURE',
'SELECT ANY DICTIONARY',
'GRANT ANY OBJECT',
'CREATE ANY LIBRARY',
'CREATE LIBRARY')
AND success = 'BY ACCESS'
AND failure = 'BY ACCESS'
AND user_name IS NULL
AND proxy_name IS NULL
GROUP BY audit_option
union all
select 'AUDIT_'|| replace(object_name,' ','_') as property,
object_name as value,
count(*) as value2
from dba_obj_audit_opts
where object_name='AUD$'
and owner in ('SYSTEM','SYS')
and object_type='TABLE'
and upd='A/A'
and del='A/A'
group by audit_option)
select o.property, o.value, nvl(dsao.value2, 0) value2
from options o,
dsao
where o.value = dsao.value (+)
Tags: Database
Similar Questions
-
How to limit the length of the texts on iOS9?
Hello
I just worked on why I am required by my mobile / cell phone provider EA. They charge any text as a picture message / SMS, it is longer than 120 characters? Does anyone know how to limit the length of the texts / SMS so that it is impossible to send a more 120 characters or create an alert so that you are aware of the number of characters in the text / sms?
Thank you very much
Hello Turnus123,
Thank you for using communities of Apple Support.
I see that you will have to pay for SMS more than 120 characters. To help identify messages exceeds this amount, you can activate a number of characters in the message settings. Simply go to settings > Messages and activate "number of characters".
Take care.
-
I have a new time capsule airport. How to limit the search for who can use the time capsule backup process?
Set a password to disk... disk tab in the utility... and just give to those you want to use the TC...
-
How to compare the content of two Wordpad / documents notebook without reading them line by line?
Hello
Without this feature is included in the operating system.
However, you can use your favorite search engine to look for software that needs to perform these tasks.
WARNING of THIRD PARTY SOFTWARE: Using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.
Hope this information helps.
-
How to limit the media sharing on my computer
Original title: multimedia file sharing...
How to limit the sharing on my computer, IE multimedia: music, images and other files from other computers on the network or cell phones that are capable of DLNA?
Hello
Please check the links given and see if they help.Most of file sharing: http://windows.microsoft.com/en-US/windows-vista/File-sharing-essentials
File and printer sharing: frequently asked questions: http://windows.microsoft.com/en-US/windows-vista/File-and-printer-sharing-frequently-asked-questions
-
How to limit the email receipt/downloaded size?
I need information on how to limit the size of an email received or downloaded in Windows Mail to reduce the cost of the enamel of satellite data. Want to just send and receive, especially to receive emails with no graphics and keep it small.
Simply set up for this purpose a message rule: tools, Message rules, mail, new...Gary van, Microsoft MVP (Mail)
------------------------------------------------------"moosehuntingguy" wrote in the new message: * e-mail address is removed from the privacy... *I need information on how to limit the size of an email received or downloaded in Windows Mail to reduce the cost of the enamel of satellite data. Want to just send and receive, especially to receive emails with no graphics and keep it small.Gary van, MVP (Mail)
-
How to limit the number of printers can be installed on this computer by using Group Policy?
How to limit the number of printers can be installed on this computer by using Group Policy?
Hello
Thanks for asking! If I understand correctly, you should limit the printers installed on the computer by using Group Policy. I suggest you follow the troubleshooting steps to check if this may help.
The question you have posted is related to Technet and would be better suited to the Technet community. Please visit the link below to find a community that will provide the best support.
http://social.technet.Microsoft.com/forums/en-us/category/WindowsServer -
If I don't get creative cloud, how will limit the use of photoshop touch?
If I don't get creative cloud, how will limit the use of photoshop touch?
I don't think it will limit your work with PS Touch, but could enahnce it a little.
Just try to free membership of 2 GB and find out:
https://creative.Adobe.com/plans
Thank you!
-
How to limit the number of connection to DB
Hello
I just go to the topic of connection pooling.
Here, I would like to understand the number of details of connections that already exists in the database.
Kindly guide me to know the following details.
How to know the number of connections available in the database?
How to limit the number of connections?
V_$ Resource_Limit contains details of the sessions. Is this even for connections?
I have more clarification on the difference of connections and Sessions.
Kindly tell me the above.
Thank you
Orahar.Orahar wrote:
HelloI just go to the topic of connection pooling.
Here, I would like to understand the number of details of connections that already exists in the database.Kindly guide me to know the following details.
How to know the number of connections available in the database?
The number of currently active sessions (db, internal sessions registered)
SELECT COUNT (*)
SESSION $ vHow to limit the number of connections?
to increase or decrease the maximum number of connections:
for example: change processes control system = 200 scope = spfile;
>
V_$ Resource_Limit contains details of the sessions. Is this even for connections?
I have more clarification on the difference of connections and Sessions.
Connection means a user process is successfully connected to the listener to have a session on the database running instance. (listener who listen s new connection requests)
Establish sessions: means, a (dedicated) server process began to serve a user process. It is done when the credentials of the user authenticated successfully. Now, from process-user shall communicate to the server process directly.hope that helps.
Kind regards
X. -
How to limit the length of the EditText control?
All,
How to limit the length of an EditText to accept ONLY 3 characters.
The editText.characters property defines a size by default, but the user can always type more than 3 characters in the field.
I got it!!!
var win = new Window("dialog", "Limit 3"); var txtLimit3 = win.add("edittext"); txtLimit3.characters = 5; txtLimit3.onChanging = function (){ howmany = txtLimit3.text; if (howmany.length > 3){ txtLimit3.text = ""; txtLimit3.textselection = howmany.slice(0,3) } } txtLimit3.active = true; win.show();
-
How to convert the hierarchical query of SQL Server (CTE) to Oracle?
How to convert the hierarchical query of SQL Server (CTE) to Oracle?
WITH cte (col1, col2) AS
(
SELECT col1, col2
FROM dbo. [tb1]
WHERE col1 = 12
UNION ALL
SELECT c.col1, c.col2
FROM dbo. [tb1] AS c INNER JOIN cte AS p ON c.col2 = p.col1
)
DELETE one
FROM dbo. [tb1] AS an INNER JOIN b cte
ON a.col1 = b.col1Hello
Something like this maybe:DELETE FROM dbo.tb1 a WHERE EXISTS ( SELECT 1 FROM dbo.tb1 b WHERE a.co11 = b.col1 AND a.col2 = b.col2 START WITH b.col1 = 12 CONNECT BY b.col2 = PRIOR b.col1)
Although you need to do here is to check that CONNECT it BY SELECT, returns records you wait first, then the DELETION should work too.
-
How to calculate the sum of two digital form fields based on the selection of the checkbox.
I have a form in Acrobat Pro who needs a custom calculation. How to calculate the sum of two digital form fields based on a selection of the checkbox. I have three number fields. Field-A and B are simple one or two digits. Field-C is the sum, or the total field. I want to field-C have a control box which, when turned on and off, just gives a. gives the sum of A + B
_ Field - 2
_ Field - A 4
[check] _ _ field - 6 C
[disabled] _ _ field - 2 C
Thank you
The custom field C calculation script could be:
(function () { // Get the values of the text fields, as numbers var v1 = +getField("A").value; var v2 = +getField("B").value; // Set this field's value based on the state of the check box named "CB" if (getField("CB").value !== "Off") { event.value = v1 + v2; } else { event.value = v1; } })();
Replace 'A', 'B', and 'CB' with the real names of the fields.
-
How to solve the problem of Oracle SQL Developer Connection?
People,
Hello. I use the Oracle 11 GR 1 material database. The database https://localhost.localdomain:1158 control console / em works correctly. I can create a database and a table with success.
My OS is Linux and connects to the internet successfully.
In order to execute SQL statements. We use Oracle SQL Developer. I connect Oracle SQL Developer in the following way:
Connection name: DB1 (is my database name)
User name: SYS (this is the user name I used to connect to the Console)
Password: SYS (this is the password used to connect to the Console)
Connection type: basic
Host name: localhost
Port: 1158
SID: DB1 (it is created during the installation of the database)
But the error message: "status: failed - IO exception Connection Reset."
Can any folk tell me how to solve the problem of Oracle SQL Developer Connection?user8860348 wrote:
People,Hello. I use the Oracle 11 GR 1 material database. database Control Panel https://localhost.localdomain:1158 / em works correctly. I can create a database and a table with success.
My OS is Linux and connects to the internet successfully.
In order to execute SQL statements. We use Oracle SQL Developer. I connect Oracle SQL Developer in the following way:
Connection name: DB1 (is my database name)
User name: SYS (this is the user name I used to connect to the Console)
Password: SYS (this is the password used to connect to the Console)
Connection type: basic
Host name: localhost
Port: 1158
SID: DB1 (it is created during the installation of the database)But the error message: "status: failed - IO exception Connection Reset."
Can any folk tell me how to solve the problem of Oracle SQL Developer Connection?
user name: sys
password: enter_your_correct_password given at the time of the installation of oraclerole: select sysdba if you would connect as sysdba otherwise select normal for users other than the sys
HostName: Enter your ip or hostname of the oracle example server address:-192.168.11.12
to find the terminal/command prompt open hostname in oracle installed machine
type---> hostnametype ping hostname--->
You can find the IP address of the server
Port number: 1521 (default)---> I guess, otherwise check the port number in the file tnsnames.ora under your ORACLE_HOME/network/admin folder
SID: DB1
try it
Good luck -
How to avoid the SEPARATE in OBIEE SQL
Hello...
For the issue I posted previously...
Problem with the data type LONG in responses
I executed the query into a FROG, and I've identified the error because of what this error is coming... because of SEPARATE...
I took care to avoid this column in ORDER BY putting order on another column...
Now my question is how to avoid the DISTINCT clause in SQL generated by OBIEE...
If the first column of criteria is then it avoids the SEPARATE... but if I use measure... Group of will come... and group of should not be used here...
If it's done... my problem is solved...
Of course... I get duplicate rows...
However, I want the answer how avoid SEPARATE?
Waiting for the response from your...
Thanks and greetings
Kishore GuggillaKishore,
In the physical layer, open the properties of physical catalog and in the features tab find DISTINCT_SUPPORTED and remove the check box value.
who removed separate in each query generated for this database.
-Madan
-
concatenate the output of two sqls.
Hi all
I'm trying to concatenate the output of two sqls
It should be fairly simple, but somehow I find it hard today.
Here's the sql code.
< code >
Select (select to_char (sysdate, 'YYYYMMDD') of double) | "| (select the CHILD_SEQ.nextval of the double) of the double
< code >
I'm working on Oracle 11 g.
Kindly help.
use
What's the problem with just doing...
SQL > create the sequence child_seq;
Order of creation.
SQL > ed
A written file afiedt.buf1 * select to_char (sysdate, 'YYYYMMDD') | The double CHILD_SEQ.nextval
SQL > /.TO_CHAR (SYSDATE, 'YYYYMMDD') | CHILD_SEQ. NEXTVAL
------------------------------------------------
201408131SQL >
I hope you're not uing a primary touch well and trying to 'reset' the sequence every day. This is not recommended and not scalable; keep primary keys simple by simply using a sequence and treat sysdate as a piece of data and other data. If you need to get "sequences" for a particular day you can create them on the fly using row_number() over (partition by primarykeycolumn order datecolumn) where your datecolumn is the cut off date (trunc (sysdate)) and the primary key column is just the value of sequence assigned to the record.
Maybe you are looking for
-
Sometimes after connecting to my keyboard does not work in the system (firefox, notepad, word, etc.) and I have to restart firefox.
-
Satellite U920t curtains blackout - lights blinking but the screen is completely released
Hi everyone, I really would like to get help here. My relatively new Satellite U920T - 10G turns off without reason. I turned it on as Tablet and when I pulled the keyboard, he became all black. At first, when I've quand j' ai cache hidden keyboard t
-
Internet Explorer does not work after Vista Service Pack 2 installation with IE 8
I accepted the installation of Vista Service Pack 2 yesterday with IE 8 upgrade. Now, I can't get IE 8 or Firefox to connect to the Internet. I checked my config proxy and it is set to auto detect. I had Vista analyze my connection with my wireles
-
routers that will keep the dhcp leases in the flash memory?
If a router is turned off, it will keep its current list of active DHCP leases? Is there any router that will do it? Sometimes when the internet is slow, my users will unplug the router/modem, but this results in IP address conflicts when new compute
-
General performance issues.
A ran MS package of performance problem which shows spoolsrv in 54% of the CPU and not other errors report no probs with memory, cache etc. Have 2 computers on the network, one connected to the router by ethernet and the other by usb Canon printer sh