Oracle method of querying and assigning values to variables: 1. Use the "variable name data type (size)" statement to define the variable; 2. Use the "select table field name into variable name from table name WHERE clause" statement Assign the query results to variables.
The operating environment of this tutorial: Windows 7 system, Oracle 11g version, Dell G3 computer.
How to query and assign values to variables in oracle
First we need to define (declare) a variable
Format:
1 |
|
Example:
1 2 |
|
Then use sselect table field name into variable name from table name WHERE clause
statement query And assign the value to the variable
Method 1:
①Query all fields of the specified table
②The first two methods applicable to declaring variables can be used
1 2 3 |
|
Method 2:
①Query all fields of the specified table
②Applicable to the third way of declaring variables
1 2 |
|
Note:
①The query result can only return one record
②The table fields queried must be all fields of the table
1 2 3 4 |
|
Recommended tutorial: "Oracle Tutorial"
The above is the detailed content of How to query and assign values to variables in Oracle. For more information, please follow other related articles on the PHP Chinese website!