Assume you have the following file whose data you need to insert into the database. Your first step will be to create a file adapter to read this file which is relatively simple.

CREATE OR REPLACE type file_record as object(name varchar2(20), age number, superior varchar2(20));
Then you need to create a nested table for the above type.
CREATE OR REPLACE file_record_tbl as table of file_record;
Now, you need to have a procedure in place for inserting data into the database. This procedure takes file_record_tbl as input parameter (unlike one that takes simple data types as input). Inside the procedure you can use this file_record_tbl to insert data for inserting data.
...
create or replace procedure insert_data(p_file_record_tbl in file_record_tbl) as
begin
FOR x IN 1 .. p_file_record_tbl.COUNT
loop
insert into <table_name>
(
p_file_record_tbl.name,
p_file_record_tbl.age,
p_file_record_tbl.superior
);
end loop;
end insert_data;
...
Now all you need to do is create a database adapter and call this procedure from JDeveloper. Also, use a Transform activity to populate this type with the data from the file. That is all.
1 comment:
Hi,
I am trying the same but my procedure is inside a package, will it be a problem?
Is the procedure need to be out the package?
--Khaleel
Post a Comment