Hi All,

       I am Writing automated Build script for running DBScript using ant .I
am Using ant apache-ant-1.7.1 and  MYSQL5.1 .I  wrote a target for running
the Triggers on the tables like this

    <target name="db-Insert" depends="db-init-dmp">
        <echo message=" Creating the tables for DMP it will fail if the
table already exist" />
        <sql driver="${db.driver}"
             url="${db.url}"
             userid="${db.username}"
             password="${db.password}" >
        
                <transaction src="XXX.sql" />
        </sql>
    </target> 

XXX.sql is the Script for creating the  Triggers

My sql Triggers looks like this


 DELIMITER |

  CREATE TRIGGER inserttree AFTER INSERT ON XXXXX

  FOR EACH ROW
  BEGIN

   DECLARE s INTEGER;
    DECLARE t INTEGER;
       DECLARE ParentPath varchar(30);

   SET s=NEW.REPORTS_TO;
   SET t = NEW.ID;

  if s is NULL then
 insert into hierarchy_path values (t,t);
    else
     select PATH INTO  ParentPath from hierarchy_path where ID = s;
  insert into hierarchy_path values (t,CONCAT(ParentPath,',',t));

    end if;
    END;
 |
    DELIMITER

when ant executing this code its giving error at line 1 like 

com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in
your SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near '; | DELIMITER' at line 1

Can any body Pls help me

-- 
View this message in context: 
http://old.nabble.com/Problem-when-Executing-ant-Target-for-running-Triggers-on-MYSQL5.1-Tables-tp26690964p26690964.html
Sent from the Ant - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

Reply via email to