Tuesday, 30 April 2013

Control file in multiple insert function.......

OPTIONS ( SKIP 1, ERRORS=1000000, DIRECT=FALSE)
LOAD DATA
--INFILE --"PATH"
--TRUNCATE
APPEND
INTO TABLE CGINV_MATL_RECPT
WHEN Transaction_type = 'REC'
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(  
Item                   position(1) "REPLACE(LTRIM(RTRIM(:Item)),chr(34),NULL)",
LOT_NUMBER        "REPLACE(LTRIM(RTRIM(:LOT_NUMBER)),chr(34),NULL)",
ISSUED_TO        "REPLACE(LTRIM(RTRIM(:ISSUED_TO)),chr(34),NULL)",
RECEIVED_BY        "REPLACE(LTRIM(RTRIM(:RECEIVED_BY)),chr(34),NULL)",
WO_NUMBER        "REPLACE(LTRIM(RTRIM(:WO_NUMBER)),chr(34),NULL)",
TO_CREW_NUMBER        "REPLACE(LTRIM(RTRIM(:TO_CREW_NUMBER)),chr(34),NULL)",
FROM_SUBINVENTORY    "REPLACE(LTRIM(RTRIM(:FROM_SUBINVENTORY)),chr(34),NULL)",
QTY            "REPLACE(LTRIM(RTRIM(:QTY)),chr(34),NULL)",
PO_NUMBER        "REPLACE(LTRIM(RTRIM(:PO_NUMBER)),chr(34),NULL)",
RMA_NUMBER        "REPLACE(LTRIM(RTRIM(:RMA_NUMBER)),chr(34),NULL)" ,
TRANSACTION_DATE    "TO_DATE(REPLACE(LTRIM(RTRIM(:TRANSACTION_DATE)),chr(34),NULL),'DD-MON-RR')",
CREW_NUMBER        "REPLACE(LTRIM(RTRIM(:CREW_NUMBER)),chr(34),NULL)",
FROM_WO_NUMBER        "REPLACE(LTRIM(RTRIM(:FROM_WO_NUMBER)),chr(34),NULL)",
TRANSACTION_TYPE    "REPLACE(LTRIM(RTRIM(:TRANSACTION_TYPE)),chr(34),NULL)" ,
SUBINVENTORY        "REPLACE(Substr(:SUBINVENTORY,1,0),chr(34),NULL)",
INVENTORY_ORG        "REPLACE(LTRIM(RTRIM(:INVENTORY_ORG)),chr(34),NULL)" ,
TIME_STAMP        "REPLACE(LTRIM(RTRIM(:TIME_STAMP)),chr(34),NULL)" ,   
Reason            "REPLACE(LTRIM(RTRIM(:REASON)),chr(34),NULL)",
PROCESS_FLAG            CONSTANT "N" ,
created_by             "fnd_global.USER_ID",
creation_date           SYSDATE ,
last_update_date        SYSDATE,
last_update_login    "fnd_global.login_id",          
last_updated_by        "fnd_global.USER_ID",
PO_RECPT_STG_ID        "CGINV_MATL_RECPT_S.NextVal"
)

