Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meaning of STORE AS in nested table in PL/SQL

I referred many examples of "Creating a SQL Type Corresponding to a PL/SQL Nested Table" such as

           CREATE TYPE CourseList AS TABLE OF VARCHAR2(64);
           CREATE TABLE department (
                name     VARCHAR2(20),
                director VARCHAR2(20),
                office   VARCHAR2(20),
                courses  CourseList) 
                NESTED TABLE courses STORE AS courses_tab;

I referred many materials regarding this but I am not getting what is purpose of storing courses into courses_tab. Where will this courses_tab use? Please help me.

like image 257
YLG Avatar asked Jul 08 '14 12:07

YLG


People also ask

What is nested table in PL SQL?

Nested tables are single-dimensional, unbounded collections of homogeneous elements. First, a nested table is single-dimensional, meaning that each row has a single column of data like a one-dimension array. Second, a nested table is unbounded. It means that the number of elements of a nested table is predetermined.

What is the meaning of nested table?

nesting table in American English. noun. one of a set of usually three or four small tables that are graduated in size so that they may be stacked on top of one another. Also called: stack table.

What is the use of nested table in Oracle?

Within the database, nested tables can be considered one-column database tables. Oracle stores the rows of a nested table in no particular order. But, when you retrieve the nested table into a PL/SQL variable, the rows are given consecutive subscripts starting at 1. That gives you array-like access to individual rows.

Which of the following is true about PL SQL nested tables?

Q 7 - Which of the following is true about PL/SQL nested tables? A - Nested tables are like one-dimensional arrays with arbitrary number of elements.


1 Answers

courses_tab is used to name the physical table which stores the data for the nested table. You can find it by querying dba_nested_tables. The column table_name will have the value 'COURSES_TAB'. In addition, you can get the structure of the table by issuing the command DESC COURSES_TAB.

like image 50
Jeffrey Kemp Avatar answered Nov 13 '22 05:11

Jeffrey Kemp