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
How to create an array in pl/sql?
what are the features and advantages of object-oriented programming? : Sql dba
Which version of sql do I have?
What is a recursive stored procedure?
What is primary and foreign key?
Is it possible to read/write files to-and-from PL/SQL?
What are its different types of dbms?
What is the use of desc in sql?
what are aggregate and scalar functions? : Sql dba
how to use case expression? : Sql dba
explain the difference between bool, tinyint and bit. : Sql dba
How does cross join work in sql?
Can we use delete in merge statement?
what is 'trigger' in sql? : Sql dba
What is the difference between function and procedure in pl/sql?