INTO TABLE CGINV_INV_TRANS
WHEN Transaction_type = 'SISSUE'
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(  
Item                   position(1) "REPLACE(LTRIM(RTRIM(:Item)),chr(34),NULL)",
LOT_NUM        "REPLACE(LTRIM(RTRIM(:LOT_NUM)),chr(34),NULL)",
Issued_to        "REPLACE(LTRIM(RTRIM(:Issued_to)),chr(34),NULL)",
received_by        "REPLACE(LTRIM(RTRIM(:received_by)),chr(34),NULL)",
to_wo_num        "REPLACE(LTRIM(RTRIM(:to_wo_num)),chr(34),NULL)",
to_crew_number        "REPLACE(LTRIM(RTRIM(:to_crew_number)),chr(34),NULL)",
FROM_SUBINVENTORY    "REPLACE(LTRIM(RTRIM(:FROM_SUBINVENTORY)),chr(34),NULL)",
TRANSACTION_QTY        "REPLACE(LTRIM(RTRIM(:TRANSACTION_QTY)),chr(34),NULL)",
PO_NUMBER        "REPLACE(LTRIM(RTRIM(:PO_NUMBER)),chr(34),NULL)",               
RMA_NUMBER        "REPLACE(LTRIM(RTRIM(:RMA_NUMBER)),chr(34),NULL)" ,   
TRANSACTION_DATE    "TO_DATE(REPLACE(LTRIM(RTRIM(:TRANSACTION_DATE)),chr(34),NULL),'DD-MON-RR')" ,
from_crew_NUMber    "REPLACE(LTRIM(RTRIM(:from_crew_NUMber)),chr(34),NULL)" ,
FROM_wo_NUM    "REPLACE(LTRIM(RTRIM(:FROM_wo_NUM)),chr(34),NULL)",
Transaction_type    "REPLACE(LTRIM(RTRIM(:Transaction_type)),chr(34),NULL)" ,
Transfer_SUBINVENTORY        "REPLACE(LTRIM(RTRIM(:Transfer_SUBINVENTORY)),chr(34),NULL)" ,
ORG            "REPLACE(LTRIM(RTRIM(:ORG)),chr(34),NULL)" ,
TIME_STAMP        "REPLACE(LTRIM(RTRIM(:TIME_STAMP)),chr(34),NULL)" ,
Reason            "REPLACE(LTRIM(RTRIM(:Reason)),chr(34),NULL)",
PROJECT_NUM        "REPLACE(LTRIM(RTRIM(:PROJECT_NUM)),chr(34),NULL)",
TRANSFER_ORG            "REPLACE(LTRIM(RTRIM(:TRANSFER_ORG)),chr(34),NULL)",
PROCESS_FLAG            CONSTANT "N" ,
created_by             "fnd_global.USER_ID",
creation_date           SYSDATE ,
last_update_date        SYSDATE,
last_update_login    "fnd_global.login_id",          
last_updated_by        "fnd_global.USER_ID",
Transaction_ID         "CGINV_INV_TRANS_S.NextVal" 
)

INTO TABLE CGINV_INV_TRANS
WHEN Transaction_type = 'TRNS'
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(  
Item                   position(1) "REPLACE(LTRIM(RTRIM(:Item)),chr(34),NULL)",
LOT_NUM        "REPLACE(LTRIM(RTRIM(:LOT_NUM)),chr(34),NULL)",
Issued_to        "REPLACE(LTRIM(RTRIM(:Issued_to)),chr(34),NULL)",
received_by        "REPLACE(LTRIM(RTRIM(:received_by)),chr(34),NULL)",
to_wo_num        "REPLACE(LTRIM(RTRIM(:to_wo_num)),chr(34),NULL)",
to_crew_number        "REPLACE(LTRIM(RTRIM(:to_crew_number)),chr(34),NULL)",
FROM_SUBINVENTORY    "REPLACE(LTRIM(RTRIM(:FROM_SUBINVENTORY)),chr(34),NULL)",
TRANSACTION_QTY        "REPLACE(LTRIM(RTRIM(:TRANSACTION_QTY)),chr(34),NULL)",
PO_NUMBER        "REPLACE(LTRIM(RTRIM(:PO_NUMBER)),chr(34),NULL)",               
RMA_NUMBER        "REPLACE(LTRIM(RTRIM(:RMA_NUMBER)),chr(34),NULL)" ,   
TRANSACTION_DATE    "TO_DATE(REPLACE(LTRIM(RTRIM(:TRANSACTION_DATE)),chr(34),NULL),'DD-MON-RR')" ,
from_crew_NUMber    "REPLACE(LTRIM(RTRIM(:from_crew_NUMber)),chr(34),NULL)" ,
FROM_wo_NUM    "REPLACE(LTRIM(RTRIM(:FROM_wo_NUM)),chr(34),NULL)",
Transaction_type    "REPLACE(LTRIM(RTRIM(:Transaction_type)),chr(34),NULL)" ,
Transfer_SUBINVENTORY        "REPLACE(LTRIM(RTRIM(:Transfer_SUBINVENTORY)),chr(34),NULL)" ,
ORG            "REPLACE(LTRIM(RTRIM(:ORG)),chr(34),NULL)" ,
TIME_STAMP        "REPLACE(LTRIM(RTRIM(:TIME_STAMP)),chr(34),NULL)" ,
Reason            "REPLACE(LTRIM(RTRIM(:Reason)),chr(34),NULL)",
PROJECT_NUM        "REPLACE(LTRIM(RTRIM(:PROJECT_NUM)),chr(34),NULL)",
TRANSFER_ORG            "REPLACE(LTRIM(RTRIM(:TRANSFER_ORG)),chr(34),NULL)",
PROCESS_FLAG            CONSTANT "N" ,
created_by             "fnd_global.USER_ID",
creation_date           SYSDATE ,
last_update_date        SYSDATE,
last_update_login    "fnd_global.login_id",          
last_updated_by        "fnd_global.USER_ID",
Transaction_ID         "CGINV_INV_TRANS_S.NextVal" 
)

