Quick Search:
 
 The Oracle PL/SQL INTO Clause      [Return To Index] Jump to:  

Term: INTO

Definition:
The Oracle PL/SQL INTO clause is used in PL/SQL blocks to collect SELECT query results into a local variable. Columns selected in the query must be returned into the local variables, which must be compatible with the columns in data type. It is also used in the executable (BEGIN...END) section of a PL/SQL block.

In the default usage [SELECT...INTO], the statement retrieves one or more columns from a single row. In bulk usage [SELECT...BULK COLLECT INTO], the statement retrieves an entire result set in one operation.

By default the [SELECT...INTO] statement can only return a single row. If it returns more than one row, PL/SQL raises the predefined exception TOO_MANY_ROWS (Error SQL-02112).

Example Usage:

DECLARE
L_EMPNO NUMBER;
L_ENAME VARCHAR2(1000);
L_DEPTNO NUMBER;
L_SALARY NUMBER;
BEGIN
SELECT EMPNO, ENAME, DEPTNO, SALARY
INTO L_EMPNO, L_ENAME, L_DEPTNO, L_SALARY
FROM EMPLOYEES
WHERE EMPNO=100;
END;



Related Links:

Related Code Snippets:
 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org