Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

SQL*LOADER -writing control file an execute sql loader from unix-easy questions

Posted on 2003-11-29
1
Medium Priority
?
6,267 Views
Last Modified: 2013-12-12
HI all,
if my file is with extension csv file lets say aaa.csv
in the control file
i write this line
FIELDS TERMINATED BY '      '
my file is csv so what do i write after TERMINATED BY
is it ',' or "," or something else.
My secand qestion is ,when im in unix to execute the sqlldr
do i have to be in a spesific dirctory to operate the loader program?
when i write this command i get an error

sqlldr APPS/APPS@TEST  control=$PELE_TOP/bin/pel_load_shavit2000.ctl  data=$6/$5  log=$PELE_TOP/bin/PEL_LOAD_SHAVIT2000.log  bad=$PELE_TOP/bin/PEL_LOAD_SHAVIT2000.bad

instead of $variable i write what is neded and this is for sure not my problem.If u think my command line is ok what is the syntax error in my ctl file??? (now in my csv there are headers for each field how do i say to sqlloader not to relate to the record of the headers?


LOAD DATA
INTO TABLE MLM.MLM_AR_DATA
REPLACE
FIELDS TERMINATED BY '      '
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
  (CUSTOMER_NUM,
   INVOICE_DATE DATE "DD/MM/YYYY" ,
   JOURNAL_ENTRY_NUMBER,
   CURRENCY_CODE,
   ILS,
   USD,
   OTHER ,
   REFERENCE1 NULLIF (REFERENCE1="UNKNOWN") "SUBSTR(:REFERENCE1,1,20)",
   REFERENCE2 NULLIF (REFERENCE2 ="UNKNOWN") "SUBSTR(:REFERENCE2,1,20)",
   DESCRIPTION NULLIF (DESCRIPTION ="UNKNOWN") "SUBSTR(:DESCRIPTION,1,240)"
  )

0
Comment
Question by:yeitan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 12

Accepted Solution

by:
catchmeifuwant earned 500 total points
ID: 9848265
1)If it is a csv file,then as the name implies,you have a comma for seperating the fields.Hence your control file would be:

INTO TABLE <XXXXX>
fields terminated by ','

2)You need not be in specific header.However you need to set the Environment Variables:

export ORACLE_SID=DBSID
export ORACLE_BASE=/usr2/home/oracle/OraHome1
export ORACLE_HOME=/usr2/home/oracle/OraHome1

<What error are you getting?Echo all the variables that are being used to check if they contain proper values.For ex, echo $5>

3)To skip the Header,you can use the parameter:

skip -- Number of logical records to skip    (Default 0)

More on sqlloader at:

http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96652/ch04.htm

HTH
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question