October 2002
Intermediate to advanced
688 pages
14h 14m
English
| 1) | Create the following script. Create an index-by table and populate it with the instructor’s full name. In other words, each row of the index-by table should contain first name, middle initial, and last name. Display this information on the screen. |
| A1: |
Answer: Your script should look similar to the following:
SET SERVEROUTPUT ON
DECLARE
CURSOR name_cur IS
SELECT first_name||' '||last_name name
FROM instructor;
TYPE name_type IS TABLE OF VARCHAR2(50)
INDEX BY BINARY_INTEGER;
name_tab name_type;
v_counter INTEGER := 0;
BEGIN
FOR name_rec IN name_cur LOOP
v_counter := v_counter + 1;
name_tab(v_counter) := name_rec.name;
DBMS_OUTPUT.PUT_LINE ('name('||v_counter||'): '||
name_tab(v_counter));
END LOOP;
END; In the preceding ... |
Read now
Unlock full access