December 2010
Intermediate to advanced
451 pages
11h 16m
English
You are interested in returning one row from a database table via a query that searches for an exact match.
Use the SELECT…INTO syntax in order to retrieve the row from the database. You can choose to retrieve one or more columns of data from the matching row. The following example depicts a scenario in which a table is queried to return multiple columns from a single row:
DECLARE
first VARCHAR2(20);
last VARCHAR2(25);
email VARCHAR2(25);
BEGIN
SELECT first_name, last_name, email
INTO first, last, email
FROM employees
WHERE employee_id = 100;
DBMS_OUTPUT.PUT_LINE(
'Employee Information for ID: ' || first || ' ' || last || ' - ' || email); EXCEPTION ...Read now
Unlock full access