SQL LOAD - Counting records [message #368199] |
Thu, 28 September 2000 09:20 |
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 |
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.
|
|
|
|