INTO TABLE CGINV_INV_TRANS
WHEN Transaction_type = 'SRETN'
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(  
Item                   position(1) "REPLACE(LTRIM(RTRIM(:Item)),chr(34),NULL)",
LOT_NUM        "REPLACE(LTRIM(RTRIM(:LOT_NUM)),chr(34),NULL)",
Issued_to        "REPLACE(LTRIM(RTRIM(:Issued_to)),chr(34),NULL)",
received_by        "REPLACE(LTRIM(RTRIM(:received_by)),chr(34),NULL)",
to_wo_num        "REPLACE(LTRIM(RTRIM(:to_wo_num)),chr(34),NULL)",
to_crew_number        "REPLACE(LTRIM(RTRIM(:to_crew_number)),chr(34),NULL)",
FROM_SUBINVENTORY    "REPLACE(LTRIM(RTRIM(:FROM_SUBINVENTORY)),chr(34),NULL)",
TRANSACTION_QTY        "REPLACE(LTRIM(RTRIM(:TRANSACTION_QTY)),chr(34),NULL)",
PO_NUMBER        "REPLACE(LTRIM(RTRIM(:PO_NUMBER)),chr(34),NULL)",               
RMA_NUMBER        "REPLACE(LTRIM(RTRIM(:RMA_NUMBER)),chr(34),NULL)" ,   
TRANSACTION_DATE    "TO_DATE(REPLACE(LTRIM(RTRIM(:TRANSACTION_DATE)),chr(34),NULL),'DD-MON-RR')" ,
from_crew_NUMber    "REPLACE(LTRIM(RTRIM(:from_crew_NUMber)),chr(34),NULL)" ,
FROM_wo_NUM    "REPLACE(LTRIM(RTRIM(:FROM_wo_NUM)),chr(34),NULL)",
Transaction_type    "REPLACE(LTRIM(RTRIM(:Transaction_type)),chr(34),NULL)" ,
Transfer_SUBINVENTORY        "REPLACE(LTRIM(RTRIM(:Transfer_SUBINVENTORY)),chr(34),NULL)" ,
ORG            "REPLACE(LTRIM(RTRIM(:ORG)),chr(34),NULL)" ,
TIME_STAMP        "REPLACE(LTRIM(RTRIM(:TIME_STAMP)),chr(34),NULL)" ,
Reason            "REPLACE(LTRIM(RTRIM(:Reason)),chr(34),NULL)",
PROJECT_NUM        "REPLACE(LTRIM(RTRIM(:PROJECT_NUM)),chr(34),NULL)",
TRANSFER_ORG            "REPLACE(LTRIM(RTRIM(:TRANSFER_ORG)),chr(34),NULL)",
PROCESS_FLAG            CONSTANT "N" ,
created_by             "fnd_global.USER_ID",
creation_date           SYSDATE ,
last_update_date        SYSDATE,
last_update_login    "fnd_global.login_id",          
last_updated_by        "fnd_global.USER_ID",
Transaction_ID         "CGINV_INV_TRANS_S.NextVal" 
)

