How can i insert data inro a table with 3 columns using
FORALL?

Answer Posted / ashutosh

you can use 3 different collections for it...

suppose the table is emp have the following columns
1. empname varchar
2. empid number
3. sal number

declare
type name_typ is table of emp.empname%type;
type id_typ is table of emp.empid%type;
type sal_typ is table of emp.sal%type;
name_tab name_typ;
id_tab id_typ;
sal_tab sal_typ;
begin
name_tab := name_typ('ramit','rohan');
id_tab := id_typ(10,20);
sal_tab := sal_typ(21000,22000);
for all i in name_tab.first .. name_tab.last
insert into emp values(name_tab(i),id_tab(i),sal_tab(i));
end;

Is This Answer Correct ?    39 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to get list of all tables from a database?

623


How do I start pl sql?

490


What is difference between mysql and postgresql?

509


Is hadoop a nosql?

569


How insert into statements in sql?

586






how to increment dates by 1 in mysql? : Sql dba

539


what is the use of anchoring object? what r the difference between anchoring object & enclosing object? can any one tell me all the details?

2001


Does truncate require commit?

539


Can variables be used in sql statements?

550


Can ddl statements be used in pl/sql?

591


What is sqlca in powerbuilder?

558


how many groups of data types? : Sql dba

563


What trigger means?

561


How much does a sql dba make? : SQL DBA

503


what is 'mysqldump'? : Sql dba

566