MySQL Forums
Forum List  »  General

Re: How to make small tables from big table? (SELECT INTO doesn't seem to work)
Posted by: Peter Brawley
Date: April 14, 2018 09:12AM

> I get the error message: "Error Code 1327 Undefined variable new_table"

As you should. The variable has not been declared. Note such vars can be declared only in stored routines; you would need to use a user var, eg @new_table. See the manual for discussion of the differences between user vars and declared vars.

Notice the diffs amongst SELECT INTO..., SELECT INTO DUMPFILE..., SELECT INTO OUTFILE..., and SELECT INTO TABLE.... MySQL supports the first three of those (https://dev.mysql.com/doc/refman/5.7/en/select-into.html), not the last one; to select into a table use Create Table Select ...

Options: ReplyQuote




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.