How to query a Table type without using Loops(FOR,etc)
801360Mar 27 2012 — edited Mar 28 2012Hi all,
I am just a beginner working with oracle DB. I have a very fundamental question on TABLE TYPES in oracle.
create table sample(a number,b varchar2(10))
/
set serveroutput on;
declare
TYPE tab_type IS TABLE OF sample%ROWTYPE;
t_tab tab_type := tab_type();
begin
for i IN 0..2
loop
t_tab.extend;
t_tab(t_tab.last).a := i;
t_tab(t_tab.last).b := 'maru';
dbms_output.put_line(t_tab(t_tab.last).a);
end loop;
-- CAN I DO A SELECT * FROM THE TABLE t_tab without using a cursor to iterate row by row
-- Since i need to compare the values of a table called MAIN with this SAMPLE table.i need to check whether all the records present in MAIN table is present in the
--SAMPLE table table type.I dont want to insert into any temp table( as it becomes a overhead) and compare the results.
end;
Kindly help me in this regard and let me know in case you need further more details.
Thanks in Advance.