order of the sql operation

Hi experts,

I want to erase my basics here.

I want to know the order of the sql operation.

in fact the problem with me I've read websites and different blog

on the order of operation of sqkl requests, so I'm confused here.

I think that the order of operation iis

-MY assumptuion-

Of

|

where

|

Group

|

having

|

Select

|

order by

---------------------------

My assupmtion is correct?

If so, then if suppose there is clause rownum in my selection criteria, when

It will apply?

on some sites I've seen criteria below

--------------------------------------------

1. FROM/WHERE clause goes first.

2 ROWNUM is assigned and incremented for each line of output FROM/WHERE clause.

3. SELECT is applied.

4 GROUP BY is applied.

5 WHO is applied.

6 ORDER BY is applied.

-------------------------------------

is that correct or my assumption is correct?

Thank you very much in advance... !!

Kind regards

Prashant

Hello

969262 wrote:

Hello

I'm more confused now that everyone has to give a different answer...:)

Blushadow said something that can really help you:

Queries are not always run in a linear fashion

Once you see a step by step ordered arrangement, it is (at best) how things looked from a point of view, and it can be useful to understand some aspects of the work of the database, but not all.

If you must have a single ordered list, so what you posted first is, according to me, the more accurate for the majority of cases:

  1. Of
  2. where
  3. Group
  4. having
  5. Select
  6. order by

This can help you understand logically how to write SQL statements and predict their outcome.  For example, think that, when it happens before that GROUP BY allows to remember that you can not use an aggregate function, such as COUNT in a WHERE clause, because the aggregate functions are calculated as part of the process GROUP.

How to write a SQL statement and how the optimizer decides to pay in fact, are two different things.  The optimizer do not follow the sequence posted above, or any other sequence of steps.  To see how a particular statement is made, given some data in particular, there is no substitute for watching the execution plan.

Tags: Database

