Home » RDBMS Server » Server Utilities » load data - load the latest column for given dates...
load data - load the latest column for given dates... [message #71976] Wed, 12 February 2003 11:21 Go to next message
Sabrina
Messages: 76
Registered: February 2002
Member
Hi,

my table looks like,
SQL> desc proc_codes_hist;
Name Null? Type
------------------------------- -------- ----
PROC_CD VARCHAR2(5)
BASIC_UNIT_TO_DATE1 VARCHAR2(6)

My control file looks like,

load data infile 'EDS1997.TXT'
into table PROC_CODES_HIST append
(
PROC_CD POSITION(1-5),
BASIC_UNIT_FROM_DATE1 POSITION(6-11)
)

Right now, there are multiple PROC_CD's for multiple BASIC_UNIT_FROM_DATE1 dates.

What i want to do is,
While loading data, i only want to load the PROC_CD for the most current BASIC_UNIT_FROM_DATE1 date. How do i do it?

Where do i write my logic?

Any suggestions will be very appreciated.

Thank you!
Re: load data - load the latest column for given dates... [message #71980 is a reply to message #71976] Thu, 13 February 2003 01:06 Go to previous message
Barbara Boehmer
Messages: 9094
Registered: November 2002
Location: California, USA
Senior Member
I don't think SQL*Loader can do what you want. I believe you have to load all of the data, then delete all but the most current, after loading:

DELETE FROM proc_codes_hist
WHERE  (proc_cd, basic_unit_from_date1)
NOT IN (SELECT   proc_cd, MAX (basic_unit_from_date1)
        FROM     proc_codes_hist
        GROUP BY proc_cd);
Previous Topic: sql-loader
Next Topic: how to start dbverf80?
Goto Forum:
  


Current Time: Wed May 15 11:38:48 CDT 2024