Error in sql syntax - #1064

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gomzi
    Contributor
    • Mar 2007
    • 304

    Error in sql syntax - #1064

    DELIMITER $$

    DROP PROCEDURE IF EXISTS `tableselect` $$
    CREATE PROCEDURE `tableselect`()
    BEGIN
    select * from table_a;
    END $$

    DELIMITER ;

    when i try to create a procedure by using the code specified above, i get this error.

    #1064 - 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 $$

    DROP PROCEDURE IF EXISTS `tableselect` $$
    CREATE PROCEDURE `' at line 1

    i use mysql 5.0

    any help would be appreciated.

    thanks,
    gomzi.
  • ScarletPimpernal
    New Member
    • Mar 2007
    • 39

    #2
    Hi Gomzi,

    Try this

    mysql> DELIMITER $$
    mysql> DROP PROCEDURE IF EXISTS `tableselect` $$ CREATE PROCEDURE `tableselect`()
    Query OK, 0 rows affected, 1 warning (0.00 sec)

    -> BEGIN
    -> select * from table_a;
    -> END;
    -> $$
    Query OK, 0 rows affected (0.00 sec)


    Thanks,
    Scarlet

    Comment

    • masdi2t
      New Member
      • Jul 2006
      • 37

      #3
      Originally posted by gomzi
      DELIMITER $$

      DROP PROCEDURE IF EXISTS `tableselect` $$
      CREATE PROCEDURE `tableselect`()
      BEGIN
      select * from table_a;
      END $$

      DELIMITER ;

      when i try to create a procedure by using the code specified above, i get this error.

      #1064 - 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 $$

      DROP PROCEDURE IF EXISTS `tableselect` $$
      CREATE PROCEDURE `' at line 1

      i use mysql 5.0

      any help would be appreciated.

      thanks,
      gomzi.

      try cache your delimiter character with ;;

      DELIMITER ;;

      DROP PROCEDURE IF EXISTS `tableselect` ;
      CREATE PROCEDURE `tableselect`()
      ....

      DEMIMITER ;

      Comment

      • masdi2t
        New Member
        • Jul 2006
        • 37

        #4
        Originally posted by masdi2t
        try cache your delimiter character with ;;

        DELIMITER ;;

        DROP PROCEDURE IF EXISTS `tableselect` ;
        CREATE PROCEDURE `tableselect`()
        ....

        DEMIMITER ;
        thus should change

        Comment

        Working...