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).
SELECT EMPNO, ENAME, DEPTNO, SALARY
INTO L_EMPNO, L_ENAME, L_DEPTNO, L_SALARY
Related Code Snippets: