RE: Dynamically creating procedures

"Giedt, Matt" <[email protected]> Fri, 8 Feb 2008 16:30:17 -0500
Newsgroups gmane.comp.db.mysql.java
Message-ID <17C8BF87FD5238498A83034200664FB44E0B3E@MSGMROCLN2WIN.DMN1.FMR.COM>
Thanks Paul. 

Good tip on executing the drop command outside of the 'delimiter +
create'. You have to do this w/ SQL Server as well -- I should have
caught that. (As opposed to Oracle which lets you do 'create or
replace')

I can't, however, get past the DELIMITER statement.

      stmt.execute( "DELIMITER |" ); // <-- blows up here
      stmt.execute( "CREATE PROCEDURE FOO() BEGIN SELECT 1 AS FOO; END|"
);
      stmt.execute( "DELIMITER ;" );

OR:

      stmt.executeUpdate( "DELIMITER |" ); // <-- blows up here
      stmt.execute( "CREATE PROCEDURE FOO() BEGIN SELECT 1 AS FOO; END|"
);
      stmt.executeUpdate( "DELIMITER ;" );

OR:

      stmt.addBatch( "DELIMITER |" );
      stmt.addBatch( "CREATE PROCEDURE FOO() BEGIN SELECT 1 AS FOO;
END|" );
      stmt.addBatch( "DELIMITER ;" );
      stmt.executeBatch(); // <-- blows up here

Hopefully I'll be able to limit my code paths to a single semi-colon!

With thanks,
-Matt

-- 
MySQL Java Mailing List
For list archives: http://lists.mysql.com/java
To unsubscribe:    http://lists.mysql.com/[email protected]