Siebel SQLs/Error Messages >  SQL Loader Oracle Example

SQL Loader Example


SQL Loader is a program in Oracle with which we can add data into a table.
SQL Loader syntax is


SQLLDR CONTROL=sample.ctl, LOG=sample.log, BAD=baz.bad, DATA=etc.dat USERID=scott/tiger@datenbankname, ERRORS=999, LOAD=2000, DISCARD=toss.dsc,DISCARDMAX=5, READSIZE=10000000 ,bindsize=10000000, ROWS=2000

Here is an example of using SQL Loader:


sqlldr test/test@siebe2 control=Accept_Prospect_by.ctl data=MERGEDAcceptProspectby.dat log=Accept_Prospect_by_SQLLDR.log bad=Accept_Prosect_by.bad ERRORS=1000
Here Accept_Prosect_by. bad is a file created with the lines that could not be processed.
ERRORS=1000 means that we will have a maximum of 1000 lines of errors in the log file.

Accept_Prospect_by.ctl   has thic content:


LOAD DATAAPPEND INTO TABLE SIEBEL.EIM_ACCOUNT_UNSERFIELDS TERMINATED BY '|' --OPTIONALLY ENCLOSED BY '"'TRAILING NULLCOLS(PARTY_UID "RTRIM(:PARTY_UID)", PARTY_TYPE_CD "RTRIM('TYPE_CD')",
ROW_ID       SEQUENCE (COUNT, 1),IF_ROW_STAT CONSTANT 'FOR_IMPORT',IF_ROW_BATCH_NUM CONSTANT '1235')


Every line that has - is a comment from right of -


SEQUENCE (COUNT, 1)    means that the first line should have 1, the next 2 and so on.


FIELDS TERMINATED BY '|' --OPTIONALLY ENCLOSED BY '"'   - means that every column is separated from |. And column can be enclosed by quotation marks.


MERGEDAcceptProspectby.dat  has this content

0001|Account0002|Contact0003|Mark0004|Test Typ 10005|Test typ 2
If the load is successful, then SIEBEL and EIM_ACCOUNT_UNSER should have this data.

 

0001|Account
0002|Contact
0003|Mark
0004|Test Typ 1
0005|Test typ 2

If the load is successful, then SIEBEL and EIM_ACCOUNT_UNSER should have this data.

PARTY_UID
PARTY_TYPE_CD
ROW_ID
IF_ROW_STAT
IF_ROW_BATCH_NUM
0001
Account
1
FOR_IMPORT
1235
0002
Contact
2
FOR_IMPORT
1235
0003
Mark
3
FOR_IMPORT
1235
0004
Test Typ 1
4
FOR_IMPORT
1235
0005
Test typ 2
5
FOR_IMPORT
1235