I am preparing a stored procedure. I have all the lines commented out. I cannot save. Why not?
All comments -> Why an error?
BEGIN
-- IF EXISTS(SELECT 1 FROM chessback WHERE column = value...) THEN
-- UPDATE table
-- SET column = value ...
-- WHERE other_column = other_value ...;
-- ELSE
-- INSERT INTO table
-- (column1, column2, ...)
-- VALUES
-- (value1, value2, ...);
-- END IF;
END
-- DELIMITER
=====================================
/* Delimiter changed to ; */
/* Connecting to sql63.your-server.de via MariaDB or MySQL (TCP/IP), username w6wehfc9, using password: Yes ... */
SELECT CONNECTION_ID();
SHOW VARIABLES;
/* Characterset: utf8mb4 */
SHOW /*!50002 GLOBAL */ STATUS;
SELECT NOW();
/* Connected. Thread-ID: 28039645 */
/* Reading function definitions from C:\Program Files\HeidiSQL\functions-mariadb.ini */
SHOW TABLES FROM `information_schema`;
SHOW DATABASES;
SHOW OPEN TABLES FROM w6wehfc9_baseB WHERE `in_use`!=0;
USE `w6wehfc9_baseB`;
/* Entering session "LinguaShop" */
SELECT `DEFAULT_COLLATION_NAME` FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME`='w6wehfc9_baseB';
SHOW TABLE STATUS FROM `w6wehfc9_baseB`;
SHOW FUNCTION STATUS WHERE `Db`='w6wehfc9_baseB';
SHOW PROCEDURE STATUS WHERE `Db`='w6wehfc9_baseB';
SHOW TRIGGERS FROM `w6wehfc9_baseB`;
SELECT *, EVENT_SCHEMA AS `Db`, EVENT_NAME AS `Name` FROM information_schema.`EVENTS` WHERE `EVENT_SCHEMA`='w6wehfc9_baseB';
/* Loading file "C:\Users\Lenovo\AppData\Roaming\HeidiSQL\Backups\query-tab-2024-06-02_16-45-32-539.sql" (317 B) into query tab #1 */
/* Loading file "C:\Users\Lenovo\AppData\Roaming\HeidiSQL\Backups\query-tab-2024-10-23_19-49-11-173.sql" (128 B) into query tab #2 */
/* Loading file "C:\Users\Lenovo\AppData\Roaming\HeidiSQL\Backups\query-tab-2024-12-19_21-34-38-139.sql" (173 B) into query tab #3 */
/* Loading file "C:\Users\Lenovo\AppData\Roaming\HeidiSQL\Backups\query-tab-2025-01-08_18-35-13-998.sql" (426 B) into query tab #4 */
/* Loading file "C:\Users\Lenovo\AppData\Roaming\HeidiSQL\Backups\query-tab-2025-01-12_18-36-25-011.sql" (241 B) into query tab #5 */
/* Scaling controls to screen DPI: 100% */
SELECT * FROM `information_schema`.`COLUMNS` WHERE TABLE_SCHEMA='w6wehfc9_baseB' AND TABLE_NAME='chesserrors' ORDER BY ORDINAL_POSITION;
SHOW INDEXES FROM `chesserrors` FROM `w6wehfc9_baseB`;
SELECT * FROM information_schema.REFERENTIAL_CONSTRAINTS WHERE CONSTRAINT_SCHEMA='w6wehfc9_baseB' AND TABLE_NAME='chesserrors' AND REFERENCED_TABLE_NAME IS NOT NULL;
SELECT * FROM information_schema.KEY_COLUMN_USAGE WHERE TABLE_SCHEMA='w6wehfc9_baseB' AND TABLE_NAME='chesserrors' AND REFERENCED_TABLE_NAME IS NOT NULL;
SHOW COLLATION;
SHOW ENGINES;
SHOW CREATE TABLE `w6wehfc9_baseB`.`chesserrors`;
SELECT CONSTRAINT_NAME, CHECK_CLAUSE FROM `information_schema`.`CHECK_CONSTRAINTS` WHERE CONSTRAINT_SCHEMA='w6wehfc9_baseB' AND TABLE_NAME='chesserrors';
SELECT `DEFAULT_COLLATION_NAME` FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME`='information_schema';
SHOW TABLE STATUS FROM `information_schema`;
SHOW FUNCTION STATUS WHERE `Db`='information_schema';
SHOW PROCEDURE STATUS WHERE `Db`='information_schema';
SHOW TRIGGERS FROM `information_schema`;
SELECT *, EVENT_SCHEMA AS `Db`, EVENT_NAME AS `Name` FROM information_schema.`EVENTS` WHERE `EVENT_SCHEMA`='information_schema';
SELECT * FROM `information_schema`.`COLUMNS` WHERE TABLE_SCHEMA='w6wehfc9_baseB' AND TABLE_NAME='chessbackup' ORDER BY ORDINAL_POSITION;
SHOW INDEXES FROM `chessbackup` FROM `w6wehfc9_baseB`;
SELECT * FROM information_schema.REFERENTIAL_CONSTRAINTS WHERE CONSTRAINT_SCHEMA='w6wehfc9_baseB' AND TABLE_NAME='chessbackup' AND REFERENCED_TABLE_NAME IS NOT NULL;
SELECT * FROM information_schema.KEY_COLUMN_USAGE WHERE TABLE_SCHEMA='w6wehfc9_baseB' AND TABLE_NAME='chessbackup' AND REFERENCED_TABLE_NAME IS NOT NULL;
SHOW CREATE TABLE `w6wehfc9_baseB`.`chessbackup`;
SELECT CONSTRAINT_NAME, CHECK_CLAUSE FROM `information_schema`.`CHECK_CONSTRAINTS` WHERE CONSTRAINT_SCHEMA='w6wehfc9_baseB' AND TABLE_NAME='chessbackup';
SELECT CURRENT_USER();
CREATE PROCEDURE `UpdateOrInsert`()
LANGUAGE SQL
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
END;
/* SQL Error (1304): PROCEDURE UpdateOrInsert already exists */
SELECT CURRENT_USER();
SHOW CREATE PROCEDURE `w6wehfc9_baseB`.`UpdateOrInsert`;
Please login to leave a reply, or register at first.