elis Posted May 22, 2009 Share Posted May 22, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/159308-syntax-error-in-stored-procedure/ Share on other sites More sharing options...
fenway Posted June 1, 2009 Share Posted June 1, 2009 You need to narrow that down... comment out most of the procedure, make sure the definition itself works first. Quote Link to comment https://forums.phpfreaks.com/topic/159308-syntax-error-in-stored-procedure/#findComment-846828 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.