Links
Home
Oracle DBA Forum
Frequent Oracle Errors
TNS:could not resolve the connect identifier specified
Backtrace message unwound by exceptions
invalid identifier
PL/SQL compilation error
internal error
missing expression
table or view does not exist
end-of-file on communication channel
TNS:listener unknown in connect descriptor
insufficient privileges
PL/SQL: numeric or value error string
TNS:protocol adapter error
ORACLE not available
target host or object does not exist
invalid number
unable to allocate string bytes of shared memory
resource busy and acquire with NOWAIT specified
error occurred at recursive SQL level string
ORACLE initialization or shutdown in progress
archiver error. Connect internal only, until freed
snapshot too old
unable to extend temp segment by string in tablespace
Credential retrieval failed
missing or invalid option
invalid username/password; logon denied
unable to create INITIAL extent for segment
out of process memory when trying to allocate string bytes
shared memory realm does not exist
cannot insert NULL
TNS:unable to connect to destination
remote database not found'>ora-02019
exception encountered: core dump
inconsistent datatypes
no data found
TNS:operation timed out
PL/SQL: could not find program
existing state of packages has been discarded
maximum number of processes exceeded
error signaled in parallel query server
ORACLE instance terminated. Disconnection forced
TNS:packet writer failure
see ORA-12699
missing right parenthesis
name is already used by an existing object
cannot identify/lock data file
invalid file operation
quoted string not properly terminated
SQL*Loader Date error (ORA-01858)

SQL*Loader Date error (ORA-01858)

2005-12-09       - By brian.x.wisniewski@(protected)

Reply:     1     2     3     4     5  

Madhavi, did you get this figured out?  I hadn't seen a reply on the list.


When I run into issues like this I typically create a table with all
varchar fields and load into that table to check if what I'm loading into
the columns is what I expected to.  Often it's not and adjustments need to
be made in the control file.

I also prefer external tables - just preference.  I create the external
table as varchars and then do the manipulation on the fields during the
select from the external.

rbld=`$SQL >> $OUT_FILE << !REBUILD

       create directory $BASE_DIR_NAME as '$BASE_DIR';
       create directory $LOG_DIR_NAME as '$LOG_DIR';

       grant read,write on directory $BASE_DIR_NAME to $OWNER,
bwisniewski;
       grant read,write on directory $LOG_DIR_NAME to $OWNER,
bwisniewski;

       create table $EXT_TABLE
               (BAN    varchar2(9),
               NAME      varchar2(20),
               ADDRESS varchar2(25),
               CITY    varchar2(12),
               STATE   varchar2(2),
               ZIP     varchar2(5),
               SUBSCRIBER varchar2(10),
               BALANCE varchar2(8))
               organization external
               (type oracle_loader
                       default directory $BASE_DIR_NAME
                       access parameters
                               (records fixed 99 delimited by newline
                               badfile $LOG_DIR_NAME:'$BAD_FILE'
                               logfile $LOG_DIR_NAME:'$LOG_FILE'
                               discardfile $LOG_DIR_NAME:'$DIS_FILE'
                               load when (ban notequal blanks and
subscriber notequal blanks)
                               fields lrtrim(
                               BAN (1:+9),
                               NAME (*:+20),
                               ADDRESS (*:+25),
                               CITY (*:+12),
                               STATE (*:+2),
                               ZIP (*:+5),
                               SUBSCRIBER (*:+10),
                               BALANCE (*:+8)))
                               location ($BASE_DIR_NAME:'$FTP_FILE'))
                               reject limit unlimited;

!REBUILD`

...

This is where I do the formatting and conversion to a number..

       insert into $TABLE (ban, name, address, city, state, zip,
subscriber, balance)
               select ban, name, address, city, state, zip, subscriber,
to_number(ltrim(balance,'0'))/100
               from $EXT_TABLE;

- Brian






Madhavi Kanugo <MKanugo@(protected)>
Sent by: oracle-l-bounce@(protected)
12/07/2005 01:19 PM
Please respond to MKanugo

       To:     "'oracle-l@(protected)'" <oracle-l@(protected)>
       cc:
       Subject:        SQL*Loader Date error (ORA-01858 (See ORA-01858.ora-code.com))


Hello  All,

I'm trying to load data using SQL Loader and ran into the ORA-01858 (See ORA-01858.ora-code.com): a
non-numeric character was found where a numeric was expected  error.

