1 Replies - 5907 Views - Last Post: 21 February 2013 - 10:20 AM

#1 vibinvictoria  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 99
  • Joined: 16-July 08

display all the records using types

Posted 19 February 2013 - 11:42 AM

Hi All,

I have written the pl/sql block.
DECLARE
type my_table
IS
  TABLE OF emp_info%rowtype;
  v_table my_table;
BEGIN
  SELECT * bulk collect INTO v_table FROM emp_info;
  FOR i IN v_table.first .. v_table.last
  LOOP
    dbms_output.put_line('' || v_table(i));
  --  dbms_output.put_line('hai');
  END LOOP;
END;



unable to execute above block, causing issue with 'dbms_output.put_line('' || v_table(i));' line.. Any help will really appreciate

thanks in advance,
vibinson Victoria.E

Is This A Good Question/Topic? 0
  • +

Replies To: display all the records using types

#2 Btu  Icon User is offline

  • D.I.C Regular

Reputation: 36
  • View blog
  • Posts: 250
  • Joined: 16-May 11

Re: display all the records using types

Posted 21 February 2013 - 10:20 AM

Since no one has answered I'll just show you what I did to make it work. I'm not sure what your intention is here, but this will work:

DECLARE
type my_table
IS
  TABLE OF customers%rowtype;
  v_table my_table;
BEGIN
  SELECT * bulk collect INTO v_table FROM customers;
  FOR i IN 1..v_table.count
  LOOP
    dbms_output.put_line('' || v_table(i).customer_id);
  END LOOP;
END;



dbms_output.put_line won't let you dump a whole row into the console. But you can output each field with a concatenation || ''
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1