Jump to content

Syntax Error in Stored Procedure


elis

Recommended Posts

Here's my procedure

CREATE DEFINER=`MYSITE`@`%` PROCEDURE `xxxx`( 
IN _fname VARCHAR(30), 
IN _lname VARCHAR(30), 
IN _writeup TEXT, 
IN _resume_text TEXT, 
IN _notes TEXT, 
IN _resume_doc MEDIUMBLOB, 
IN _resume_filetype VARCHAR(30), 
IN _resume_filename VARCHAR(60), 
IN _add_doc MEDIUMBLOB, 
IN _add_filetype VARCHAR(30), 
IN _add_filename VARCHAR(60), 
IN _recruiter_id INT, 
IN _email VARCHAR(80), 
IN _phone VARCHAR(30), 
IN _address VARCHAR(200), 
IN _source_id INT, 
IN _clarity INT, 
IN _personability INT,
IN _year_began INT,
IN _i9 VARCHAR (45),
IN _i9notes TEXT,
IN _salary VARCHAR(25),
IN _company VARCHAR(45),
IN _base VARCHAR(25),
IN _bonus VARCHAR(25),
IN _year VARCHAR(4),
IN _salnotes TEXT,
IN _desiredbase VARCHAR(10),
IN _desiredbonus VARCHAR(10),
IN _desirednotes TEXT,
IN _nyc ENUM('off', 'on'),
IN _westch ENUM('off', 'on'),
IN _nj ENUM('off', 'on'),
IN _li ENUM('off', 'on'),
IN _ct ENUM('off', 'on'),
IN _allChecked ENUM('off', 'on'),
IN _relocate ENUM('0', '1', '2'),
IN _locnotes TEXT,
IN _salary2 VARCHAR(25),
IN _company2 VARCHAR(45),
IN _base2 VARCHAR(25),
IN _bonus2 VARCHAR(25),
IN _year2 VARCHAR(4),
IN _salnotes2 TEXT,
IN _salary3 VARCHAR(25),
IN _company3 VARCHAR(45),
IN _base3 VARCHAR(25),
IN _bonus3 VARCHAR(25),
IN _year3 VARCHAR(4),
IN _salnotes3 TEXT)
BEGIN
DECLARE lid INT;
INSERT INTO candidates_info (fname, lname, recruiter_id, date_created, email,
phone, address, source_id, clarity, personability, year_began, i9, i9notes) VALUES (_fname, _lname, _recruiter_id, 
NOW(), _email, _phone, _address, _source_id, _clarity, _personability, _year_began, _i9, _i9notes); 

SELECT LAST_INSERT_ID() INTO lid; INSERT INTO candidates_data (candidate_id, writeup, notes, 
resume_text) VALUES (lid, _writeup, _notes, _resume_text); 

INSERT INTO candidates_salary (candidates_id, salary, company, base, bonus, year, notes, desiredbonus, desiredbase, desirednotes) VALUES (lid, _salary, _company, _base, _bonus, _year, _salnotes, _desiredbonus, _desiredbase, _desirednotes);

INSERT INTO candidates_location (candidates_id, nyc, westch, nj, li, ct, allChecked, relocate, notes) VALUES (lid, _nyc, _westch, _nj, _li,  _ct, _allChecked, _relocate, _locnotes); 

IF _salary2 IS NOT NULL THEN
INSERT INTO candidates_salary (candidates_id, salary, company, base, bonus, year, notes) VALUES (lid, _salary2, _company2, _base2, _bonus2, _year2, _salnotes2);

IF _salary3 IS NOT NULL THEN
INSERT INTO candidates_salary (candidates_id, salary, company, base, bonus, year, notes) VALUES (lid, _salary3, _company3, _base3, _bonus3, _year3, _salnotes3);

IF _add_doc IS NOT NULL THEN
INSERT INTO candidateResumes (candidate_id, resume_doc, resume_filetype, 
resume_filename) VALUES (lid, _add_doc, _add_filetype, _add_filename);
END IF;

IF _resume_doc IS NOT NULL THEN
INSERT INTO candidateResumes (candidate_id, resume_doc, resume_filetype, 
resume_filename) VALUES (lid, _resume_doc, _resume_filetype, _resume_filename);
END IF;
SELECT lid;
END

 

And here's my 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 81

 

I've looked on line 81, and every other line and haven't spotted the problem. Perhaps a second pair of eyes could help?

Are numbers not allowed as part of variable names here? That's the only thing I've been able to think of

Link to comment
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.