Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In addition to the previous answer, there are significant differences in the scope of the declaration.</p> <p>When you declare a type in PL/SQL, such as the record type in your example, it is only usable from PL/SQL. If it is declared locally to a procedure or function, then it can only be used within that subprogram; if it is declared in a package body it can only be used within that package; if it is declared in a package header it can be used by any PL/SQL code that has execute access to the package. In no way can it be referenced in SQL statements, <strong>even ones embedded in the PL/SQL code</strong>.</p> <p>When you create an object type, or other schema-level type definitions such as nested tables, it is usable within both SQL and PL/SQL. As a very simple example, you can base a table definition on the object definition:</p> <pre><code>SQL&gt; CREATE OR REPLACE TYPE "TYPE_NAME1" AS OBJECT 2 ( 3 temp_trans_id number(10), 4 trans_id number(10), 5 resion_id number(10) 6 ) 7 / Type created. SQL&gt; create table type_name1_tab of type_name1; Table created. SQL&gt; desc type_name1_tab Name Null? Type ----------------------------------------- -------- ---------------------------- TEMP_TRANS_ID NUMBER(10) TRANS_ID NUMBER(10) RESION_ID NUMBER(10) </code></pre> <p><a href="http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_8001.htm#sthref5819" rel="noreferrer">See here</a> for documentation on the CREATE TYPE statement and references to further documentation on the various uses of object types.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload