MySQL Forums
Forum List  »  Italian

Stored procedure - variabile per creazione tabella
Posted by: Diego Radica
Date: November 10, 2018 01:54PM

Salve a tutti
sto creando una SP che mi crea una tabella ogni mese con il nome del mese

BEGIN
DECLARE varTable varchar(15);
SET @varTable = MONTHNAME(NOW());


CREATE TABLE varTable (
`TimeLog` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`Zona` varchar(22) NOT NULL,
`Sensore` varchar(20) NOT NULL,
`T` float NOT NULL,
`U` float NOT NULL,
KEY `TimeLog` (`TimeLog`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

END

Per come sono riuscito a scriverla, la variabile VarTable non viene valorizzata con il nome del mese. Ho provato con @ ma nulla

Grazie a tutti

Options: ReplyQuote


Subject
Views
Written By
Posted
Stored procedure - variabile per creazione tabella
1024
November 10, 2018 01:54PM


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.