How select statement works

i like to know the in depth details how oracle process the select query...how it reads from the data block

Straight from the concept manual:
http://download.oracle.com/docs/cd/B10501_01/server.920/a96524/c01_02intro.htm#3437
An Example of How Oracle Works
The following example describes the most basic level of operations that Oracle performs. This illustrates an Oracle configuration where the user and associated server process are on separate machines (connected through a network).
An instance has started on the computer running Oracle (often called the host or database server).
A computer running an application (a local machine or client workstation) runs the application in a user process. The client application attempts to establish a connection to the server using the proper Oracle Net Services driver.
The server is running the proper Oracle Net Services driver. The server detects the connection request from the application and creates a dedicated server process on behalf of the user process.
The user runs a SQL statement and commits the transaction. For example, the user changes a name in a row of a table.
The server process receives the statement and checks the shared pool for any shared SQL area that contains a similar SQL statement. If a shared SQL area is found, then the server process checks the user's access privileges to the requested data, and the previously existing shared SQL area is used to process the statement. If not, then a new shared SQL area is allocated for the statement, so it can be parsed and processed.
The server process retrieves any necessary data values from the actual datafile (table) or those stored in the SGA.
The server process modifies data in the system global area. The DBWn process writes modified blocks permanently to disk when doing so is efficient. Because the transaction is committed, the LGWR process immediately records the transaction in the online redo log file.
If the transaction is successful, then the server process sends a message across the network to the application. If it is not successful, then an error message is transmitted.
Throughout this entire procedure, the other background processes run, watching for conditions that require intervention. In addition, the database server manages other users' transactions and prevents contention between transactions that request the same data.

