I want to join the two tables and use bulk collect and insert into the other table and having the respective columns , i tried using to join two tables the employees ,departments table
but getting error . I created the table named jai having the columns of both the tables
drop table jai
create table jai (first_name varchar2(100),last_name varchar2(100),email varchar2(100),
salary number,job_id number,department_id number,department_name varchar2(100))
create or replace procedure join_sp
2 as
3 type join_rec is record(first_name varchar2(100),last_name varchar2(100),email varchar2(100),
4 salary number,job_id number,department_name varchar2(100),department_id number);
5 type join_typ3 is table of join_rec;
6 v_join join_typ3:=join_typ3();
7 begin
8 select e.first_name ,e.last_name ,e.email,
9 e.salary ,e.job_id ,e.department_id ,d.department_id,d.department_name bulk collect into v_join
10 from employees e,departments d where e.department_id=d.department_id;
11 forall i in v_join.first..v_join.last
12 insert into jai values v_join(i);
13 end;
14 /
Warning: Procedure created with compilation errors.
SQL> show error
Errors for PROCEDURE JOIN_SP:
LINE/COL ERROR
-------- -----------------------------------------------------------------
8/1 PL/SQL: SQL Statement ignored
9/97 PL/SQL: ORA-00947: not enough values
i am getting the error like this, kindly tell me the solution to solve the procedure joining the two tables and inserting into the other table using bulk collect.