Similar Questions

  • Run (or re-run) orders in the SQL * more buffer

    I'm confused about sql / command. by defination, it run (or re-run) orders in the SQL * more buffer. How do I know if it execete or re - run a command?
    for example, I run a select statement, seems that I have to type / for the result. When I run a create table statement, it seems to run twice with / and table I is error.

    Someone could clearify when must - be used and when not to use it.

    As suggested Aman, that's the difference between a pl/sql block and a SQL statement (DDL or DML).

    The semicolon is therefore not a part of SQL when you enter a statement SQL, SQL * Plus knows and will execute the statement as soon as she sees a point comma (which ends with the statement), or slash (run the buffer).

    But a semicolon is a pl/sql statement terminator. So when you enter a pl/sql block, SQL * Plus keeps accepting lines of code until you have finished and then send the entire block to the database when you type a slash. This is also true when you enter CREATE PROCEDURE etc.

  • I need to upgrade the entire operating system, in order to get Safari 8.0?

    Apparently, my Bank now requires Safari 8.0 continue to use their online service.

    10.7.5 running w/safari 6.1.6... can't seem to find an update to version 8.0.

    I need to upgrade the entire operating system, in order to get Safari 8.0?

    How the last OS are there, more on Intel 2.4 GHz Core i5?

    Compatibility problems, that I should be aware, before I update?

    1. Yes, or switch to a product such as Firefox.

    2. it depends on the amount of RAM in the computer. She should have at least 4 GB.

    3. click here and search for your software.

    (138498)

  • Customize the operator for the SQL command

    With JDeveloper 12.1.3, I created a search form "Panel with ADF Query Table".  After having specified the search parameters, the SQL that is subject to the MSSQL root command generates the following error message:

    < oracle.adf.controller > < Utils > < buildFacesMessage > < ADF: addition of the following JSF error: incorrect syntax [FMWGEN] [SQLServer JDBC Driver] [SQL Server] close to ' |'. >

    java.sql.SQLException: incorrect syntax [FMWGEN] [SQLServer JDBC Driver] [SQL Server] close to ' |'.

    Here is the part of SQL code that is the question:

    WHERE (((city AS (?) || '%')) AND (State AS (?) || '%') ) ) ) )

    Since MSSQL does not accept the "|" as an operator is valid, an error message is generated.  MSSQL expects the CONCAT function or operator ' + '.  Is it possible and easy to configure JDeveloper for change the operator of ' | ' to the CONCAT function?

    OK, your settings are looking as it should.

    You have two options to work around the problem.

    (1) use your own sql generator, as shown here http://www.jobinesh.com/2013/02/customizing-sql-builder-class.html

    (2) modify the sql code generated for the START WITH operator generate the right sql for sql server code. For this, you can override the method getViewCriteriaItem() as shown here https://tompeez.wordpress.com/2011/08/21/extending-viewcriteria-to-use-sql-contains-4/

    Timo

  • ORA-29283: invalid file operation, SP2-0103: nothing in the SQL buffer to run.

    Hi gurus of the Oracle,.

    Our version of oracle's 11 g RAC 2.

    We write records into a file using utl_file.

    According to the request, data should write to 160 files.

    After writing to 50 records, his mistake to launch. as

    BEGIN PROC_WRITE_TO_FILE; END;

    *

    ERROR on line 1:

    ORA-29283: invalid file operation

    ORA-06512: at "SYS." UTL_FILE", line 536

    ORA-29283: invalid file operation

    ORA-06512: at "TEST. PROC_WRITE_TO_FILE', line 130 '.

    ORA-06512: at line 1

    SQL > SP2-0103: nothing in the SQL buffer to run.

    My procedure is

    -DECLERATION

    BEGIN

    OPEN C2;

    LOOP

    EXTRACT THE C2 IN P_WRITE;

    WHEN THE EXIT C2% NOTFOUND;

    L_NAME: = "WRITE" | P_WRITE | » _. TXT';

    L_FILE: = UTL_FILE. FOPEN (L_DIR, L_NAME, 'W');

    OPEN C1 (P_WRITE);

    LOOP

    FETCH C1 INTO P_OD_PLACE, P_OD_USER, P_ED_PERF, P_GM_LST, P_GM_FIRST, P_GM_MOD, P_GM_SUFF, P_BD_NUM, P_BD_FRET, P_BD_UNIT, P_BD_GOLE, P_BD_GEP, P_DAT_BOD, P_DAT_EFF, P_ED_RACE, P_ED_GENDER, P_LAND_DIST, P_LAND_LOT, P_ED_STAT_REASON ,P_OD_PRECINCT,P_OD_JANI_PREC,P_NB_PIST_CNG,P_NB_PIST_SEN,P_NB_PIST_VASER,P_NB_PIST_JUD,P_NB_PIST_COMMI,P_NB_PIST_SCHOL,P_NB_PIST_WD,P_NB_PIST_JANIB,P_NB_PIST_JANIC,P_NB_PIST_FIRE,P_NB_PIST_SCHOB,P_NB_PIST_SUPCM,P_NB_PIST_WATBD,P_NB_PIST_GOLEL P_GM_NAME, P_ED_JANI_CODE, P_DAT_ACCEPT, P_DAT_CHANGED, P_OD_COMBO, P_TX_DESC, P_DAT_LST_CTT, P_BD_NUM2, P_BD_FRET1, P_BD_UNIT2, P_BD_GOLE2, P_BD_ST, P_BD_GEP5, P_BD_GEP4, P_BD_FRET2, P_BD_FRET3, P_BD_COUNTRY;

    WHEN EXIT C1% NOTFOUND;

    UTL_FILE. PUT_LINE (L_FILE, P_OD_PLACE: ' |) ' || P_OD_USER |' | ' || P_ED_PERF |' | ' || P_GM_LST |' | ' || P_GM_FIRST |' | ' || P_GM_MOD |' | ' || P_GM_SUFF |' | ' || P_BD_NUM |' | ' || P_BD_FRET |' | ' || P_BD_UNIT |' | ' || P_BD_GOLE |' | ' || P_BD_GEP |' | ' || P_DAT_BOD |' | ' || P_DAT_EFF |' | ' || P_ED_RACE |' | ' || P_ED_GENDER |' | ' || P_LAND_DIST |' | ' || P_LAND_LOT |' | ' || P_ED_STAT_REASON |' | ' || P_OD_PRECINCT |' | ' || P_OD_JANI_PREC |' | ' || P_NB_PIST_CNG |' | ' || P_NB_PIST_SEN |' | ' || P_NB_PIST_VASER |' | ' || P_NB_PIST_JUD |' | ' || P_NB_PIST_COMMI |' | ' || P_NB_PIST_SCHOL |' | ' || P_NB_PIST_WD |' | ' || P_NB_PIST_JANIB |' | ' || P_NB_PIST_JANIC |' | ' || P_NB_PIST_FIRE |' | ' || P_NB_PIST_SCHOB |' | ' || P_NB_PIST_SUPCM |' | ' || P_NB_PIST_WATBD |' | ' || P_NB_PIST_GOLEL |' | ' || P_GM_NAME |' | ' || P_ED_JANI_CODE |' | ' || P_DAT_ACCEPT |' | ' || P_DAT_CHANGED |' | ' || P_OD_COMBO |' | ' || P_TX_DESC |' | ' || P_DAT_LST_CTT |' | ' || P_BD_NUM2 |' | ' || P_BD_FRET1 |' | ' || P_BD_UNIT2 |' | ' || P_BD_GOLE2 |' | ' || P_BD_ST |' | ' || P_BD_GEP5 |' | ' || P_BD_GEP4 |' | ' || P_BD_FRET2 |' | ' || P_BD_FRET3 |' | ' || P_BD_COUNTRY);

    UTL_FILE. FFLUSH (L_FILE);

    END LOOP;

    CLOSE C1;

    END LOOP;

    CLOSE C2;

    UTL_FILE. FCLOSE (L_FILE);

    END;

    /

    Appreciate your suggestions.

    Thank you and best regards,

    REDA

    You understand, but you can't do it?  What?  Move a single line in the right place?

    * sigh * I wish I was your code monkey...

    -DECLERATION

    BEGIN

    OPEN C2;

    LOOP

    EXTRACT THE C2 IN P_WRITE;

    WHEN THE EXIT C2% NOTFOUND;

    L_NAME: = "WRITE" | P_WRITE | » _. TXT';

    L_FILE: = UTL_FILE. FOPEN (L_DIR, L_NAME, 'W');

    OPEN C1 (P_WRITE);

    LOOP

    FETCH C1 INTO P_OD_PLACE, P_OD_USER, P_ED_PERF, P_GM_LST, P_GM_FIRST, P_GM_MOD, P_GM_SUFF, P_BD_NUM, P_BD_FRET, P_BD_UNIT, P_BD_GOLE, P_BD_GEP, P_DAT_BOD, P_DAT_EFF, P_ED_RACE, P_ED_GENDER, P_LAND_DIST, P_LAND_LOT, P_ED_STAT_REASON ,P_OD_PRECINCT,P_OD_JANI_PREC,P_NB_PIST_CNG,P_NB_PIST_SEN,P_NB_PIST_VASER,P_NB_PIST_JUD,P_NB_PIST_COMMI,P_NB_PIST_SCHOL,P_NB_PIST_WD,P_NB_PIST_JANIB,P_NB_PIST_JANIC,P_NB_PIST_FIRE,P_NB_PIST_SCHOB,P_NB_PIST_SUPCM,P_NB_PIST_WATBD,P_NB_PIST_GOLEL P_GM_NAME, P_ED_JANI_CODE, P_DAT_ACCEPT, P_DAT_CHANGED, P_OD_COMBO, P_TX_DESC, P_DAT_LST_CTT, P_BD_NUM2, P_BD_FRET1, P_BD_UNIT2, P_BD_GOLE2, P_BD_ST, P_BD_GEP5, P_BD_GEP4, P_BD_FRET2, P_BD_FRET3, P_BD_COUNTRY;

    WHEN EXIT C1% NOTFOUND;

    UTL_FILE. PUT_LINE (L_FILE, P_OD_PLACE: ' |) ' || P_OD_USER |' | ' || P_ED_PERF |' | ' || P_GM_LST |' | ' || P_GM_FIRST |' | ' || P_GM_MOD |' | ' || P_GM_SUFF |' | ' || P_BD_NUM |' | ' || P_BD_FRET |' | ' || P_BD_UNIT |' | ' || P_BD_GOLE |' | ' || P_BD_GEP |' | ' || P_DAT_BOD |' | ' || P_DAT_EFF |' | ' || P_ED_RACE |' | ' || P_ED_GENDER |' | ' || P_LAND_DIST |' | ' || P_LAND_LOT |' | ' || P_ED_STAT_REASON |' | ' || P_OD_PRECINCT |' | ' || P_OD_JANI_PREC |' | ' || P_NB_PIST_CNG |' | ' || P_NB_PIST_SEN |' | ' || P_NB_PIST_VASER |' | ' || P_NB_PIST_JUD |' | ' || P_NB_PIST_COMMI |' | ' || P_NB_PIST_SCHOL |' | ' || P_NB_PIST_WD |' | ' || P_NB_PIST_JANIB |' | ' || P_NB_PIST_JANIC |' | ' || P_NB_PIST_FIRE |' | ' || P_NB_PIST_SCHOB |' | ' || P_NB_PIST_SUPCM |' | ' || P_NB_PIST_WATBD |' | ' || P_NB_PIST_GOLEL |' | ' || P_GM_NAME |' | ' || P_ED_JANI_CODE |' | ' || P_DAT_ACCEPT |' | ' || P_DAT_CHANGED |' | ' || P_OD_COMBO |' | ' || P_TX_DESC |' | ' || P_DAT_LST_CTT |' | ' || P_BD_NUM2 |' | ' || P_BD_FRET1 |' | ' || P_BD_UNIT2 |' | ' || P_BD_GOLE2 |' | ' || P_BD_ST |' | ' || P_BD_GEP5 |' | ' || P_BD_GEP4 |' | ' || P_BD_FRET2 |' | ' || P_BD_FRET3 |' | ' || P_BD_COUNTRY);

    UTL_FILE. FFLUSH (L_FILE);

    END LOOP;

    CLOSE C1;

    UTL_FILE. FCLOSE (L_FILE);

    END LOOP;

    CLOSE C2;

    END;

    /

  • Hello. You will need to update Mac OS El Capitan. Currently have v.8 CS Photoshop and Lightroom 2 v.2.4. In order just to work with the new operating system, please inform for updating both.

    Currently have v.8 CS Photoshop and Lightroom 2 v.2.4. In order just to work with the new operating system, please inform for updating both.

    Hi R0w1% 40nd,

    Adobe Photoshop CS v.8 and Lightroom 2 v.2.4. are very old software and the operating system you are using is the most recent, so there may be compatibility issues that adobe has not tested these applications on newer operating systems.

    The installer for Adobe Photoshop CS v.8 and Lightroom 2 v.2.4. are no longer available.

    You can see the creative Cloud, creative cloud and rates membership plans | Adobe Creative Cloud

  • Oracle dynamic SQL with the UNION operator

    Hello

    I have sql string contains two queries separated by the UNION operator. When I run by using DBMS_SQL, it becomes only the first SQL before the UNION operator.

    Can anyone correct how can I Sue UNION in DBMS_SQL?

    Thank you

    Sorry,

    I tested my code

                        BEGIN
                          FOR I IN (SELECT 1 A FROM DUAL UNION
                                  SELECT 2 A  FROM DUAL UNION
                                  SELECT 3 A  FROM DUAL) LOOP
                          DBMS_OUTPUT.PUT_LINE(I.A);
                         END LOOP;
                        END;
                        
    

    and copy this code and PASE to DBMS_SQL. PARSE (all other cases, "... and insert the INSERT STATEMENT but does not erase DBMS_OUTPUT.")

    Edited by: Quluzade Mr. Mahir on February 28, 2011 12:18

  • Keep the order of the elements stored in the table pl.sql

    Hello friends,

    I'm having a type registration and for each item in the folder, I'll have the corresponding table of pl.sql type.

    If I store the values in the records in a query and also the individual elements in the table of pl.sql type will be of the order of the data is stored as it is. ..

    for example...

    in a record type, the data is stored as (name1, years1, salary1), (name2, age2, salary2)

    If I store in correspondent pl sql table type name1, name2
    years1, age2
    salary1, salary2

    I can identify the index of the record type with that of type pl/sql table...

    pls advice

    Thank you/kumar

    Kumar,

    Yes, the order of the elements will be the same.

    No specific reason why you want to create a collection for each attribute of the record?
    You can also declare another variable of the same file and initialize it.

    Some other suggestions for your code:

    (1) FOR 2nd loop can be changed to accommodate the request of the first slider he - by eliminating an extra iteration.

    SELECT MINC.FAMID,
                         MINC.MEMBNO,
                         MEMB.AGE,
                         SALARYX,
                         SALARYBX,
                         NONFARMX,
                         NONFRMBX,
                         FARMINCX,
                         FRMINCBX,
                         CU_CODE
                    FROM MINC, MEMB, FMLY
                   WHERE MINC.FAMID = MEMB.FAMID
                     AND MINC.MEMBNO = MEMB.MEMBNO
                     AND MINC.FAMID = FMLY.FAMID
                     AND MEMB.FAMID = FMLY.FAMID
                   ORDER BY MINC.FAMID
    

    (2) the collections can alternatively be initialized as follows:

       v_member_rec(v_member_rec.last).FAMID := j.FAMID;
       max_earnings_tab(max_earnings_tab.last) := v_max_earnings;
    

    The I tried the example for confirmation below...

    declare
     type emp_rec is record
     (name emp.ename%TYPE,
      dept emp.edept%TYPE,
      sal  emp.esal%TYPE
     );
    
     TYPE emp_rec_tab is table of emp_rec;
     ert emp_rec_tab := emp_rec_tab();
    
     TYPE ename_tab is table of varchar2(20);
     ent  ename_tab := ename_tab();
    
     TYPE edept_tab is table of number;
     edt  edept_tab := edept_tab();
    begin
     for i in (select * from emp)
     loop
         ert.extend;
         ent.extend;
         edt.extend;
    
         ert(ert.last).name := i.ename;
         ert(ert.last).dept := i.edept;
         ert(ert.last).sal := i.esal;
    
         ent(ent.last) := i.ename;
         edt(edt.last) := i.edept;
     end loop;
    
     for i in 1..ert.count
     loop
         dbms_output.put_line(ert(i).name||','||ent(i));
         dbms_output.put_line(ert(i).dept||','||edt(i));
         dbms_output.put_line('');
     end loop;
    end;
    
  • '||' Operator in the sql query

    Hi all
    We use the "|" operator in the sql query. Under the terms of the performance, it's beneficial or not?
    Please suggest me.

    Select * from EMP
    where (ename | empno) in ('xxx' | 'yyyy')


    Thanks in advance...
    Select * from emp
    where (ename||empno) in ('xxx'||'yyyy')
    

    What is the reason using the ' |'?

    Similar results could be achieved by article AND only

    Select * from emp
    where ename = 'xxx'
    and empno = 'yyyy'
    
  • Session at which was the bulk operations (DML) during the period determined in the Source database?

    Hi all


    How to find which session was in bulk (DML) operations on a particular period in the Source database?


    The source database: SRCDB - version: 11.2.0.3 (2 node RAC on RHEL OS)

    Target database: TGTDB - version: 11.2.0.3 (Non-RAC)

    Source-> target (United directional Replicat use of Goldengate)


    In our (source) database, I have observed that some inserts in bulk / updates which happened and because of this corresponding Replicat, database was a delay to apply updates/insert and there was a lag (treatment gap) happened in the target database.

    When I checked the source database, I was unable to find that the session/SQL caused the bulk INSERT/UPDATE/DELETE (batch), since the transaction has already finished.

    1. is as possible to get the story SQL_ID or generated Session operations more Redo/DML

    for example: the current time is 11:00 and I need to get the session/caused sql operations dml in bulk between 09:00 and 11:00?

    2. when I checked the history of SQL (dba_hist_sqlstat) time-based CPU, I found some instructions update. But I was unable to find the update caused SQL more updates to a table.

    For example: -.

    Update t1 set attribut1 = 'XX' where SHIPMENT_GID =': p1' / * it has updated 100 rows * /.

    Update t1 set attribut1 = 'XX' attribut1 = "YY" where SHIPMENT_GID =': p2' / * it has updated 5000 lines * /.

    Please provide relevant SQL to identify in above cases...

    Kind regards

    Veera

    column MODULE format a15

    column BEGIN_INTERVAL_TIME format a25

    column END_INTERVAL_TIME format a25

    Select distinct from a.*

    (

    Select sql.snap_id, sql.module, sql.sql_id, decode(t.command_type,2,'INSERT',6,'UPDATE',7,'DELETE') cmd_type,

    s. BEGIN_INTERVAL_TIME, s. END_INTERVAL_TIME, sql. EXECUTIONS_TOTAL, sql. ROWS_PROCESSED_TOTAL,

    SQL. ELAPSED_TIME_TOTAL/1000000 "elapsed time (in seconds).

    of dba_hist_sqlstat sql, dba_hist_snapshot s, dba_hist_sqltext t where s.snap_id = sql.snap_id and sql.sql_id = t.sql_id

    and s.begin_interval_time BETWEEN to_date ('03 - Apr - 2013 16:00 "," dd-mon-yyyy hh24:mi:ss')

    AND to_date ('03 - Apr - 2013 17:00 "," dd-mon-yyyy hh24:mi:ss')

    and sql.sql_id

    IN

    (

    SELECT distinct stat.sql_id

    Of dba_hist_sqlstat stat

    JOIN dba_hist_sqltext txt ON (stat.sql_id = txt.sql_id)

    JOIN dba_hist_snapshot snap ON (stat.snap_id = snap.snap_id)

    WHERE the snap.begin_interval_time between to_date ('03 - Apr - 2013 16:00 "," dd-mon-yyyy hh24:mi:ss')

    AND to_date ('03 - Apr - 2013 17:00 "," dd-mon-yyyy hh24:mi:ss')

    AND txt.command_type in (2,6,7)

    )

    ) a.snap_id asc order

    ;

    I hope that this sql help.

    Kind regards

    Harman

  • Using the Pivot operator with percentages

    I use Oracle 12 c DB. I'm trying to use the SQL pivot operator to give me an output of the matrix. I need to display 2 separate outputs, one with the charges and another with percentages. I have the following SQL to get the counties, but I don't know exactly on the SQL for the percentages. Please notify. TX

    with pivot_data as (select 'score', 'Observer_LastName', 'profile_id'

    FROM MyTable

    where substr ("Observer_LastName", 1, 1) s = ')

    SELECT *.

    of pivot_data

    PIVOT (count ("profile_id")

    FOR 'partition' IN ('0', '1', '2',' 3')

    )

    Hello

    Using the table from scott.emp provided by Oracle, which has these counts for deptno and job:

    WORK DEPT_10 DEPT_20 DEPT_30

    --------- ------- ------- -------

    ANALYST 2

    CLERK 1 2 1

    MANAGER 1 1 1

    PRESIDENT 1

    SELLER 4

    You can get out of the percentages, like this:

    WORK DEPT_10 DEPT_20 DEPT_30

    --------- ------- ------- -------

    ANALYST OF 100.00

    THE CLERK 25.00 50.00 25.00

    MANAGER OF 33.33 33.33 33.33

    PRESIDENT 100.00

    SELLER 100.00

    using a query like this:

    WITH pivot_data AS

    (

    SOME jobs, deptno

    100 * RATIO_TO_REPORT (COUNT (*))

    RESUMED (work PARTITION) AS pct

    FROM scott.emp

    Working GROUP, deptno

    )

    SELECT *.

    OF pivot_data

    PIVOT (MIN (pct)

    TO deptno IN (10 AS dept_10

    20 AS dept_20

    30 AS dept_30

    )

    )

    ORDER BY job

    ;

  • Auditing of database to save the DELETE operation on a schema for all tables.

    Hello
    I'm using ORACLE DATABASE 11 g. I want to apply the AUDITING feature to save all DELETE operations happening on the tables in the schema.

    I did the following steps but dint got the correct output: -.

    I logged in the SYS as sysdba user and together
     alter system set audit_trail=DB,EXTENDED scope=spfile;
    then I ran this command to save the sql code that will use the privileges of DELETION
    AUDIT DELETE ANY TABLE;
    Then I bounced my DB and intended to test I created a table in the SCOTT schema and inserted 10 lines in there and then DELETE all the rows in it.

    According to the expectations, I check the view
    select * from aud$
    where spare1 like '%MACHINE1%'
    and USERID='SCOTT'
    order by ntimestamp#;
    The output I got is: -.
    34     168368     1     1          SCOTT     I-DOMAIN\MACHINE1     MACHINE1     100     0                                                                      Authenticated by: DATABASE; Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=2565))          MACHINE1                    5          21-DEC-11 07.02.58.621000 AM               0     928:5024     0000000000000000               983697018     <CLOB>     <CLOB>     
    But here I don't see the SQL that is generated in the last column.
    What I expected, it's that if I shoot a DELETE statement in the schema, it will get connected here and with the help of this point of view, I want to be able to see that what user of which machine run a DELETE statement and that the statement was?

    Please let me know what that step i have missed here.

    PS: - Watch the ACTION # 100 column, this is the DELETE action code. I have also consulted the view DBA_AUDIT_TRAIL but din't find any useful info their.

    Thanks in advance.

    Try instead:

    audit delete table;
    

    DELETE ENTIRE TABLE audit is audit use of the DELETE ANY TABLE privileges.

  • The SQL statement error - help nicely!

    Was scratchin my head, but cannot yet understand why it's a failure... Try to fill in the use of space for relevant tablespaces: get the below error. Kindly advice?


    9999999.999 free_space_mb column format
    column allocated_mb 9999999.999 format
    used_mb 9999999.999 column format
    column tablespace format a12
    filename format a20 column

    Select ts.name tablespace, file name trim (substr (df.name, 1 100));
    DF.bytes/1024/1024 allocated_mb,
    (((df.bytes/1024/1024) - nvl(sum(dfs.bytes)/1024/1024,0)) used_mb,.
    NVL(sum(DFS.bytes)/1024/1024,0) free_space_mb
    v $ datafile df left outer join dba_free_space dfs
    We df.file # = dfs.file_id join v$ tablespace ts
    We df.ts # = ts.ts #.
    We df.name # = ts.name #.
    and 'ts.name =' DATA_TS
    or 'ts.name =' INDEX_TS
    or 'ts.name =' LOB_TS
    Group of ts.name, df.name, dfs.file_id, df.file #, df.bytes
    order of file name;

    ERROR on line 8:
    ORA-00933: SQL not correctly completed command.

    Hello

    user568296 wrote:
    ...
    Select ts.name tablespace, file name trim (substr (df.name, 1 100));
    DF.bytes/1024/1024 allocated_mb,
    (((df.bytes/1024/1024) - nvl(sum(dfs.bytes)/1024/1024,0)) used_mb,.
    NVL(sum(DFS.bytes)/1024/1024,0) free_space_mb
    v $ datafile df left outer join dba_free_space dfs
    We df.file # = dfs.file_id join v$ tablespace ts
    We df.ts # = ts.ts #.
    We df.name # = ts.name #.
    and 'ts.name =' DATA_TS
    or 'ts.name =' INDEX_TS
    or 'ts.name =' LOB_TS
    Group of ts.name, df.name, dfs.file_id, df.file #, df.bytes
    order of file name;

    ERROR on line 8:
    ORA-00933: SQL not correctly completed command.

    There is a 2nd clause on line 8, WE join the same. 'AND' instead of 'ON', it would make sense to syntaic, but the names of files in v$ datafile are usually superstring of tablespace names in v$ ablespace. In other words, if ts.name (no # at the end) is "DATA_TS", then df.name could be ' D:\ORACLE\ORADATA\DEVELOPMENT\DATA_TS01. DBF'.
    I don't think that you need all of this condition. Try:

    select    ts.name                    tablespace,
           trim (substr (df.name, 1, 100))      filename,
           df.bytes/1024/1024                    allocated_mb,
           ( ( df.bytes / 1024 / 1024)
           - nvl ( sum (dfs.bytes) / 1024 / 1024
                  , 0
                 )
           )                         used_mb,
           nvl ( sum (dfs.bytes) / 1024 / 1024
               , 0
               )                         free_space_mb
    from                     v$datafile          df
    left outer join      dba_free_space          dfs     on     df.file#     = dfs.file_id
    join                   v$tablespace          ts     on     df.ts#          = ts.ts#
    --                                   AND     df.name          = ts.name     -- AND, not ON
                                       and     ts.name          IN ( 'DATA_TS'
                                                         , 'INDEX_TS'
                                                         , 'LOB_TS'
                                                         )
    group by  ts.name,
                 df.name,
           dfs.file_id,
           df.file#,
           df.bytes
    order by  filename;
    

    It's a bad idea to mix AND and gold at the same level in the same query. In this case, you can use the IN operator to avoid the need where. In other cases, use parentheses to isolate the ANDS of ORS.

  • Problem when using the SDO operations

    Hi all

    I am trying to run spatial SQL queries and I came up with a problem: if I enter the following query, the space operation (in this case SDO_INSIDE) is perfectly executed and the data is returned:
    SELECT SUM(fact.quant) as SUM_quant, instalacao.name as Name
    FROM fact, instalacao, layer_region, emissao
    WHERE fact.instalacao_id = instalacao.instalacao_id AND fact.emissao_id = emissao.emissao_id AND SDO_INSIDE (instalacao.glocal, layer_region.geom)='TRUE' 
    GROUP BY instalacao.instalacao_id, instalacao.name
    ORDER BY instalacao.instalacao_id
    However, if I have introduced another GROUP OF element, like this (where "emissao" has no spatial information and is not used in the space operation):
    SELECT SUM(fact.quant) as SUM_quant, instalacao.name as Name
    FROM fact, instalacao, layer_region, emissao
    WHERE fact.instalacao_id = instalacao.instalacao_id AND fact.emissao_id = emissao.emissao_id AND SDO_INSIDE (instalacao.glocal, layer_region.geom)='TRUE' 
    GROUP BY instalacao.instalacao_id, instalacao.name, emissao.poluente
    ORDER BY instalacao.instalacao_id
    the database apparently 'stuck' in a loop, and when I cancel I get the following error:
    ORA-13268: error obtaining dimension from USER_SDO_GEOM_METADATA
    ORA-06512: at "MDSYS.MD", line 1723
    ORA-06512: at "MDSYS.MDERR", line 8
    ...
    I do not understand what I am doing wrong because the table 'emissao' is not used in any space operation.

    Any ideas please?

    Thanks in advance,
    ~ Ruben

    One of them could probably work, let me know how it goes:

    1)
    SELECT / * + NO_MERGE (v) * / SUM (fact.quant) as SUM_quant, v.name as name
    In fact, emissao,.
    (SELECT / * + (l i) LEADING, USE_NL (l i) INDEX (i instalacao_glocal_idx) * /)
    i.Name, i.instalacao_id
    OF l layer_region, instalacao I
    WHERE (i.glocal, l.geom) SDO_INSIDE = 'TRUE') v
    WHERE fact.instalacao_id = v.instalacao_id
    AND fact.emissao_id = emissao.emissao_id
    GROUP BY v.instalacao_id, v.name, emissao.poluente
    ORDER BY v.instalacao_id

    2)
    SELECT / * + LEADING(e f l) USE_NL (l i) INDEX (i instalacao_glocal_idx) * / SUM (f.quant) as SUM_quant, i.name as name
    In fact e emissao f, layer_region l, instalacao I
    WHERE f.instalacao_id = i.instalacao_id
    AND f.emissao_id = e.emissao_id
    AND SDO_INSIDE (i.glocal, l.geom) = 'TRUE'
    GROUP OF i.instalacao_id, i.name, e.poluente
    ORDER BY i.instalacao_id

    Published by: sravada on July 6, 2009 08:49

  • The two operating systems fails on the Satellite A200 - 220 (PSAE3E)

    I have a very irritating problem on my laptop...

    I installed Windows 7 Professional x 86 on my laptop and the latest Ubuntu 9.10, and the computer crashes all the time.
    The original operating system was Windows Vista Home edition.
    The computer is 1 and a half years and I can not beIeave that's not Win7 compatible, and it does not support the latest version of Ubuntu, so if someone has an idea what is the cause or if the configurations are needed to run it please help me.

    computer crashes all the time is a rather general statement and I do not think that anyone here can say with certainty what the problem is here. Operating system installation is a complex mixture of operating system itself and many different additional drivers, tools, utilities and party applications third.

    Who knows what you did, how you installed it and what was your order of facilities? So for this problem cannot wait for a simple response.

    First step of course is install Win7. At this point the OS is naked and without some additional software.
    Is your laptop breaks down at this point?

Maybe you are looking for

  • Satellite A100-590: no sound

    Hello my A 100 has no more sound. I reinstalled the driver Mustek sound, but the same story again.Regulators speaker correctly in central position but nothing to hear. Everybody is a good proposal to finalize this dilemma?

  • I can't work with updates

    I can't download things such as adobe flash and cannot access my e-mail from work since my computer up to date with this new update of Windows.  I hate it!  How can I go back to what I had before?  I can't understand what are the modules or why they

  • How to recover my msn Favorites

    I lost all my favorites how can I get back them?

  • NET framework client profile 4

    My computer has been automatically download updates to net (I now changed the settings) Can someone explain, in plain easy to understand the language please, what is it? Also the computer crashes often leave a color screen? Help!

  • Room Dell place Pro 8 USB mic?

    I have a Dell place Pro 8 with a broken micro-USB port.  The tablet belongs to my daughter to years of high school.  I think she may have plugged in upside down too many times. Dell wants $269 to repair (Exchange motherboard). Anyone know or knows wh