0
I created this procedure
to test whether a field exists in a database, if it does not exist, the procedure
would create.
DELIMITER ||
CREATE PROCEDURE sp_verificarLinhas(IN colunas VARCHAR(50)) BEGIN
IF NOT EXISTS (SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = Database() AND TABLE_NAME='prt_license' AND COLUMN_NAME
= colunas ) THEN SET @s = CONCAT('ALTER TABLE eco_portaldb.prt_license ADD COLUMN ', colunas ,' VARCHAR(100) NULL DEFAULT NULL AFTER date_update'); PREPARE stmt FROM @s; EXECUTE stmt;
end if; END ||
DELIMITER ;
When he finds some field that doesn’t exist, he gives me the following mistake:
Syntax error or access Violation: 1142 ALTER command denied to user 'eco_portaluserh@'186.206.156.42' for table 'prt_license'
After removing it and trying to recreate it, he started to give me that mistake:
SQLSTATE[HY000]: General error: 1267 Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for Operation '='
this piece has already been fixed transforming the database into general
The database, the table are like UTF8
. I’ve tried to:
alter table `prt_license` convert to character set utf8 collate utf8_general_ci
Error Code: 1044. Access denied for user 'eco_portaluserh@'%' to database 'eco_portaldb_homolog' Running the command gave me the following error
– gabrielfalieri
The user you are using to run the command is not allowed! You have to log in and execute the above command with a user who has the privilege to do so.
– Rafael Salomão
Dude, are you sure the Procedure problem is permission? there is no sql error no?
– gabrielfalieri