If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Stored Procedures

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-25-09, 17:47
Kenam Kenam is offline
Registered User
 
Join Date: Oct 2009
Posts: 2
Stored Procedures

Create a stored procedure for Students DB that will assign a Lecturer Assistant to a particular lecturer (based on its related tables). The IN parameters for the stored procedure are to be the relevant field values i.e lectureid, studentid, etc. The stored procedure will return the ID of the row inserted in the Lecturer Assistant table and should be returned via and OUT parameter.

This is what I have so far.....

CREATE PROCEDURE assistant(lecId, subjectLecId, studId INT, OUT lAssistantId INT)
BEGIN
INSERT INTO lec_assistant (lec_assistant_id, subject_lec_id, stud_id) VALUES(NULL,sujectLecId,studId);
END; //


I'm getting this 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 'subjectLecId, studId INT, OUT lAssistantId INT) INSERT INTO lec_assistant (lec_a' at line 1


Could anyone please assist in telling me if a correction needs to be made to the syntax? I'm using WAMPSERVER 2.0
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On