Probably mysql prob - but mybe someone knows what is the prob

BubikolRamios's profile image BubikolRamios posted 8 years ago in General Permalink

if I replace f with foof it says foof_ does not exists

BubikolRamios's profile image BubikolRamios posted 8 years ago Permalink

[Window Title] ISG: Error

So, If I take any procedure create code and copy/paste (win 7) it to query window, that should execute, right ? And any of those , running it from query window says:

SQL 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 '' at line 10

example:

CREATE DEFINER=`root`@`localhost` PROCEDURE `pool_get_question`(OUT `i_result` INT, IN `c_l2` VARCHAR(2)
                                             )
    LANGUAGE SQL
    NOT DETERMINISTIC
    CONTAINS SQL
    SQL SECURITY DEFINER
    COMMENT ''
BEGIN

  DECLARE i INT DEFAULT 0;
  DECLARE EXIT HANDLER FOR SQLEXCEPTION set i_result = -1;



  SELECT count(*) into i
  FROM pool_zbirkaanketglave g,pool_zbirkaanketglave_l2 g_l2
  where g.anketa_id = g_l2.anketa_id
  and g.anketa_aktivnost = 1
  and g_l2.l2 = c_l2;

  IF i = 0 THEN



    SELECT g_l2.anketa_question, p.anketa_answer,g.anketa_id,p.anketa_answer_id
    FROM pool_zbirka_anket_postavke p LEFT JOIN  pool_zbirkaanketglave as g ON(g.anketa_id = p.anketa_id)
                                LEFT JOIN  pool_zbirkaanketglave_l2 as g_l2 ON(g_l2.anketa_id = p.anketa_id)
    where g.anketa_aktivnost = 1
    and g_l2.l2 = 'sl'
    and p.l2 = 'sl';

  ELSE

    SELECT g_l2.anketa_question, p.anketa_answer,g.anketa_id,p.anketa_answer_id
    FROM pool_zbirka_anket_postavke p LEFT JOIN  pool_zbirkaanketglave as g ON(g.anketa_id = p.anketa_id)
                                LEFT JOIN  pool_zbirkaanketglave_l2 as g_l2 ON(g_l2.anketa_id = p.anketa_id)
    where g.anketa_aktivnost = 1
    and g_l2.l2 = c_l2
    and p.l2 = c_l2;


  END IF;


  set i_result = 0;




END
ansgar's profile image ansgar posted 8 years ago Permalink

So, If I take any procedure create code and copy/paste (win 7) it to query window, that should execute, right ?

No. HeidiSQL internally sets a different delimiter before firing the actual create code for a new procedure, as the procedure body can contain semicolons:

DELIMITER //
CREATE PROCEDURE xyz ...
BEGIN
  DECLARE i INT DEFAULT 0;
  ...
END

You cannot also run compound statements like DECLARE xyz as a standalone query.

BubikolRamios's profile image BubikolRamios posted 8 years ago Permalink
body can contain semicolons

Yeah, right.

About original problem: It can say 'function does not exists' or 'procedure does not exists' which looks realy strange if you are calling proc and it reports func problem.

In that case the call to missing func/proc is inside proc/func.

Please login to leave a reply, or register at first.