Purpose
Retrieves qualified records for the specified incident or problem.
Syntax and Description
select {*|[field1, [field2, ...]} FROM {incident|problem} [WHERE predicate_string] [ORDER BY field1 [, field2, ...] [ASC|DSC|DESC]] [GROUP BY field1 [, field2, ...]] [HAVING having_predicate_string]
Table 17-10 Flags for the SELECT command
Flag | Description |
---|---|
|
Lists the fields to retrieve. If |
|
Indicates whether to query incidents or problems. |
|
Uses a SQL-like predicate string to show only the incident or problem for which the predicate is true. The predicate string must be enclosed in double quotation marks. Table 17-16 lists the fields that can be used in the predicate string incidents. Table 17-20 lists the fields that can be used in the predicate string for problems. |
|
Show results sorted by field in the given order, as well as in ascending ( |
|
Show results grouped by the specified fields. The |
|
Restrict the groups of returned rows to those groups for which the having predicate is true. The |
The WHERE
, ORDER
BY
, GROUP
BY
, and HAVING
flags are similar to the clauses with the same names in a SELECT
SQL statement. See Oracle Database SQL Language Reference for more information about the clauses in a SELECT
SQL statement.
Restrictions
The following restrictions apply when you use the SELECT
command:
The command cannot join more than two tables.
The command cannot use table aliases.
The command can use only a limited set of functions, which are listed in this section.
The command cannot use column wildcard ("*"
) when joining tables or when using the GROUP
BY
clause.
Statements must be on a single line.
Statement cannot have subqueries.
Statement cannot have a WITH
clause.
A limited set of pseudocolumns are allowed. For example, ROWNUM
is allowed, but ROWID
is not allowed.
Examples
This example retrieves the incident_id
and create_time
for incidents with an incident_id
greater than 1
:
select incident_id, create_time from incident where incident_id > 1
The following is sample output for this query:
INCIDENT_ID CREATE_TIME -------------------- ---------------------------------------- 4801 2011-05-27 10:10:26.541656 -07:00 4802 2011-05-27 10:11:02.456066 -07:00 4803 2011-05-27 10:11:04.759654 -07:00
This example retrieves the problem_id
and first_incident
for each problem with a problem_key
that includes 600
:
select problem_id, first_incident from problem where problem_key like '%600%'
The following is sample output for this query:
PROBLEM_ID FIRST_INCIDENT -------------------- -------------------- 1 4801 2 4802 3 4803
Functions
This section describes functions that you can use with the SELECT
command.
The purpose and syntax of these functions are similar to the corresponding SQL functions, but there are some differences. This section notes the differences between the functions used with the ADRCI utility and the SQL functions.
The following restrictions apply to all of the functions:
The expressions must be simple expressions. See Oracle Database SQL Language Reference for information about simple expressions.
You cannot combine function calls. For example, the following combination of function calls is not supported:
sum(length(column_name))
No functions are overloaded.
All function arguments are mandatory.
The functions cannot be used with other ADRCI Utility commands.
Table 17-11 ADRCI Utility Functions for the SELECT Command
Function | Description |
---|---|
Returns the average value of an expression. |
|
Returns the concatenation of two character strings. |
|
Returns the number of rows returned by the query. |
|
Compares an expression to each search value one by one. |
|
Returns the length of a character string using as defined by the input character set. |
|
Returns the maximum value of an expression. |
|
Returns the minimum value of an expression |
|
Replaces null (returned as a blank) with character data in the results of a query. |
|
Returns rows that match a specified pattern in a specified regular expression. |
|
Returns a portion of character data. |
|
Returns the sum of values of an expression. |
|
Converts a value of |
|
Returns character data, with all letters lowercase. |
|
Returns character data, with all letters uppercase. |