Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is 'THE' keyword in Oracle?

I would like to know what is the definition of the reserved keyword 'THE' in Oracle SQL ?

The only thing I know is it's a function. It's a possible synonym of TABLE function (but I'm not sure).

The only trace I've found is here : http://docs.oracle.com/cd/B19306_01/em.102/b40103/app_oracle_reserved_words.htm

Thanks

like image 591
Cheval Avatar asked Apr 25 '14 01:04

Cheval


People also ask

What are keywords in Oracle?

Oracle Reserved Words and Keywords Oracle reserved words have a special meaning to Oracle and so cannot be redefined. For this reason, you cannot use them to name database objects such as columns, tables, or indexes. Keywords also have a special meaning to Oracle but are not reserved words and so can be redefined.

What is TYPE keyword Oracle?

TYPE is used for user-defined types within PLSQL packages.

What are keywords for a Oracle DBA?

The top three keywords employers use in Oracle Database Administrator job descriptions are Database Administration appearing in 20.02% of postings, Database 16.56%, and Oracle Database appearing in 14.46%.

What is level keyword in Oracle?

The term LEVEL refers to a Pseudocolumn in Oracle which is used in a hierarchical query to identify the hierarchy level (parent->child) in numeric format. The LEVEL returns 1 for root row, 2 for child of root row and so on, as tree like structure. LEVEL must be used with CONNECT BY Clause.


1 Answers

The operand of THE is a subquery that returns a single column value for you to manipulate. The column value must be a nested table. Otherwise, you get a runtime error. Because the value is a nested table, not a scalar value, Oracle must be informed, which is what operator THE does.

Example

DECLARE
   adjustment INTEGER DEFAULT 1;
   ...
BEGIN
   ...
   UPDATE 
      THE(SELECT courses FROM department 
             WHERE name = 'Psychology')
      SET credits = credits + adjustment
      WHERE course_no IN (2200, 3540);

From Oracle Documentation.

like image 79
mason Avatar answered Oct 02 '22 21:10

mason