 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Ray in HK Guest
|
Posted: Mon Jul 04, 2005 11:15 am Post subject: mysql sql statement running in ANT |
|
|
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;
##########################################################
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|