mysql sql statement running in ANT
- From: "Ray in HK" <ray@xxxxxxxxx>
- Date: Mon, 4 Jul 2005 19:15:08 +0800
I have a script in ANT to load data from a data file and then update a tmp
table.
My problem is that when I run the following sql under mysql client, it works
perfectly. However, when ever I run it in ANT, nothing can be insert into
the temp table.
I have tried to test the result that the data has already been loaded. The
record can be selected from the newly loaded table( DAILY ) but there will
be zero records inserted into the temp table ( the last sql ) . I cannot
figure out the reason for this strange behaviour. Can anyone explain this
to me ?
<target name="loadData" depends="clearData">
<echo message="LOAD DATA USING: ${db.driver} ${db.url}"/>
<sql driver="${db.driver}"
url="${db.url}"
userid="${db.user}"
password="${db.pw}"
autocommit="true"
onerror="continue"
print="true">
<classpath refid="master-classpath"/>
LOAD DATA LOCAL INFILE '${data.dir}/2.csv'
INTO TABLE DAILY
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(HSI_D_DATE, D_OPEN, D_HIGH, D_LOW, D_CLOSE, D_VOLUMN);
update DAILY
SET D_SETTLE_DATE=DATE_FORMAT(D_DATE, '%Y-%m-01');
### create temp table ###
DROP TEMPORARY TABLE IF EXISTS tmp_last_month_day;
CREATE TEMPORARY TABLE tmp_last_month_day (
settle_date date
);
### insert last month day into temp table ###
INSERT INTO tmp_last_month_day(
settle_date
)
select max(D_DATE)
from DAILY
GROUP BY D_SETTLE_DATE;
##########################################################
.
- Prev by Date: Re: JDBC Question: Getting data from tables with columns that have the same name
- Next by Date: in-memory database for polling
- Previous by thread: Re: JDBC Question: Getting data from tables with columns that have the same name
- Next by thread: in-memory database for polling
- Index(es):
Relevant Pages
|
|