Skip Headers
Oracle® Database PL/SQL Language Reference
11g Release 2 (11.2)

Part Number E25519-05
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub
LNPLS01319

Expression

An expression is an arbitrarily complex combination of operands (variables, constants, literals, operators, function invocations, and placeholders) and operators. The simplest expression is a single variable.

The PL/SQL compiler determines the data type of an expression from the types of the operands and operators that comprise the expression. Every time the expression is evaluated, a single value of that type results.

LNPLS1282Topics

Syntax

LNPLS1283expression ::=

Description of expression.gif follows
Description of the illustration expression.gif

See:

LNPLS1284boolean_expression ::=

Description of boolean_expression.gif follows
Description of the illustration boolean_expression.gif

See "function_call ::=".

LNPLS1285boolean_literal ::=

Description of boolean_literal.gif follows
Description of the illustration boolean_literal.gif

LNPLS1291conditional_predicate ::=

Description of conditional_predicate.gif follows
Description of the illustration conditional_predicate.gif

LNPLS1292other_boolean_form ::=

Description of other_boolean_form.gif follows
Description of the illustration other_boolean_form.gif

See:

LNPLS1293character_expression ::=

Description of character_expression.gif follows
Description of the illustration character_expression.gif

See:

LNPLS1294collection_constructor ::=

Description of collection_constructor.gif follows
Description of the illustration collection_constructor.gif

LNPLS1295date_expression ::=

Description of date_expression.gif follows
Description of the illustration date_expression.gif

See:

LNPLS1296numeric_expression ::=

Description of numeric_expression.gif follows
Description of the illustration numeric_expression.gif

LNPLS1297numeric_subexpression ::=

Description of numeric_subexpression.gif follows
Description of the illustration numeric_subexpression.gif

See:

LNPLS1299function_call ::=

Description of function_call.gif follows
Description of the illustration function_call.gif

LNPLS1313searched_case_expression ::=

Description of searched_case_expression.gif follows
Description of the illustration searched_case_expression.gif

See "boolean_expression ::=".

LNPLS1314simple_case_expression ::=

Description of simple_case_expression.gif follows
Description of the illustration simple_case_expression.gif

Semantics

LNPLS1316boolean_expression

Expression whose value is TRUE, FALSE, or NULL. For more information, see "BOOLEAN Expressions".

LNPLS1317Restriction on boolean_expression Because SQL has no data type equivalent to BOOLEAN, you cannot:

LNPLS1330NOT, AND, OR

See "Logical Operators".

LNPLS1331boolean_constant

Name of a constant of type BOOLEAN.

LNPLS1332boolean_function_call

Invocation of a previously defined function that returns a BOOLEAN value. For more semantic information, see "function_call".

LNPLS1333boolean_variable

Name of a variable of type BOOLEAN.

LNPLS1334conditional_predicate

See "Conditional Predicates for Detecting Triggering DML Statement".

LNPLS1335other_boolean_form

LNPLS1339collection

Name of a collection variable.

LNPLS1340EXISTS

Collection method (function) that returns TRUE if the indexth element of collection exists and FALSE otherwise. For more information, see "EXISTS Collection Method".

LNPLS1341Restriction on EXISTS You cannot use EXISTS if collection is an associative array.

LNPLS1342index

Numeric expression whose data type either is PLS_INTEGER or can be implicitly converted to PLS_INTEGER (for information about the latter, see "Predefined PLS_INTEGER Subtypes").

LNPLS1344IS [NOT] NULL

See "IS [NOT] NULL Operator".

LNPLS1345BETWEEN expression AND expression

See "BETWEEN Operator".

LNPLS1346IN expression [, expression ]...

See "IN Operator".

LNPLS1359LIKE pattern

See "LIKE Operator".

LNPLS1360relational_operator

See "Relational Operators".

LNPLS1361SQL

Implicit cursor associated with the most recently run SELECT or DML statement. For more information, see "Implicit Cursors".

LNPLS1362%FOUND, %ISOPEN, %NOTFOUND

Cursor attributes explained in "Implicit Cursor Attribute" and "Named Cursor Attribute".

LNPLS1363character_expression

Expression whose value has a character data type (that is, a data type in the CHAR family, described in "CHAR Data Type Family").

LNPLS1364character_constant

Name of a constant that has a character data type.

LNPLS1365character_function_call

Invocation of a previously defined function that returns a value that either has a character data type or can be implicitly converted to a character data type. For more semantic information, see "function_call".

LNPLS1367character_literal

Literal of a character data type.

LNPLS1368character_variable

Name of a variable that has a character data type.

LNPLS1369||

Concatenation operator, which appends one string operand to another. For more information, see "Concatenation Operator".

LNPLS1370collection_constructor

