Home » RDBMS Server » Server Utilities » SQL LOAD - Counting records
SQL LOAD - Counting records [message #368199] Thu, 28 September 2000 09:20 Go to next message
Chella
Messages: 25
Registered: September 2000
Junior Member
I need to count the records I am downloading from a .TXT file.
The file is not straight forward. I have to SKIP the first 4
records and then last three records and then perform the count.
The total record count and the date which the file was loaded
into Oracle needs to go into the following table structure;

BSPDate DATE
TotRecords NUMBER

I started my control file like this but clueless as to how to
perform the count and the SYSDATE.

Load Data
INFILE 'c:\bsp\Stmt.txt'
APPEND
INTO TABLE tblMailBoxRecords
(
BSPDate SYSDATE ?
TotRecords ?
)

Can you help me complete this control file ? Ta

Chella
Re: SQL LOAD - Counting records [message #368211 is a reply to message #368199] Mon, 02 October 2000 12:28 Go to previous messageGo to next message
Bala
Messages: 205
Registered: November 1999
Senior Member
Hi ,

You don't need to use sql ldr to insert the one line information.
You can do it sql plus like this.

column before_count new_val bcnt;
column after_count new_val acnt;

select count(*) as before_count from t1;

host sqlldr80 parfile=c:\daily_load.par

select (count(*) - &bcnt) as after_count from t1;

insert into tblMailBoxRecords
values(sysdate, '&acnt');

And you can put all these into one .sql file and schedule it.

Or other wise you can use NT script to do the count on the file and deduct 7. And insert that value into the tblMailBoxRecords.

Bala.
Re: SQL LOAD - Counting records [message #368214 is a reply to message #368199] Tue, 03 October 2000 04:21 Go to previous message
Chella
Messages: 25
Registered: September 2000
Junior Member
Hi again

Thank U. I wrote a CREATE TRIGGER/AFTER INSERT and it works fine. But your suggestion seems easier. Might give it a try. Thank U again for the help

Chella
Previous Topic: Loading multiple flat files into multiple tables
Next Topic: Help with SQL*Loader
Goto Forum:
  


Current Time: Sat Apr 20 02:18:30 CDT 2024