INTO TABLE CGINV_INV_TRANS
WHEN Transaction_type = 'DEPLT'
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(  
Item                   position(1) "REPLACE(LTRIM(RTRIM(:Item)),chr(34),NULL)",
LOT_NUM                "REPLACE(LTRIM(RTRIM(:LOT_NUM)),chr(34),NULL)",
Issued_to        "REPLACE(LTRIM(RTRIM(:Issued_to)),chr(34),NULL)",
received_by        "REPLACE(LTRIM(RTRIM(:received_by)),chr(34),NULL)",
to_wo_num        "REPLACE(LTRIM(RTRIM(:to_wo_num)),chr(34),NULL)",
to_crew_number        "REPLACE(LTRIM(RTRIM(:to_crew_number)),chr(34),NULL)",
FROM_SUBINVENTORY    "REPLACE(LTRIM(RTRIM(:FROM_SUBINVENTORY)),chr(34),NULL)",
TRANSACTION_QTY        "REPLACE(LTRIM(RTRIM(:TRANSACTION_QTY)),chr(34),NULL)",
PO_NUMBER        "REPLACE(LTRIM(RTRIM(:PO_NUMBER)),chr(34),NULL)",               
RMA_NUMBER        "REPLACE(LTRIM(RTRIM(:RMA_NUMBER)),chr(34),NULL)" ,   
TRANSACTION_DATE    "TO_DATE(REPLACE(LTRIM(RTRIM(:TRANSACTION_DATE)),chr(34),NULL),'DD-MON-RR')" ,
from_crew_NUMber    "REPLACE(LTRIM(RTRIM(:from_crew_NUMber)),chr(34),NULL)" ,
FROM_wo_NUM    "REPLACE(LTRIM(RTRIM(:FROM_wo_NUM)),chr(34),NULL)",
Transaction_type    "REPLACE(LTRIM(RTRIM(:Transaction_type)),chr(34),NULL)" ,
Transfer_SUBINVENTORY        "REPLACE(LTRIM(RTRIM(:Transfer_SUBINVENTORY)),chr(34),NULL)" ,
ORG            "REPLACE(LTRIM(RTRIM(:ORG)),chr(34),NULL)" ,
TIME_STAMP        "REPLACE(LTRIM(RTRIM(:TIME_STAMP)),chr(34),NULL)" ,
Reason            "REPLACE(LTRIM(RTRIM(:Reason)),chr(34),NULL)",
PROJECT_NUM        "REPLACE(LTRIM(RTRIM(:PROJECT_NUM)),chr(34),NULL)",
TRANSFER_ORG            "REPLACE(LTRIM(RTRIM(:TRANSFER_ORG)),chr(34),NULL)",
PROCESS_FLAG            CONSTANT "N" ,
created_by             "fnd_global.USER_ID",
creation_date           SYSDATE ,
last_update_date        SYSDATE,
last_update_login    "fnd_global.login_id",          
last_updated_by        "fnd_global.USER_ID",
Transaction_ID         "CGINV_INV_TRANS_S.NextVal" 
)

INTO TABLE CGINV_INV_TRANS
WHEN Transaction_type = 'INTERORG'
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(  
Item                   position(1) "REPLACE(LTRIM(RTRIM(:Item)),chr(34),NULL)",
LOT_NUM                "REPLACE(LTRIM(RTRIM(:LOT_NUM)),chr(34),NULL)",
Issued_to        "REPLACE(LTRIM(RTRIM(:Issued_to)),chr(34),NULL)",
received_by        "REPLACE(LTRIM(RTRIM(:received_by)),chr(34),NULL)",
to_wo_num        "REPLACE(LTRIM(RTRIM(:to_wo_num)),chr(34),NULL)",
to_crew_number        "REPLACE(LTRIM(RTRIM(:to_crew_number)),chr(34),NULL)",
FROM_SUBINVENTORY    "REPLACE(LTRIM(RTRIM(:FROM_SUBINVENTORY)),chr(34),NULL)",
TRANSACTION_QTY        "REPLACE(LTRIM(RTRIM(:TRANSACTION_QTY)),chr(34),NULL)",
PO_NUMBER        "REPLACE(LTRIM(RTRIM(:PO_NUMBER)),chr(34),NULL)",               
RMA_NUMBER        "REPLACE(LTRIM(RTRIM(:RMA_NUMBER)),chr(34),NULL)" ,   
TRANSACTION_DATE    "TO_DATE(REPLACE(LTRIM(RTRIM(:TRANSACTION_DATE)),chr(34),NULL),'DD-MON-RR')" ,
from_crew_NUMber    "REPLACE(LTRIM(RTRIM(:from_crew_NUMber)),chr(34),NULL)" ,
FROM_wo_NUM    "REPLACE(LTRIM(RTRIM(:FROM_wo_NUM)),chr(34),NULL)",
Transaction_type    "REPLACE(LTRIM(RTRIM(:Transaction_type)),chr(34),NULL)" ,
Transfer_SUBINVENTORY        "REPLACE(LTRIM(RTRIM(:Transfer_SUBINVENTORY)),chr(34),NULL)" ,
ORG            "REPLACE(LTRIM(RTRIM(:ORG)),chr(34),NULL)" ,
TIME_STAMP        "REPLACE(LTRIM(RTRIM(:TIME_STAMP)),chr(34),NULL)" ,
Reason            "REPLACE(LTRIM(RTRIM(:Reason)),chr(34),NULL)",
PROJECT_NUM        "REPLACE(LTRIM(RTRIM(:PROJECT_NUM)),chr(34),NULL)",
TRANSFER_ORG            "REPLACE(REPLACE(LTRIM(RTRIM(:TRANSFER_ORG)),chr(34),NULL),chr(13),NULL)",
PROCESS_FLAG            CONSTANT "N" ,
created_by             "fnd_global.USER_ID",
creation_date           SYSDATE ,
last_update_date        SYSDATE,
last_update_login    "fnd_global.login_id",          
last_updated_by        "fnd_global.USER_ID",
Transaction_ID         "CGINV_INV_TRANS_S.NextVal"
)

