Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL Error: Query was empty (1065) on simple INSERT statement

I am trying to run a large script that creates a table, and then inserts almost 15,000 rows into it. The table gets created just fine, and then at the 833 INSERT, I get an error:

Error: Query was empty (1065)

Here is my 833rd INSERT statement (the one that is failing):

INSERT INTO CLASSCODE (CLASS_CODE, CLASS_CODE_NAME, RATE_GROUP, PROGRAM_NM, ST_CODE, EFF_DT, EXP_DT) VALUES (10255, "Funeral Directors - incl PL other than Crematory  - 10255", 3, "Service", "AZ", 19980801, NULL);

I can't see any syntax errors or differences between this line, and one that works. FOr reference, here is an example of an INSERT statement that works just fine:

INSERT INTO CLASSCODE (CLASS_CODE, CLASS_CODE_NAME, RATE_GROUP, PROGRAM_NM, ST_CODE, EFF_DT, EXP_DT) VALUES (10425, "Frame Shop - Picture/Posters                      - 10425", 2, "Retail", "AZ", 19980801, NULL);

The part that puzzles me is that the error sounds like something that would happen if I was populating the new row using data from another SELECT statement, which was coming up empty. That is not the case, though, as my INSERT statements are all using static data.

My table definition looks like this:

CREATE TABLE CLASSCODE (
      CLASS_CODE INTEGER NOT NULL, 
      CLASS_CODE_NAME VARCHAR(60) NOT NULL, 
      RATE_GROUP SMALLINT NOT NULL, 
      PROGRAM_NM VARCHAR(20) NOT NULL, 
      ST_CODE CHAR(2), 
      EFF_DT DATE, 
      EXP_DT DATE) 

I am running this script in the GUI MySQL Query Browser.

Could it be something to do with the number of rows I'm trying to insert? Do I need to periodically commit? Is there something simple that I am just overlooking?

Thanks!

like image 467
pkaeding Avatar asked Dec 06 '25 17:12

pkaeding


1 Answers

The most common scenario to run into these in a script file is when you have a double semi-colon somewhere:

INSERT INTO CLASSCODE 
(CLASS_CODE, CLASS_CODE_NAME, RATE_GROUP, PROGRAM_NM, ST_CODE, EFF_DT, EXP_DT)
VALUES
(10255, "Funeral Directors - incl PL other than Crematory  - 10255", 3, "Service", "AZ", 19980801, NULL)
;;

I'd do a quick search through the script and see if there's a ;; in there around line 833.

like image 115
zombat Avatar answered Dec 08 '25 07:12

zombat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!