Similar Messages

  • All SELECT statements work except of SELECT *

    Hi,
    I have one table with 2 rows in Oracle 10.1.0.2.0
    All SELECT statements work (e.g. SELECT COUNT(*) FROM, SELECT COLUMNNAME FROM TABLE, etc.)
    But when I execute SELECT * FROM it never shows any response in SQLPlus. I can view the data with Enterprise Manager Console - using View/Edit Content.
    How this can be caused?
    Thanks for reply.

    Hi,
    I don't get any error. I enter the SELECT * FROM statement run it and cursor jumps to next line and is blinking forever...
    So I got no error response from database.
    SELECT COLUMNNAME FROM works normally.
    As I wrote the machine with database is probably used over its limits - I'm not DBA but SGA is set up to use about 90% of memory (as I learnt from other forums recomendation for Solaris/Sun is about 40%).
    Unfortunatelly I have just 2 rows in my table. There are metadata in the table which are needed to get info about other tables in the database.
    So I am wondering why is the database able to work normally but doesn't response to this statement. I run queries on other tables in database with millions of records, but I am not able to run this query.
    Can be table somehow corrupted? It is strange...
    Regards,
    Petr

  • Only select statements work (update/insert hang)

    Hi, I am running CF MX version 7,0,2,142559 Standard Edition
    and ColdFusion is hanging everytime I attempt an insert or update
    statement again Oracle 8i and 9i using the jdbc thin driver and an
    odbc socket driver.
    Select statements work fine. I have tried everything I could
    think of and I get the same results. All rights are given to the
    datasource and the user. I can do insert and update statement via
    another application (Toad) with the same Oracle user.
    Any suggestions??? I don't see any hot fixes for this but
    that doesn't mean one doesn't exist.
    Also, many times it causes the system cpu utlization to stick
    at 100% until I restart ColdFusion.
    Thanks for any help.

    Hi,
    I had similar results on Oracle 10G while using cfmx 7.02. I
    actually updated the macromedia_drivers.jar from the coldfusion
    support site.
    http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=42dcb10a
    An update to the datadirect JDBC drivers. Try that. If not,
    make sure you have the latest JDBC drivers from Oracle. Since
    previous versions would make the update/insert;s hang.

  • Select statement works in 8.1.5  but does not work in 8.1.7 why???????

    I have written a select statement as part of cursor in a
    Database Trigger, the following statement works fine in Oracle
    8i ver 8.1.5.0 but the same statement returns error PLS-00103
    (Parser related error) in Oracle 8i version 8.1.7.0!!!!!!
    The error shown is
    PLS-00103Encountered the symbol")" when expecting one of the
    following:
    from
    The Sql statement in a Database Trigger is as follows
    select opn_stk,iss_qty,rec_qty,ROWID
    from mnth_bal
    where to_date(lpad(to_char(month),2,'0')||to_char
    (year),'mmyyyy') >= SYSDATE AND
    REV_NO = :NEW.REV_NO AND
         ITEM_STOCK_ITEM_CD = :NEW.ITEM_CD and
    unit_cd = :NEW.unit_cd and
    store_cd = :new.store_cd
    order by to_date(lpad(to_char(month),2,'0')
    ||to_char(year),'mmyyyy') ;
    Can any one please tell me whats the problem ? In 8.1.5.0 the
    same statement in the trigger runs absolutely fine &
    compiles.Because of this problem the trigger is not compiling in
    8.1.7.0
    Would be grateful for any solutions given

    Relating line numbers in compile errors to source code.
    Oracle does not count blank lines in line numbers. Commenting
    with "--" blank lines or deleting blank lines will make the line
    counter more accurate.
    Oracle counts comments delimited with /*...*/ as one line, no
    matter how many lines are in the source code. Using only "--"
    will make the line counter more accurate.
    Oracle does not count lines before the PL/SQL block DECLARE when
    compiling triggers. (CREATE ... TRIGGER....FOR EACH...WHEN(...))
    parts of the syntax are not counted. The line in the source
    code with the DECLARE of the trigger's PL/SQL block will be line
    1.
    Hint: Avoid uncertainty. Use "SHO ERR TRIGGER <trigger_name>"
    when looking at compile problems.
    Good Luck....

  • How update statement works

    Hi all,
    can you guys help me in understanding how an update statement works in oracle...
    Thanks
    Rajesh

    i mean what happens in background in oracle server
    when i fire a update statement.The oracle server puts the old data (i.e before updation) into the RBS and then updates the rows with the new data.
    Regards
    Amit Raghuvanshi

  • How commit statement works

    Hi,
    I want to know the procedure of how commit statement executes.
    I have a transaction in which I have updated 10000 rows of table A having 10lakh records and after this update I am updating 1 row in table B having 1000 records.
    after both these update statement I am executing commit statement.
    so, how this commit will work? does it commits the data in sequential order of updation of table A and B or it will be parallel for both the tables? Does it take time to do the commit?
    Thanks

    Arjit wrote:
    Hi,
    I want to know the procedure of how commit statement executes.
    I have a transaction in which I have updated 10000 rows of table A having 10lakh records and after this update I am updating 1 row in table B having 1000 records.
    after both these update statement I am executing commit statement.
    so, how this commit will work? does it commits the data in sequential order of updation of table A and B or it will be parallel for both the tables? Does it take time to do the commit?
    Thankswhen all else fails Read The Fine Manual
    http://docs.oracle.com/cd/E11882_01/server.112/e25789/sqllangu.htm#sthref864
    http://docs.oracle.com/cd/E11882_01/server.112/e25789/transact.htm#sthref1302
    http://docs.oracle.com/cd/E11882_01/server.112/e25789/transact.htm#sthref1320

  • How select works

    Could you please provide some link explaining how select statement works.
    SQL command is interpreted from right to left and componenets are executed in some sequence. I need to understand that.
    Thanks
    Arpit

    hi...
    on searching..some other facts in pl/sql...
    i just came to know the solution for your query...
    usually the order of execution for select statement will be..
    1.Restriction i.e where clause
    2.projection and
    3.orderring...
    for more information...t http://www.openlineconsult.com/db..
    in that choose 5th option slides...Basic SQL
    ...am sorry for this very late reply..
    by
    beginner in sql

  • Simple Select statement in MS Access

    I am not able to get this simple select statement working in MS Access.
    "SELECT PhotoLocation from RfidData WHERE TeamID = '"+teamID ;
    It is using a variable called teamID which is a string.
    The error is java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression
    Please Suggest
    Thank You...

    Let's look at your code, shall we?
    public String readPhotoLoc(String teamID)
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection con = DriverManager.getConnection(dbURL,"","");
        PreparedStatement ps = con.prepareStatement("Select PhotoLocation from RfidData ");  // There's no bind parameter here, so setString will do nothing
    ps.setString(1,teamID);
    ResultSet rs = ps.executeQuery();  // what do you do with the ResultSet?  Nothing.  //You don't return anything,  either.  I doubt that this mess even compiles.
    }Here's one suggestion for how to write it properly:
    public String readPhotoLoc(Connection connection, String teamID)
        String photoLoc = null;
         PreparedStatement ps = null;
         ResultSet rs = null;
        try
            String query = "SELECT PhotoLocation FROM RfidData WHERE TeamID = ?";
            ps = connection.prepareStatement(query);
            ps.setString(1,teamID);
            rs = ps.executeQuery();
            while (rs.next())
                photoLoc = rs.getString("PhotoLocation");
            return photoLoc;
        catch (SQLException e)
              e.printStackTrace();
               return null;
        finally
              try { if (rs != null) rs.close(); } catch (SQLException ignoreOrLogThis) {}
              try { if (ps != null) ps.close(); } catch (SQLException ignoreOrLogThis) {}
    }Make sure that the types of the columns match the Java types.
    %

  • Using variable in select statement (php)

    I am having difficulty using a variable in a select
    statement.
    The following manual query (using a static date) works fine:
    $query_Recordset1 = "SELECT * FROM academyClasses WHERE
    classDate > '2006-06-01' ";
    However, If I use the following:
    $dateVar = date('Y-m-d');
    mysql_select_db($database_mw, $mw);
    $query_Recordset1 = "SELECT * FROM academyClasses WHERE
    classDate > $dateVar ";
    ALL records are returned, which means the $dateVar variable
    is not being recognized. I have compared the $dateVar values
    <?php echo $datetime; ?> against the actual value of my date
    field <?php echo $row_Recordset1['classDate']; ?> in my
    results table and it seems that the values are indeed accurate in
    terms of a date 2006-06-04 for example.
    My date field "classDate" is of a "date" type within the
    mysql database. I'm using Dreamweaver MX 2004 with Mac OSX 10.3.9.
    I'm sure this is just a syntax problem, at least I hope it
    is.
    Any help is greatly appreciated.

    On Wed, 7 Jun 2006 04:49:57 +0000 (UTC), "mgwaters"
    <[email protected]> wrote:
    >Thanks Gary. That did seem to get the select statement
    working, but I had to
    >enter a manual date as before $dateVar = '2006-06-01'; on
    the previous line of
    >code to actually get it to filter my records. So... it
    looks like my setting of
    >the date variable:
    > $dateVar = date('Y-m-d');
    > does not seem to be recognized within the SELECT
    statement.
    Try this:
    $query_Recordset1 = "SELECT * FROM academyClasses WHERE
    classDate>'$dateVar'";
    print $query_Recordset1;
    See what is in the SQL statement.
    Gary

  • Select statement for JDBC receiver synch scenario for capturing random value from ECC portal

    Dear Experts,
    I am working on ECC <----> SAP-PO 7.31 <----> JDBC synchronous scenario. I am clear about the config part except the Select statement. I will be
    capturing 2 random values from the portal i.e. VendId and VendName in ECC to get the vendor details like Vendor Country, Vendor Status, Vendor Contact , Vendor Address etc from JDBC vendor table/view VENDETAIL.
    What would be the select statement to capture the random values for ECC portal? My select statement would look some thing like this..
    Select f1,f2,f3,f4 from table VENDETAIL where key1 = "VendId" and "VendName"
    Please suggest if the above select statement works for the above scenario...
    Regards
    Rebecca

    Hi Rebecca,
    Your statement should work fine.
    Please see the statement we use below.
    SELECT eT_cashier, eT_proc_yn, eT_proc_date FROM eTest WHERE eb_proc_yn = 'N'
    Just remember to update the change indicator so that you dont duplicate your records.
    UPDATE eTest SET eb_proc_yn = 'Y' WHERE eb_proc_yn = 'N'.
    Regards,
    Jannus Botha

  • How to pass values in select statement as a parameter?

    Hi,
    Very simple query, how do I pass the values that i get in the cursor to a select statement. If table1 values are 1,2,3,4 etc , each time the cursor goes through , I will get one value in the variable - Offer
    So I want to pass that value to the select statement.. how do i do it?
    the one below does not work.
    drop table L1;
    create table L1
    (col1 varchar(300) null) ;
    insert into L1 (col1)
    select filter_name from table1 ;
    SET SERVEROUTPUT ON;
    DECLARE
    offer table1.col1%TYPE;
    factor INTEGER := 0;
    CURSOR c1 IS
    SELECT col1 FROM table1;
    BEGIN
    OPEN c1; -- PL/SQL evaluates factor
    LOOP
    FETCH c1 INTO offer;
    EXIT WHEN c1%NOTFOUND;
    DBMS_OUTPUT.PUT_LINE(offer);
    select * from table1 f where f.filter_name =:offer ;
    factor := factor + 1;
    DBMS_OUTPUT.PUT_LINE(factor);
    END LOOP;
    CLOSE c1;
    END;

    Hi User,
    You are looking somethuing like this, as passing the values to the Cursor as a Paramter.
    DECLARE
       CURSOR CURR (V_DEPT IN NUMBER)    --- Cursor Declaration which accepts the deptno as parameter.
       IS
          SELECT *
            FROM EMP
           WHERE DEPTNO = V_DEPT;    --- The, Input V_DEPT is passed here.
       L_EMP   EMP%ROWTYPE;
    BEGIN
       OPEN CURR (30);       -- Opening the Cursor to Process the Value for Department Number 30 and Processing it with a Loop below.
       DBMS_OUTPUT.PUT_LINE ('Employee Details for Deptno:30');
       LOOP
          FETCH CURR INTO L_EMP;
          EXIT WHEN CURR%NOTFOUND;
          DBMS_OUTPUT.PUT ('EMPNO: ' || L_EMP.EMPNO || ' is ');
          DBMS_OUTPUT.PUT_LINE (L_EMP.ENAME);
       END LOOP;
       CLOSE CURR;
       DBMS_OUTPUT.PUT_LINE ('Employee Details for Deptno:20'); -- Opening the Cursor to Process the Value for Department Number 20
       OPEN CURR (20);
       LOOP
          FETCH CURR INTO L_EMP;
          EXIT WHEN CURR%NOTFOUND;
          DBMS_OUTPUT.PUT ('EMPNO: ' || L_EMP.EMPNO || ' is ');
          DBMS_OUTPUT.PUT_LINE (L_EMP.ENAME);
       END LOOP;
       CLOSE CURR;
    END;Thanks,
    Shankar

  • How to use column name as variable in select statement

    hi,
    i want to make a sql query where in select statement using variable as a column name. but its not working plz guide me how can i do this.
    select :m1 from table1;
    regards

    Hi,
    Is this what you want..
    SQL> select &m1 from dept;
    Enter value for m1: deptno
    old   1: select &m1 from dept
    new   1: select deptno from dept
        DEPTNO
            10
            20
            30
            40
    SQL> select &m1 from dept;
    Enter value for m1: dname
    old   1: select &m1 from dept
    new   1: select dname from dept
    DNAME
    ACCOUNTING
    RESEARCH
    SALES
    OPERATIONS
    SQL> select &&m1 from dept;
    Enter value for m1: loc
    old   1: select &&m1 from dept
    new   1: select loc from dept
    LOC
    NEW YORK
    DALLAS
    CHICAGO
    BOSTON
    SQL> select &&m1 from dept;
    old   1: select &&m1 from dept
    new   1: select loc from dept
    LOC
    NEW YORK
    DALLAS
    CHICAGO
    BOSTONIf you use single '&' then each time you fire the query, It will ask for the new value..
    But if you will use double '&&' the value of m1 will be persistent across the session..
    Twinkle

  • How to return the result set of multiple select statements as one result set?

    Hi All,
    I have multiple select statements in my stored procedure that I want to return as one result set 
    for instance 
    select id from tableA
    union 
    select name from table b 
    but union will not work because the result sets datatypes are not identical so how to go about this ?
    Thanks

    You have to CAST or CONVERT (or implicitly convert) the columns to the same datatype.  You must find a datatype that both columns can be converted to without error.  In your example I'm guessing id is an int and name is a varchar or nvarchar. 
    Since you didn't convert the datatypes, SQL will use its data precedence rules and attempt to convert name to an int.  If any row contains a row that has a value in name that cannot be converted to an int, you will get an error.  The solution is
    to force SQL to convert the int to varchar.  So you want something like
    select cast(id as varchar(12)) from tableA
    union
    select name from tableb
    If the datatypes are something other that int or varchar, you must find a compatable datatype and then convert one (or both) of the columns to that datatype.
    Tom

  • How user variable table names in select statement

    Dear all,
    I have three table gp1,gp2,g3. i want user variable table in sql query
    for example at oracle forms have a list table showing table names gp1,gp2,gp3
    at form i want user this query
    select gpno from :table where gpno=120;
    how i can specify table name Dynamicly in select query
    Thanks

    Forms_DDL is a one-way street: You can only pass DDL commands TO the database; you cannot get data back using Forms_DDL.
    Exec_SQL is the Forms package that enables dynamic sql within a form. But to retrieve data, you have to make a Exec_SQL call for every column in every row. So it is not a good thing to use, either.
    The ref cursor method should work. You could also retrieve the data into a record group using populate_group_with_query -- it also enables dynamic data retrieval.
    But if you already know you have three distinct tables and you know their names, I would keep it simple and just write three sql select statements.

  • How to pass parameter in Function by using select statement?

    Hi,
    I got a problem. I cant pass in parameter to function by using select statement. But it can pass in parameter by using 'hardcode' method. How can I solve this problem?
    Eg,
    select * from table (SplitFunction('HS750020,HS750021')) <<< this work.
    but
    select * from table (SplitFunction(select LOT_NO from TRACER_SEARCH_SCHEDULE where JOB_ID = '36')) <<< do not work.
    Thanks for who try to help. Thanks.

    skymonster84 wrote:
    I have try this before. But it not work.here is an example
    create or replace type stringlist as table of varchar2(100)
    create or replace function splitstring(pstring in varchar2) return stringlist
    as
      lstringlist stringlist;
    begin
      select regexp_substr(pstring,'[^,]+',1, level) bulk collect into lstringlist
        from dual
      connect by level <= length(pstring)-length(replace(pstring,','))+1;
      return lstringlist;
    end;
    select * from table(select splitstring('xx,yy,zz') from dual)
    create table t(str varchar2(100))
    insert into t values('x,y,z')
    insert into t values('a,b,c')
    select * from table(select splitstring(str) from t where rownum<2)
    /If you supply multiple values then it will fail.
    select * from table(select splitstring(str) from t)
    /

Maybe you are looking for

  • Use of DLL file in d2k

    Can I use dll file in Developer/2000? If yes how can i use?

  • Disjointed overlapping trigger & target

    how can i overlap my buttons that triggers several maps to open under it for disjointed rollovers bryans-stamps.com

  • Returns and Repairs  in CS

    Hi, I am creating the  following cycle- Service notification--> Repair Quotation Then i create a Repairs order with reference to teh quoatton created earlier- and carry out returns delivery. The problem is that  when i go to the repairs screen ,it do

  • Delete, uninstall everything

    I am buying a new Mac and want to give away my current computer stripped of all files, etc. What is best way to do this? Thanks for help. Don

  • MP3 icon preview not working in 10.8.2

    Hi everybody! Almost 2 hours i'm trying to find the issue on this bug. Does anyone knows why Finder, Path Finder & etc. shows me standart iTunes icon on my mp3 files with cover art? iTunes show it well, there's no problem. Can anybody tell me *** and