Constructs a collection of the specified type with elements that have the specified values. For more information, see "Collection Constructors".

LNPLS1371collection_type

Name of a previously declared nested table type or VARRAY type (not an associative array type).

LNPLS1372value

Valid value for an element of a collection of collection_type.

If collection_type is a varray type, then it has a maximum size, which the number of values cannot exceed. If collection_type is a nested table type, then it has no maximum size.

If you specify no values, then the constructed collection is empty but not null (for the difference between empty and null, see "Collection Types").

LNPLS1374date_expression

Expression whose value has a date data type (that is, a data type in the DATE family, described in "DATE Data Type Family").

LNPLS1375date_constant

Name of a constant that has a date data type.

LNPLS1383date_function_call

Invocation of a previously defined function that returns a value that either has a date data type or can be implicitly converted to a date data type. For more semantic information, see "function_call".

LNPLS1386date_literal

Literal whose value either has a date data type or can be implicitly converted to a date data type.

LNPLS1393date_variable

Name of a variable that has a date data type.

LNPLS1397+, -

Addition and subtraction operators.

LNPLS1405numeric_expression

Expression whose value has a date numeric type (that is, a data type in the DATE family, described in "NUMBER Data Type Family").

LNPLS1406+, -, /, *, **

Addition, subtraction, division, multiplication, and exponentiation operators.

LNPLS1416numeric_subexpression

LNPLS1417collection

Name of a collection variable.

LNPLS1442COUNT, FIRST, LAST, LIMIT, NEXT, PRIOR

Collection methods explained in "Collection Method Invocation".

LNPLS1454named_cursor%ROWCOUNT

See "Named Cursor Attribute".

LNPLS1492numeric_constant

Name of a constant that has a numeric data type.

LNPLS1493numeric_function_call

Invocation of a previously defined function that returns a value that either has a numeric data type or can be implicitly converted to a numeric data type. For more semantic information, see "function_call".

LNPLS1498numeric_literal

Literal of a numeric data type.

LNPLS1499numeric_variable

Name of variable that has a numeric data type.

LNPLS1500SQL%ROWCOUNT

Cursor attribute explained in "Implicit Cursor Attribute".

LNPLS1501SQL%BULK_ROWCOUNT]

Cursor attribute explained in "SQL%BULK_ROWCOUNT".

LNPLS1502exponent

Numeric expression.

LNPLS1503function_call

LNPLS1504function

Name of a previously defined function.

LNPLS1505parameter [, parameter ]...

List of actual parameters for the function being called. The data type of each actual parameter must be compatible with the data type of the corresponding formal parameter. The mode of the formal parameter determines what the actual parameter can be:

Formal Parameter Mode Actual Parameter
IN Constant, initialized variable, literal, or expression
OUT Variable whose data type is not defined as NOT NULL
IN OUT Variable (typically, it is a string buffer or numeric accumulator)

If the function specifies a default value for a parameter, you can omit that parameter from the parameter list. If the function has no parameters, or specifies a default value for every parameter, you can either omit the parameter list or specify an empty parameter list.

LNPLS1506searched_case_expression

LNPLS1507WHEN boolean_expression THEN result

The boolean_expressions are evaluated sequentially. If a boolean_expression has the value TRUE, then the result associated with that boolean_expression is returned. Subsequent boolean_expressions are not evaluated.

LNPLS1508ELSE result

The result is returned if and only if no boolean_expression has the value TRUE.

If you omit the ELSE clause, the searched case expression returns NULL.

LNPLS1509simple_case_expression

LNPLS1510selector

An expression of any PL/SQL type except BLOB, BFILE, or a user-defined type. The selector is evaluated once.

LNPLS1511WHEN selector_value THEN result

The selector_values are evaluated sequentially. If a selector_value is the value of selector, then the result associated with that selector_value is returned. Subsequent selector_values are not evaluated.

A selector_value can be of any PL/SQL type except BLOB, BFILE, an ADT, a PL/SQL record, an associative array, a varray, or a nested table.

LNPLS1515ELSE result

The result is returned if and only if no selector_value has the same value as selector.

If you omit the ELSE clause, the simple case expression returns NULL.

Examples

Related Topics

LNPLS1517In this chapter:

LNPLS1520In other chapters:

Reader Comment

   

Comments, corrections, and suggestions are forwarded to authors every week. By submitting, you confirm you agree to the terms and conditions. Use the OTN forums for product questions. For support or consulting, file a service request through My Oracle Support.

Hide Navigation

Quick Lookup

Database Library · Master Index · Master Glossary · Book List · Data Dictionary · SQL Keywords · Initialization Parameters · Advanced Search · Error Messages

Main Categories

This Document

New and changed documents:
RSS Feed HTML RSS Feed PDF