The SELECT INTO clause of SQL is used to retrieve one row or set of columns from the Oracle database. The SELECT INTO is actually a standard SQL query where the SELECT INTO clause is used to place the returned data into predefined variables.
Example 1:
DECLARE
v_var varchar2(100); --- Give same datatype as table column
BEGIN
SELECT col1 INTO v_var FROM employees WHERE id=100;
DBMS_OUTPUT.PUT_LINE (v_var);
END;
Example 2:
DECLARE
v_fname varchar2(100);
v_lname varchar2(100);
BEGIN
SELECT first_name, last_name INTO v_fname, v_lname FROM employees WHERE id = 100;
DBMS_OUTPUT.PUT_LINE ('First Name - '||v_fname||' Last Name - '||v_lname);
END;