You are out of luck. Kind of.
You can't use OPTIONALLY ENCLOSED BY <single quote> when there's a single quote character within the input string(s).
Therefore, a possible workaround might be removing OPTIONALLY ENCLOSED from the control file and removing single quotes off the input strings. Something like this:
A test table:SQL> desc test
Name Null? Type
----------------------------------------- -------- -------------------
EMPNO VARCHAR2(4)
ENAME VARCHAR2(20)
Contents of the control file:
SQL> $type test.ctl
load data
infile *
replace
into table test
fields terminated by ','
(empno char "substr(:empno, 2, length(:empno) - 2)",
ename char "substr(:ename, 2, length(:ename) - 2)"
)
begindata
'E001','RAM'
'E002','SHYAM's'
SQL*Loader session:
SQL> $sqlldr scott/tiger control=test.ctl log=test.log
SQL*Loader: Release 10.2.0.1.0 - Production on Cet Pro 31 14:53:13 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 1
Commit point reached - logical record count 2
What we've done:
SQL> select * from test;
EMPN ENAME
---- --------------------
E001 RAM
E002 SHYAM's
SQL>