MySQL Forums
Forum List  »  Stored Procedures

Create Procedure with Insert
Posted by: Michael Brown
Date: February 24, 2015 12:24PM

Alright I have this procedure that I am creating and it's giving me problems. I can't seem to find the problem as it look sas if I am doing everything correctly. Please help.

ERROR: Missing EndOfFile at 'DECLARE'

DELIMITER $$

CREATE PROCEDURE NewListing
(
IN pCatID int,
IN pTitle varchar(50),
IN pDescription text,
IN pListingLength int
)

BEGIN

DECLARE vStart datetime;
DECLARE vEnd datetime;

SET vStart = UTC_TIMESTAMP();
SET vEnd = DATE_ADD(vStart, INTERVAL pListingLength DAY);

INSERT INTO Listings
(
CatID,
Title,
Description,
StartDateTime,
EndDateTime
)
VALUES
(
pCatID,
pTitle,
pDescription,
vStart,
vEnd
);

END $$
DELIMITER;

Options: ReplyQuote


Subject
Views
Written By
Posted
Create Procedure with Insert
2899
February 24, 2015 12:24PM
984
February 24, 2015 02:19PM
1037
February 25, 2015 08:24AM
972
February 25, 2015 11:54AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.