Skip to Main Content
Oracle PL/SQL for DBAs
book

Oracle PL/SQL for DBAs

by Arup Nanda, Steven Feuerstein
October 2005
Intermediate to advanced content levelIntermediate to advanced
454 pages
14h 44m
English
O'Reilly Media, Inc.
Content preview from Oracle PL/SQL for DBAs

What Does Oracle Do?

At this point, you might be wondering how the database partitions the query results. Does Oracle execute one query per parallel function instance or does it execute a single query and partition its results? Let’s find out by looking in the shared pool.

    SQL> SELECT sql_text,
      2         parse_calls,
      3         executions
      4    FROM v$sql
      5   WHERE INSTR(UPPER(sql_text),'ACCT_TRANSACTIONS')  > 0
      6     AND INSTR(UPPER(sql_text),'SQL_TEXT') = 0
      7     AND command_type = 3;

    SQL_TEXT                  PARSE_CALLS EXECUTIONS
    ------------------------- ----------- ----------
    SELECT *   FROM TABLE(are           1          1
    a_summary(CURSOR(SELECT *
    FROM acct_transactions)))

    SELECT "A3"."AREA" "AREA"           1          1
    ,"A3"."TRX_DATE" "TRX_DAT
    E","A3"."TRX_AMT" "TRX_AM
    T" FROM "ACCT_TRANSACTION
    S" "A3" ORDER BY "A3"."AR
    EA"

There are only two cursors here: the one I executed and the one executed within the table function, each with a parse and execute count of 1. That means that a single cursor is used and that Oracle partitions the returned rows as requested.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Oracle PL/SQL Best Practices

Oracle PL/SQL Best Practices

Steven Feuerstein
Expert Oracle PL/SQL

Expert Oracle PL/SQL

Ron Hardman, Michael McLaughlin
Oracle PL/SQL For Dummies

Oracle PL/SQL For Dummies

Michael Rosenblum, Paul Dorsey

Publisher Resources

ISBN: 0596005873Supplemental ContentErrata Page