Below is my control file. As you can see, the timestamp is a constant
field and I am loading its value from the filename of the data files. I am
executing the sql loader from a shell script and creating the control file
on the fly. The filename is in the form of: 20051206130101.txt  So
basically, the shell script replaces the when_changed value with
20051206130101.

I created a temp table with just a date field and tried to insert a value
into it. Insert into temp values (to_date('20051207160752',
'YYYYMMDDHH24MISS')); and there is no error and date conversion is
implict.

But SQLLOADER is erring out on ORA-01858 (See ORA-01858.ora-code.com).

LOAD DATA
INFILE FILENAME
APPEND
INTO TABLE RE_STATS_STAGING
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
   TRAILING NULLCOLS
(
 RE_NAME,
 TG_TYPE,
 TRUNKGROUP,
 CONNECTS,
 HANGUPS,
 DECLINES,
           LOOPS,
           SECONDS,
           CC_CONNECTED,
           CC_SETUP,
           TIMESTAMP CONSTANT
"to_date('_when_changed_','YYYYMMDDHH24MISS')"
       )

Any ideas on where I am going wrong? Any thoughts or help will be
appreciated.

Thanks in advance,
Madhavi




<br><font size=2 face="sans-serif">Madhavi, did you get this figured out?
&nbsp;I hadn't seen a reply on the list. </font>
<br>
<br><font size=2 face="sans-serif">When I run into issues like this I typically
create a table with all varchar fields and load into that table to check
if what I'm loading into the columns is what I expected to. &nbsp;Often
it's not and adjustments need to be made in the control file.</font>
<br>
<br><font size=2 face="sans-serif">I also prefer external tables - just
preference. &nbsp;I create the external table as varchars and then do the
manipulation on the fields during the select from the external.</font>
<br>
<br><font size=2 face="Courier New">rbld=`$SQL &gt;&gt; $OUT_FILE &lt;&lt;
!REBUILD</font>
<br>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; create
directory $BASE_DIR_NAME as '$BASE_DIR';</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; create
directory $LOG_DIR_NAME as '$LOG_DIR';</font>
<br>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; grant
read,write on directory $BASE_DIR_NAME to $OWNER, bwisniewski;</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; grant
read,write on directory $LOG_DIR_NAME to $OWNER, bwisniewski;</font>
<br>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; create
table $EXT_TABLE</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; (BAN &nbsp; &nbsp;varchar2(9),</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
varchar2(20),</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; ADDRESS varchar2(25),</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; CITY &nbsp; &nbsp;varchar2(12),</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; STATE &nbsp; varchar2(2),</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; ZIP &nbsp; &nbsp; varchar2(5),</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; SUBSCRIBER varchar2(10),</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; BALANCE varchar2(8))</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; organization external</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; (type oracle_loader</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; default
directory $BASE_DIR_NAME</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; access
parameters</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; (records fixed 99 delimited by newline</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; badfile $LOG_DIR_NAME:'$BAD_FILE'</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; logfile $LOG_DIR_NAME:'$LOG_FILE'</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; discardfile $LOG_DIR_NAME:'$DIS_FILE'</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; load when (ban notequal blanks and subscriber notequal
blanks)</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; fields lrtrim(</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; BAN (1:+9),</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; NAME (*:+20),</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; ADDRESS (*:+25),</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; CITY (*:+12),</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; STATE (*:+2),</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; ZIP (*:+5),</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; SUBSCRIBER (*:+10),</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; BALANCE (*:+8)))</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp;location ($BASE_DIR_NAME:'$FTP_FILE'))</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp;reject limit unlimited;</font>
<br>
<br><font size=2 face="Courier New">!REBUILD`</font>
<br>
<br><font size=2 face="sans-serif">...</font>
<br>
<br><font size=2 face="sans-serif">This is where I do the formatting and
conversion to a number..</font>
<br>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; insert
into $TABLE (ban, name, address, city, state, zip, subscriber, balance)</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; select ban, name, address, city, state, zip,
subscriber, to_number(ltrim(balance,'0'))/100 </font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; from $EXT_TABLE;</font>
<br>
<br><font size=2 face="sans-serif">- Brian</font>
<br>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td>
<td><font size=1 face="sans-serif"><b>Madhavi Kanugo &lt;MKanugo@(protected)&gt;
</b></font>
<br><font size=1 face="sans-serif">Sent by: oracle-l-bounce@(protected)</font>
<p><font size=1 face="sans-serif">12/07/2005 01:19 PM</font>
<br><font size=1 face="sans-serif">Please respond to MKanugo</font>
<td><font size=1 face="Arial">&nbsp; &nbsp; &nbsp; &nbsp; </font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; To:
&nbsp; &nbsp; &nbsp; &nbsp;&quot;'oracle-l@(protected)'&quot;
&lt;oracle-l@(protected)&gt;</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; cc:
&nbsp; &nbsp; &nbsp; &nbsp;</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Subject:
&nbsp; &nbsp; &nbsp; &nbsp;SQL*Loader Date error (ORA-01858 (See ORA-01858.ora-code.com))</font></table>
<br>
<br>
<br><font size=2 face="Arial">Hello &nbsp;All,</font>
<br><font size=2 face="Arial">&nbsp;</font>
<br><font size=2 face="Arial">I'm trying to load data using SQL Loader
and ran into the ORA-01858 (See ORA-01858.ora-code.com): </font><font size=3 face="Times New Roman">a
non-numeric character was found where a numeric was expected &nbsp;</font><font
size=2 face="Arial">error.</font>
<br><font size=2 face="Arial">&nbsp;</font>
<br><font size=2 face="Arial">Below is my control file. As you can see,
the timestamp is a constant field and I am loading its value from the filename
of the data files. I am executing the sql loader from a shell script and
creating the control file on the fly. The filename is in the form of:
20051206130101.txt
&nbsp;So basically, the shell script replaces the when_changed value with
20051206130101.</font>
<br><font size=2 face="Arial">&nbsp;</font>
<br><font size=2 face="Arial">I created a temp table with just a date field
and tried to insert a value into it. Insert into temp values (</font><font size
=2 face="Courier">to_date</font><font size=2 color=#0000f0 face="Courier">(<
/font><font size=2 color=red face="Courier">'20051207160752'</font><font size=2
color=#0000f0 face="Courier">,</font><font size=2 color=red face="Courier">
'YYYYMMDDHH24MISS'</font><font size=2 color=#0000f0 face="Courier">));
and there is no error and date conversion is implict.</font>
<br><font size=2 color=#0000f0 face="Courier">&nbsp;</font>
<br><font size=2 color=#0000f0 face="Courier">But SQLLOADER is erring out
on ORA-01858 (See ORA-01858.ora-code.com). </font>
<br><font size=2 face="Arial">&nbsp;</font>
<br><font size=2 face="Arial">LOAD DATA </font>
<br><font size=2 face="Arial">INFILE FILENAME </font>
<br><font size=2 face="Arial">APPEND </font>
<br><font size=2 face="Arial">INTO TABLE RE_STATS_STAGING</font>
<br><font size=2 face="Arial">FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED
BY '&quot;' </font>
<br><font size=2 face="Arial">&nbsp; &nbsp; TRAILING NULLCOLS </font>
<br><font size=2 face="Arial">( </font>
<br><font size=2 face="Arial">&nbsp; RE_NAME,</font>
<br><font size=2 face="Arial">&nbsp; TG_TYPE,</font>
<br><font size=2 face="Arial">&nbsp; TRUNKGROUP,</font>
<br><font size=2 face="Arial">&nbsp; CONNECTS,</font>
<br><font size=2 face="Arial">&nbsp; HANGUPS,</font>
<br><font size=2 face="Arial">&nbsp; DECLINES,</font>
<br><font size=2 face="Arial">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
LOOPS,</font>
<br><font size=2 face="Arial">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
SECONDS,</font>
<br><font size=2 face="Arial">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
CC_CONNECTED,</font>
<br><font size=2 face="Arial">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
CC_SETUP,</font>
<br><font size=2 face="Arial">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
TIMESTAMP CONSTANT &quot;to_date('_when_changed_','YYYYMMDDHH24MISS')&quot;<
/font>
<br><font size=2 face="Arial">&nbsp; &nbsp; &nbsp; &nbsp; )</font>
<br><font size=2 face="Arial">&nbsp;</font>
<br><font size=2 face="Arial">Any ideas on where I am going wrong? Any
thoughts or help will be appreciated.</font>
<br><font size=2 face="Arial"><br>
Thanks in advance,</font>
<br><font size=2 face="Arial">Madhavi</font>
<br><font size=2 face="Arial">&nbsp;</font>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br>