Skip to Main Content
  • Questions
  • SQL*Loader Error 524 Partial Record found at end of datafile

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Ravinder.

Asked: June 21, 2000 - 7:29 am UTC

Last updated: May 27, 2008 - 7:44 am UTC

Version: 8.1.5

Viewed 1000+ times

You Asked

Hi Tom,

Sometime, I face the following error while loading data using
SQL*Loader

SQL*Loader-524 Partial Record found at end of datafile

I have seen the reply you have given for this. But the problem is I am working on Win NT 4.0 and my file size is normally between 500MB - 950MB. And I cant open the file. The problem which I have faced is that sometime the file has a end of file marker and it is treating this as a record.

Is there any way to remove this in Win NT or how can I ignore this using SQL*Loader. I will be upgrading 8.1.6 shortly.

Thanks

Ravi


and Tom said...

I wrote a tiny C program (will email you the binary as an attachment in another email). It simply opens the file for APPEND in binary mode and a mode that allows reading as well as writing. I goto the end of the file, read the last character. If that is NOT '\n', I put a '\n' at the end of the file. If it is a '\n', I do nothing at that point (file is unchanged).

The source code is:

#include "stdio.h"

void main(int argc, char * argv[])
{
FILE * input;


if ( argc < 2 )
{
printf( "usage: addnl FILENAME\n" );
exit(1);
}

/* Append in binary mode, allow for reading */
input = fopen( argv[1], "a+b" );

if ( input == NULL )
{
printf( "Error opening file %s\n", argv[1] );
perror( "fopen()" );
exit(1);
}

/* goto last character */
fseek( input, -1, SEEK_END );

if ( fgetc( input ) != '\n' )
{
printf( "Adding newline, was not there\n" );
fseek( input, 0, SEEK_END );
fputc( '\n', input );
}
else
{
printf( "Newline detected at EOF, not added\n" );
}
fclose( input );
}

and it should be relatively fast as it does not rewrite the entire file, just fixes it up in place. I'll send you the full source, binary and makefile.

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

SQL*Loader-524

Nazmul, May 25, 2008 - 9:15 am UTC

Dear tom,

Getting below error when useing :

LOAD data
infile 'D:\garments\hrm\punchssl\pdata.txt'
into table PUNCHTEMP
(empid position(12:16),
IN_HOUR position(29:30),
IN_MIN position(32:33),
ATTEND_DATE position(18:27) date "yyyy/mm/dd",
CARDNO position(12:16))
============================

D:\garments\HRM\punchssl>sqlldr hrm/hrm@hrmdata sslpdata.ctl

SQL*Loader: Release 8.1.5.0.0 - Production on Sun May 25 19:17:13 2008

(c) Copyright 1999 Oracle Corporation.  All rights reserved.

SQL*Loader-524: partial record found at end of datafile (sslpdata.ctl)

D:\garments\HRM\punchssl>

SQL*Loader-524: partial record found at end of datafile (sslpdata.ctl)


pls advise...

Tom Kyte
May 27, 2008 - 7:44 am UTC

looks like you have a partial record at the end of the datafile....

likely - the last line is missing the newline.

SQL*Loader-524: partial record found at end

Nazmul Hoque, May 29, 2008 - 12:22 am UTC

Thanks for advise my problem is solved