homepage Welcome to WebmasterWorld Guest from 67.202.56.112
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe and Support WebmasterWorld
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderators: physics

Databases Forum

    
MySql - STored Procedure
Jagjit




msg:4370964
 9:39 am on Oct 5, 2011 (gmt 0)

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 20

Create PROCEDURE Sp_InsertCountry
(
pcode char(3),
pname varchar(50),
paddress1 varchar(50),
paddress2 varchar(50),
pphone1 varchar(25),
pphone2 varchar(25),
pfaxno varchar(25),
plstno varchar(50),
pcstno varchar(25),
ptanno varchar(25),
pcity varchar(25),
pstate varchar(25),
pzip int,
pstatus varchar(1)
)
BEGIN
insert into company (code,name,address1,address2,phone1,phone2,faxno,tanno,lstno,cstno,city,state,zip,status)
values (pcode,pname,paddress1,paddress2,pphone1,pphone2,pfaxno,ptanno,plstno,pcstno,pcity,pstate,pzip,pstatus);
END
GO

 

arms




msg:4371021
 12:55 pm on Oct 5, 2011 (gmt 0)

According to Mysql docs you may have to declare variable direction:

Create PROCEDURE Sp_InsertCountry
(
IN pcode char(3),
IN pname varchar(50),
IN paddress1 varchar(50),
IN paddress2 varchar(50),
IN pphone1 varchar(25),
IN pphone2 varchar(25),
IN pfaxno varchar(25),
IN plstno varchar(50),
IN pcstno varchar(25),
IN ptanno varchar(25),
IN pcity varchar(25),
IN pstate varchar(25),
IN pzip int,
IN pstatus varchar(1)
)
BEGIN
insert into company (code,name,address1,address2,phone1,phone2,faxno,tanno,lstno,cstno,city,state,zip,status)
values (pcode,pname,paddress1,paddress2,pphone1,pphone2,pfaxno,ptanno,plstno,pcstno,pcity,pstate,pzip,pstatus);
END
GO

other than that do the variables def match the columns def in the table?, that's the only other thing I can think of

topr8




msg:4371045
 2:13 pm on Oct 5, 2011 (gmt 0)

I use stored procedures in mySQL all the time and haven't used IN before.

where are you getting the error message? from a php page?

it seems to me there is nothing wrong with the stored procedure itself, if you are using mySQl workbench you don't need to include GO

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved