SQL Oracle - Data transfer between relational and object tables -
i need solution data transfer between 2 tables in oracle database. source relational type , target object type of table. here example:
source table (existing data):
create table "history" ( "id" number, "id_process" number, "id_unit" number, "pass_date" date default sysdate ); create unique index "history_pk" on "history" ("id"); alter table "history" add constraint "history_process_fk1" foreign key ("id_process") references "process" ("id"); alter table "history" add constraint "history_process_fk2" foreign key ("id_unit") references "units" ("id"); target table (empty):
create or replace type t_history object ( "id" number, "id_process" ref t_process, "id_unit" ref t_unit, "pass_date" date ); create table o_history of t_history ( "id" primary key);
assuming you've created types , object tables process , unit values, can do:
insert o_history select t_history(h.id, ref(p), ref(u), h.pass_date) history h join o_process p on p.id_process = h.id_process join o_unit u on u.id_unit = h.id_unit; this gets id , pass date history table, , gets references other tables matching values.
Comments
Post a Comment