database design - Versioning normalized Data in Oracle -
i'm trying find way check if data i'm given through bulk load (sqlloader) exists in data set don't load again.
currently have set this,
tablea col1, col2, bulkloadname this table contain data like,
col1, col2, bulkloadname "joe", 35, "load1" "tim", 65, "load1" "ray", 95, "load1" "joe", 35, "load2" and i'd change to,
tablea pk, col1, col2 tableatobulkloadname pk, tablea_pk, bulkloadname_pk bulkloadname pk, bulkloadname where data like,
pk, col1, col2 1, "joe", 35 2, "tim", 65 3, "ray", 95 pk, tablea_pk, bulkloadname_pk 1, 1, 1 2, 2, 1 3, 3, 1 4, 1, 2 pk, bulkloadname 1, "load1" 2, "load2" this normalizes data can check specific load without string search , importantly prevents me loading duplicate data in database because defined again in later load.
i'm having trouble deciding how should implement duplicate checks. i'm not verse sql , need solution in oracle 11g. i've looked , i've come 2 possible solutions...
solution 1:
use temp table store bulk load , run stored procedure once loaded check.
solution 2:
use merge clause on tablea adds new records tablea or creates new intersection record in tableatobulkloadname if record exists.
my questions of background info out there pro's , con's these approaches? kind of normalization normal? there standard ways of doing sort of thing?
thanks!
strictly performance stand point, if can in 1 statement, that's usually better.
but start transform data in various ways, find using staging table, resulting code lot easier read , modify.
Comments
Post a Comment