All Questions
Tagged with mysql stored-procedures
6,800 questions
1
vote
2
answers
50
views
How to update top two rows of a table in stored procedure
I'm on this exercise:
Create a single routine that sums up all the points scored by players of each class, displays the result with the sum and the group name ordered from highest to lowest, and ...
0
votes
1
answer
47
views
Can a MySQL Procedure have a dubious IN type? IE. IN foo INT || VARCHAR(60)
I'm trying to write a procedure that when called will update columns in a table with provided information. The procedure will take in the column name to be updated and the value I want inserted into ...
0
votes
0
answers
64
views
MySQL Stored Procedure failing / falling to deadlock when trying to insert a manually incremented unique key field
I'm working with a MySQL Stored Procedure, which deals with data in a CSV row. There are a lot of DB operations inside the Stored Procedure, where everything is inside a transaction. One call to the ...
0
votes
1
answer
35
views
Stored Procedure for Deleting in Chunks - LOOP not executing
Problem: The loop is not executed after the first loop.
CREATE PROCEDURE IF NOT EXISTS chunk_delete(IN table_name varchar(255), IN loop_count int, IN batch_size int)
BEGIN
DECLARE counter INT ...
0
votes
0
answers
51
views
Need MySQL shorthand to match param to column specsm
I'm building the DB foundation (MySQL) of a new programming project and I'm starting to build the CRUD procedures for the core tables.
To save time in the future, in case the size of a column changes, ...
0
votes
0
answers
34
views
SQLAlchemy returns "Commands out of sync; you can't run this command now" when executing "CALL" on a simple procedure
I have a simple MySQL procedure as follows:
DELIMITER //
CREATE PROCEDURE exampleone()
BEGIN
SELECT * from project;
END //
DELIMITER ;
I am trying to execute it using MSQLAlchemy 1.4.54 using ...
0
votes
0
answers
37
views
Optimizing a MySQL Stored Procedure to get index from Custom Secondary index
Knowing the restrictions on inserting a numbered row in views and not been able return tables from functions in mySQL, I found myself having to use a stored procedure in order to get the index serial ...
1
vote
1
answer
54
views
Slow Performance on MySQL Update Query for Large Table
I am working on a MySQL procedure that performs an update on a Products table with over 25,000 records. The procedure is running(often locking) very slowly, and I need help optimizing it for better ...
0
votes
0
answers
68
views
Mysql Drop stored procedure on update
Some time ago i create a simple stored procedure:
CREATE DEFINER=`someuser`@`%` PROCEDURE `sp_foundRows`()
READS SQL DATA
SQL SECURITY INVOKER
BEGIN
SELECT FOUND_ROWS() AS count;
END
it ...
0
votes
2
answers
204
views
insert into mySQL using Delphi ADOStoredProc
I have a mySQL with the following two tables:
person keyed on ID
staff keyed on ID and StaffID (used to link managers and their staff)
The following stored procedure should insert a row into the ...
-1
votes
2
answers
88
views
I am trying to create a stored procedure to check passwords of logins
I want to create a SQL stored procedure that checks passwords at login. This should be a very common question however I could not find an answer anywhere to my specific question, which is about data ...
0
votes
1
answer
55
views
Mysql/Mariadb Cursor loop is being executed only once returning empty string and exiting
I wanted to do a partial back up of tables good and org and all tables that has foreign keys to these tables. To do that I wrote two procedures. The first one generates insert statements for the data ...
1
vote
2
answers
65
views
Deadlock during update the same table
From inside a procedure I need to separate 4k records of one big table to process it each one in a separate cursor.
UPDATE queue
SET `status` = 'enqueued',
`hash` = new_hash -- prev generated ...
0
votes
1
answer
47
views
Concat Single Quote in SQL Stored Procedure
I am working on a partition automation script and I need the string concat output as below. The prefix and suffix of the query will be framed in separate statements
PARTITION pweek38 VALUES LESS THAN (...
1
vote
1
answer
93
views
MySQL Stored Procedure slower than direct query
I have a query that runs in <1s when run directly in MySQL workbench, but is non-performant when run as a Stored Procedure or via the Event Scheduler.
Simplified Table Definition:
CREATE TABLE `...