mysql stored procedure syntax inconsistency -


i have stored procedure syntactically acceptable on local pc, have mysql workbench 5.2.44 , think local version of mysql 5.5.29 judging folder names. here code, have reduced minimum illustration

delimiter $$  create procedure `usp_insert_booking_test_2`(         in  p_dtmtimeslot datetime        )  begin        insert tblbookings (dtmtimeslot)      select p_dtmtimeslot      tblbookings      not exists (select * tblbookings dtmtimeslot = p_dtmtimeslot) limit 1;  end$$ 

as can see, trying ensure not create 2 bookings in same time slot. yes, have constraint on table also. belt & braces. when try add procedure on remote host (running mysql version 5.1.68-cll), says

#1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near '' @ line 12

line 12 not exists line. have tried removing limit 1, makes no difference. there way write query mysql 5.1 accept it?

i needed add

delimiter ;

to end of code shown. no idea why.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -