MySQL Forums
Forum List  »  Stored Procedures

Re: Stored Procedure to create table
Posted by: Peter Brawley
Date: July 15, 2022 08:34PM

> move the data using SELECT INTO OUTFILE, then LOAD INFILE into a
> intermediate table, then insert from there into the new tables?

I'd assumed your data was coming from spreadsheets, in which case Load Data Infile from .csv files offers best bulk insert performance.

> By table glut, it sounds like you're not a fan of
> storing large amounts of machine data, correct?

Incorrect. Creating a glut of identically structured tables is not usually sound or efficient design.

> I was unclear as to why sometimes the
> DECLARE statement is used without the @ symbol.

DECLARE is never used with @ variables ie user variables.

Read the excellent manual regarding declared variables, starting with https://dev.mysql.com/doc/refman/8.0/en/declare.html. Declaring variables is supported only in stored routines.

User variables work differently and occupy a different namespace. They may be used in stored routines and in ordinary sql. Start reading about them at https://dev.mysql.com/doc/refman/8.0/en/user-variables.html.

PREPARE needs a user var.



Edited 1 time(s). Last edit at 07/15/2022 08:49PM by Peter Brawley.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Stored Procedure to create table
49
July 15, 2022 08:34PM


Sorry, only registered users may post in this forum.

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.