Oracle expression lists

Source: Internet
Author: User

An expression list is a combination of other expressions.

 

Expression lists can appear in comparison and membership conditions and inGroup ByClauses of queries and subqueries.

Comparison and membership conditions appear in the conditionsWhereClauses. They can containEitherOne or more comma-delimited expressions, or one or more sets of expressions where each set contains one or more comma-delimited expressions. In the latter case (multiple sets of expressions ):

    • Each set is bounded by parentheses
    • Each set must contain the same number of expressions
    • The number of expressions in each set must match the number of expressions before the operator in the comparison condition or beforeInKeyword in the membership condition.

A comma-delimited list of expressions can contain no more than 1000 expressions. A comma-delimited list of sets of expressions can contain any number of sets, but each set can contain no more than 1000 expressions.

The following are some valid expression lists in conditions:

 
(10, 20, 40) ('Scott ', 'bucke', 'taylor') ('guy', 'himuro', 'ghimuro'), ('karen ', 'colmenares', 'kcolmena '))

In the third example, the number of expressions in each set must equal the number of expressions in the first part of the condition. For example:

 
Select * from employees where (First_name, last_name, email) In (('Guy', 'himuro', 'ghimuro'),('Karen ', 'colmenares', 'kcolmena'))

See also:

"Comparison conditions" and "membership conditions"

In a simpleGroup ByClause, you can use either the upper or lower form of expression list:

 
Select department_id, min (salary), max (salary) from employees group by department_id, salary; select department_id, min (salary), max (salary) from employees group by (department_id, salary );

InRollup,Cube, AndGrouping SetsClsesGroup ByClures, you can combine individual expressions with sets of expressions in the same expression list. The following example shows several valid grouping sets expression lists in one SQL statement:

 select prod_category, prod_subcategory, country_id, cust_city, count (*) from products, sales, customers where sales. prod_id = products. prod_id and sales. cust_id = MERs. cust_id and sales. time_id = '01-oct-00' and MERs. cust_year_of_birth between 1960 and 1970 group by grouping sets ( prod_category, prod_subcategory, country_id, cust_city  ), ( prod_category, prod_subcategory, country_id ), ( prod_category, prod_subcategory  ),  country_id ); 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.