How to create index-by table in oracle?

Answer Posted / su

declare
TYPE tab IS TABLE OF varchar2(200)
INDEX BY binary_integer;
t tab;
v_counter number : =0;
BEGIN
FOR c_emp IN (SELECT ENAME FROM emp)
LOOP
v_counter := v_counter + 1;
t(v_counter):= c_emp.ename;
END LOOP;
FOR i IN 1 .. t.last
LOOP
dbms_output.put_line(t(i));
END LOOP;
EXCEPTION
WHEN others THEN
dbms_output.put_line(sqlcode);
dbms_output.put_line(sqlerrm);
END;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between truncate and delete?

765


Can we insert data in view oracle?

771


What is the usage of analyze command in oracle?

871


What is the data type of dual table?

721


What is a connect identifier?

802


how to clone 9i Database on to 10g Database.

2112


What is blob datatype?

812


What do you mean by group by clause?

810


How to insert a record into a table?

863


State all possible different index configurations a table can possibly have?

800


How to create a table in a specific tablespace?

765


What is the difference between Delete, Truncate and Drop in Oracle?

893


is there a tool to trace queries, like profiler for sql server?

854


What is the simplest tool to run commands on oracle servers?

764


How to change program global area (pga) in oracle?

866