-
How to achive this using sql
I am trying to insert data from vmap_temp to vmap table. Since vmap table does not have any constraints, but I want rpo_key, vehicle_key pair to be unique. So I have to check the data in vmap_temp table before they get inserted into vmap table. How could I accomplish this? How about the following scripts? Can this scripts guarantee the uniquess of rpo_key, vehicle_key pair?
Insert /*+ parallel */ into vmap
(select * from vmap_temp
where (rpo_key, vehicle_key) not in (select rpo_key, vehicle_key from vmap));
commit;
Thanks!
-
Your SQL will work.
Did you check (rpo_key, vehicle_key) uniqueness in the temp table?
Tamil
-
Tamil, thank you! I was afraid of it would check rpo_key, vehicle_key one by one or any of them instead of checking the pair! I need to guarantee the pair of rpo_key, vehicle_key to be unique.
Is there a way to verify the script would check the pair of rpo_key, vehicle_key not in vmap table before the new data get into vmap_temp table?
No, I didn't check (rpo_key, vehicle_key) uniqueness in the temp table?
Thanks again!
-
Create a table with the subquery
Create unique index --use exceptions into clause.
You get it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|