1

Possible Duplicate:
How to write a stored procedure using phpmyadmin and how to use it through php?

I am starting with stored procedures and tried a simple, on every page used query, but get an error i can't solve.

CREATE PROCEDURE ts_open_uitdagingen()
BEGIN
SELECT
            COUNT(*) AS open_uitdagingen
        FROM
            ts_lad_uitdagingen
        WHERE 
            uitgedaagde = '97'
            AND acceptdatum IS NULL
            AND afwijsdatum IS NULL ;

END;

Errormessage:

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

what is wrong with line 10? with or without de semicolon, i get this message?? The query itself is just copied from my script and works well.

Community
  • 1
  • 1
Terradon
  • 883
  • 2
  • 13
  • 33
  • 1
    You need to set an alternate `DELIMITER`. Whether you do this on the MySQL command line or another client differs in procedure. – Michael Berkowski Oct 15 '12 at 14:27
  • Thanks, i was convinced i only needed that for commandline not for phpmyadmin! But i can't accept your anser, because you have submitted it as comment? please do submit as an answer, so i can give you the credits for the right answer. Thanks again! – Terradon Oct 15 '12 at 14:31
  • It isn't a duplicate, according that topic (which isn't mine) it isn't possible to handle SP via PMA, but i can create and drop SP via PMA:) – Terradon Oct 15 '12 at 15:06
  • _Duplicate_ indicates a question that covers the same ground and has a sufficient answer - the first answer addresses setting a delimiter in PMA. – Michael Berkowski Oct 15 '12 at 15:09

1 Answers1

0

try getting rid of those trailing semi-colons?

some other formattnig things i'd try:

CREATE PROCEDURE ts_open_uitdagingen
AS
BEGIN 

   SELECT 
        COUNT(*) AS open_uitdagingen 
    FROM 
        ts_lad_uitdagingen 
    WHERE  
        uitgedaagde = '97' 
        AND acceptdatum IS NULL 
        AND afwijsdatum IS NULL      
END
Losbear
  • 3,255
  • 1
  • 32
  • 28