All Questions
Tagged with stored-procedures sql
12,426 questions
2
votes
1
answer
36
views
Liquibase templating stored procedure ChangeSets via <include> and <property>
I have N tables for which I need to generate 5 stored procedures each.
All the stored procedures follow the same pattern, except for the table name in the referencing clause.
Would it be possible to ...
0
votes
3
answers
115
views
Getting duplicate rows when using temp table and inner joins
I have a temp table and inserts the search term inside the temp table that has a search term of split spaces, but when I query the SQL the rows are duplicated because of how many rows are in the temp ...
1
vote
1
answer
85
views
Comparing a search term that contains more than one word and searches different variations for the search term and pulls out records
If I have a search term that equals "Hello Connor Mcgregor", then how would I use this search term so that the search term loops each search word in the list for example:
searchTerm[0] = &...
-1
votes
1
answer
40
views
Pull out Descriptions as Variables
I have a table that has fields for table name, field name, and descriptions of those fields.
I want to assign the descriptions for fields of a specific table to variables for use in a stored procedure....
0
votes
1
answer
102
views
Stored procedure returns null instead all column names with one empty record in json_string output using JSON AUTO
I have a stored procedure where I get some column names from the table and take remaining column names dynamically. I get column names with no records if I don't convert it to JSON string but if I ...
0
votes
2
answers
46
views
In AWS Redshift, are there errors that can cause a stored procedure to stop, even when having a error handling block?
I wrote a stored procedure that calls other procedures inside multiple transaction blocks (BEGIN…END) with their own error handlers. I expected that if one block encounters an exception, it would go ...
0
votes
1
answer
52
views
Handle nullable parameters and dynamic WHERE clause in stored procedure [duplicate]
I have a SQL Server stored procedure with several parameters that I'm using to build a dynamic WHERE clause. This stored procedure works fine, but the performance is terrible when certain parameters ...
0
votes
0
answers
69
views
Query taking too long to fetch results
When I try running the stored procedure with only this query:
SELECT TAB1.COL6
FROM TAB1
INNER JOIN TAB2 ON TAB1.COL1 = TAB2.COL1
WHERE TAB1.COL2 = 10;
It takes 5 seconds to get the resultset and if ...
0
votes
2
answers
88
views
How to loop through a SNOWFLAKE cursor and declare a string (cell value with delimiter) to a variable and pass inside where clause IN statement
I am trying to run a stored procedure which loops through a cursor gets the cell values into variables which I then pass it inside the where clause to filter. One of the cell contains a string with ...
0
votes
1
answer
64
views
SQL update column based on another table details
Source table:
customer
category
sales
date
order status
allen
in
200
04-03-2025
Completed
currie
out
300
04-03-2025
WIP
frank
out
400
04-03-2025
WIP
alice
in
500
04-03-2025
WIP
allen
out
400
04-03-...
0
votes
1
answer
57
views
PL/SQL JSON_OBJECT_T error Code: -40573 - ORA-40573: Invalid use of PL/SQL JSON object type
I'm trying to build one PL/SQL stored procedure to insert update delete data into the table using below procedure but it is failing with the error Error Code:
-40573 - ORA-40573: Invalid use of PL/...
-1
votes
2
answers
232
views
Create a SQL Server stored procedure that can run against multiple databases
I have a SQL Server instance that contains many databases. These databases all have the same table structure. I'm creating a C# app to connect to this server and then run stored procedures.
I created ...
0
votes
2
answers
155
views
Syntax error: unexpected '='. when writing a Snowflake stored procedure
I am new to writing stored procedures in Snowflake. When I write the code for my stored procedure, I get an error
Syntax error: unexpected '='. (line 12)
This is my code:
CREATE OR REPLACE PROCEDURE ...
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 ...
3
votes
2
answers
103
views
Why is DELETE FROM vehicle_data WHERE NOW() > expires_at; failing in my stored function?
I have prepared a DB Fiddle for my question and I will also show my complete code below -
I am trying to store data in a vehicle_data table and each data record has an expires_at column:
-- Create ...