Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

Conditions

This section lists the types of conditions. In its simplest form, a condition is used to test the existence of a condition, between two expressions. Conditions can be divided into comparison conditions, logical conditions, XML conditions, and object collection conditions. Table 4.2 shows the types of conditions, including descriptions and examples.

Table 4.2. SQL Conditions in Oracle
ConditionCondition Information
Comparison ConditionsComparison conditions are primarily used in a WHERE clause (see Chapter 3). Comparison conditions are used to compare the values of two expressions:
  • Equi (=), Anti (!=, <>), and Range (<, >, <=, >=)—Simple equality (Equi), inequality (Anti), and range conditions.

  • [ NOT ] LIKE— Pattern matching.

  • [ NOT ] IN— Set membership between expressions.

  • [ NOT ] EXISTS— Set membership producing a Boolean result.

  • [ NOT ] BETWEEN— Range search between two values, inclusive of end points.

  • ANY, SOME and ALL— Set membership conditions.

  • IS [ NOT ] NULLNULL value test condition.

Logical ConditionsLogical conditions are primarily used in a WHERE clause (see Chapter 3) and allow combining or merging of multiple expressions to find a Boolean result based on whether either expression or both expressions yield a true result:
  • NOT— An expression being false yields true.

  • AND— Two expressions being true yields true.

  • OR— One of two expressions being true yields true.

XML ConditionsAn XML document contains a hierarchical or upside-down treelike structure.
  • EQUALS_PATH— Searches the entire path of an XML document from the root node. <n> forms a correlation for EQUALS_PATH using the PATH and DEPTH ancillary functions.

Syntax:

<expression> = EQUALS_PATH
( <column>, <path> [, <n>])

  • UNDER_PATH— Searches a relative path of an XML document. <n> means the same as for EQUALS_PATH.

Syntax:

<expression> = UNDER_PATH

( <column>, <path> [, <n>])
Object Collection ConditionsTests the type of an object (see Chapter 11).
 Syntax:
 <expression> IS [NOT] OF [TYPE]



  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial