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

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top