Download PL/SQL User's Guide and Reference

Transcript
Assignment Statement
DECLARE
emp_rec1
emp_rec2
dept_rec
BEGIN
...
emp_rec1
emp%ROWTYPE;
emp%ROWTYPE;
dept%ROWTYPE;
:= emp_rec2;
You can assign the value of an expression to a specific element in a collection, by
subscripting the collection name.
Examples
DECLARE
wages NUMBER; hours_worked NUMBER; hourly_salary NUMBER; bonus NUMBER;
country VARCHAR2(128);
counter NUMBER := 0;
done BOOLEAN;
emp_rec employees%ROWTYPE;
TYPE commissions IS TABLE OF NUMBER INDEX BY PLS_INTEGER;
comm_tab commissions;
BEGIN
wages := (hours_worked * hourly_salary) + bonus;
country := 'France';
country := UPPER('Canada');
done := (counter > 100);
emp_rec.first_name := 'Antonio';
comm_tab(5) := 20000 * 0.15;
END;
/
Related Topics
Constants and Variables, Expressions, SELECT INTO Statement
PL/SQL Language Elements
13-5