INTO TABLE CGINV_ONHAND_STG
WHEN Transaction_type = 'OHCONV'
FIELDS TERMINATED BY ","
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(  
Item                   position(1) "REPLACE(LTRIM(RTRIM(:Item)),chr(34),NULL)",
lot_number        "REPLACE(LTRIM(RTRIM(:lot_number)),chr(34),NULL)",
Issued_to        "REPLACE(LTRIM(RTRIM(:Issued_to)),chr(34),NULL)",
received_by        "REPLACE(LTRIM(RTRIM(:received_by)),chr(34),NULL)",
wo_number        "REPLACE(LTRIM(RTRIM(:wo_number)),chr(34),NULL)",
to_crew_number        "REPLACE(LTRIM(RTRIM(:to_crew_number)),chr(34),NULL)",
FROM_SUBINVENTORY    "REPLACE(LTRIM(RTRIM(:FROM_SUBINVENTORY)),chr(34),NULL)",
transaction_quantity    "REPLACE(LTRIM(RTRIM(:transaction_quantity)),chr(34),NULL)",
PO_NUMBER        "REPLACE(LTRIM(RTRIM(:PO_NUMBER)),chr(34),NULL)",               
RMA_NUMBER        "REPLACE(LTRIM(RTRIM(:RMA_NUMBER)),chr(34),NULL)" ,   
transaction_date    "TO_DATE(REPLACE(LTRIM(RTRIM(:transaction_date)),chr(34),NULL),'DD-MON-RR')" ,
crew_number             "REPLACE(LTRIM(RTRIM(:crew_number)),chr(34),NULL)",
From_work_order_number    "REPLACE(LTRIM(RTRIM(:From_work_order_number)),chr(34),NULL)",
Transaction_type    "REPLACE(LTRIM(RTRIM(:Transaction_type)),chr(34),NULL)" ,
SUBINVENTORY            "REPLACE(LTRIM(RTRIM(:SUBINVENTORY)),chr(34),NULL)" ,
inventory_org        "REPLACE(LTRIM(RTRIM(:inventory_org)),chr(34),NULL)" ,
TIME_STAMP        "REPLACE(LTRIM(RTRIM(:TIME_STAMP)),chr(34),NULL)" ,
Reason            "REPLACE(LTRIM(RTRIM(:Reason)),chr(34),NULL)",
PROCESS_FLAG            CONSTANT "N" ,
Transaction_ID        "CGINV_INV_TRANS_S.NextVal",
created_by              "fnd_global.USER_ID",
creation_date           SYSDATE ,
last_update_date        SYSDATE,
last_update_login       "fnd_global.login_id",          
last_updated_by         "fnd_global.USER_ID"
)

No comments:

Post a Comment