37,175 questions
0
votes
1
answer
44
views
Passing Parameters to a User Defined Function from within a Snowflake Stored Procedure
I have an interesting issue with passing parameters to a udf from within a stored procedure. I can pass one parameter and send a valid string value for the second parameter, and it works fine. See ...
1
vote
0
answers
42
views
LinqToSql float stored procedure param generates string that is too long for double value of 0.820035
I have this stored procedure:
CREATE PROCEDURE [dbo].TestInsert @doubleVal float
AS
BEGIN
INSERT INTO Test (Dubs)
VALUES (@doubleVal);
END
which inserts a SQL float into this table:
CREATE ...
0
votes
0
answers
42
views
Find SQL Server stored procedures that have optional parameters [duplicate]
I am trying to run a query in T-SQL to identify stored procedures that are defined with optional ("defaulted") parameters. I had expected this to be a common thing for people to try and find ...
0
votes
2
answers
96
views
Stored procedure result truncates at 2033 characters [duplicate]
I am calling a SQL Server stored procedure from C#. It works fine as long as the result is not longer than 2033 characters. If it is longer than 2033 characters, the result is truncated at 2033 ...
1
vote
1
answer
60
views
Call to an overloaded procedure inside another procedure in an Oracle/PLSQL package
I have a question about this package:
create or replace PACKAGE BODY emp_pkg IS
FUNCTION valid_deptid(p_deptid IN departments.department_id%TYPE)
RETURN BOOLEAN IS
v_dummy PLS_INTEGER;
...
Advice
0
votes
3
replies
70
views
Procedure to show percentage of nulls in TERADATA SQL ASSISTANT
I'm working in Teradata SQL Assistant and I need to create a stored procedure that, given a table name, returns the percentage of NULL values for each column in that table.
Right now, I generate the ...
-3
votes
0
answers
62
views
Php and mssql. Extracting data from an MSSQL stored procedure to PHP [duplicate]
I have a stored procedure and know its input parameters. How can I extract this data from this stored procedure in PHP?
I have a query that allows me to display this data in the MSSQL database itself. ...
1
vote
1
answer
60
views
Redshift : Opening multiple cursors from within the same client connection is not allowed
I have the following procedure written in redshift, which uses 2 for loops to get country code first and then years as per the country codes.
--Procedure : sp_for_loop_test
create or replace procedure ...
0
votes
0
answers
64
views
Redshift - SQL Error: Internal jdbc driver error
I am trying to use for loop within the stored procedure to retrieve the employee id and process further but getting an error:
Error: SQL Error: Internal jdbc driver error
Procedure:
create or replace ...
0
votes
0
answers
60
views
How do I / example of adding source info in IBM MQ Header (possible MQRFH2/usr) from DB2 stored procedure
We have a stored procedure in DB2 written in an external sproc (possibly some mainframe language, possibly C++) that creates an XML structure and puts it on a queue.
I know we can add a correlation id,...
0
votes
1
answer
199
views
Does source length of SQL functions matter
First, to define what I'm talking about, the "length" of a source is how many characters it has. Having more characters allows improving readability by using more descriptive function and ...
0
votes
2
answers
82
views
ASP.NET Core Web API + EF: how to convert the list of entities to queryable?
I need to rewrite the code for getting and filtering the list of products. The older version used directly the SQL table Products, and filtered the result by code or name of a product, category, etc, ...
2
votes
1
answer
80
views
User context and permissions when writing files from inside a plsh function in PostgreSQL on Ubuntu
I have a database on a Ubuntu system, that belongs to the postgresql user kalle (the owner of the database and the tables).
That user is also the owner of the trigger function getimage, written in the ...
1
vote
0
answers
97
views
Postgres stored procedure doesn't return if running longer than 5 minutes
I have the following simple Postgres stored procedure created that just sleeps a number of minutes as passed in to call:
create procedure sleep_test(delay_minutes numeric)
language plpgsql
as
$$
...
0
votes
1
answer
55
views
DB2/LUW How to Perform Cross-database Query Comparison without Federation?
I did some reading and then confirmed with our DBA's that our databases are not federated. So, I figured I could write a stored procedure to connect to the first database and store the query output ...
1
vote
1
answer
95
views
Writing and running a stored procedure asynchronously *and* getting a return value
Suppose I have two stored procedures, foo and bar, both written using Snowflake Scripting language.
Inside foo, I want to call bar asynchronously and get a return value from bar. Is there currently a ...
0
votes
1
answer
134
views
Filling Winforms datagrid using Postgres stored procedure
I am trying to get data from Postgres table with a help of stored procedure and fill a Winforms DataGrid with it.
This is the stored procedure:
CREATE OR REPLACE PROCEDURE public.get_list()
LANGUAGE ...
2
votes
1
answer
268
views
Make sure the consumer code uses @Transactional or any other way of declaring a (read-only) transaction] with root cause
I am trying to learn how to call stored procedure from springboot data jpa repository and returns a cursor from stored procedure. While I am implementing I am getting error like org.springframework....
-2
votes
4
answers
402
views
PostgreSQL stored procedure call from Spring Boot gives "Procedure does not exist" and "might need to add explicit type casts" error
I am trying to learn and implement PostgreSQL Stored procedure call from Spring Boot repository using @Procedure annotated method. While calling stored procedure I am getting error saying that:
Error
...
3
votes
1
answer
82
views
Correct syntax to define parameters in a `StoredProcedure` Spring bean, fixing error ORA-06550
Why I am asking this
After upgrade of Oracle JDBC driver in a Spring Boot application from 23.5.0.24.07 to 23.7.0.25.01, all stored procedure invocations in Spring Boot (via StoredProcedure beans) ...
0
votes
0
answers
52
views
What is the correct syntax for calling a stored procedure?
From the JDBI docs I got the following information:
Here’s how to call a stored procedure:
try (Call call = handle.createCall("{:sum = call add(:a, :b)}")) {
OutParameters result = call....
0
votes
1
answer
77
views
DB2 LUW Why does TRANSLATE produce this error? SQLSTATE(42815)
Alright, I've beat my head against the wall enough. So, I'm giving you my entire stored procedure. This procedure scans all tables in a selected schema to identify character columns that have "...
2
votes
1
answer
56
views
DB2 LUW Why does use of a cursor predicate generate an error?
I confirmed the following syntax in the DB2 LUW v11.5 manual (we are running DB2 LUW v11.5.9). And apparently this syntax has been supported at least since v9.7! This is in a stored procedure and, ...
0
votes
1
answer
93
views
ADF: passing the output of a Set Variable to Azure SQL database table
I am developing an ADF pipeline that looks through a set of ADLS directories and extracting the name and last modified dates for each folder. I have written the extracted information to a "Set ...
1
vote
2
answers
73
views
TRIM in SELECT statement that works in Stand Alone Query Fails in Stored Procedure (MySQL)
New to stored procedure development. I'm developing a stored procedure where I create and populate a table with the results of a query, where I get an identifier number (DCNumber), FirstName, LastName,...
2
votes
0
answers
118
views
IBM DB2 stored procedure transaction has a strange behavior
I have this code into an IBM DB2 stored procedure, when I send the @action = 'I', then the INSERT statement is executed successfully, but when I send @action = 'D', the DELETE statement remains in ...
0
votes
2
answers
93
views
DB2 LUW - Get Compile-time Failing Line Number in Stored Procedure
I've compiled other stored procedures (from SQuirrel© v4.8) and was able to figure out the error messages sufficiently to find my errors until I get a successful compile. But this time I'm getting ...
1
vote
1
answer
61
views
Stored Procedure Efficiency Testing
I work with a BI software that generates dashboards for clients. We build charts for the clients by creating stored procedures under our own schema for rendering. Each stored procedure is a SQL query ...
1
vote
1
answer
82
views
Stored procedure failing to find required IDs and inserting incorrect values when called from web app
For my studies I have created a simple no frills skills matrix which calls a T-SQL stored procedure to record the values in a table.
When hitting the 'Submit' button, the stored procedure executes. ...
0
votes
1
answer
34
views
Procedure create keeps asking for substitution using oracle sql
CREATE OR REPLACE PROCEDURE CleanupShiftLogs
AS
SHIFTNOTE_COUNT_1 CONSTANT NUMBER,
SHIFTNOTE_COUNT_2 CONSTANT NUMBER,
SHIFTNOTE_COUNT_3 CONSTANT NUMBER;
BEGIN
DECLARE ...
-1
votes
1
answer
58
views
Calculated field does not appear on report's dataset list
The following stored procedure has three calculated fields, votes, percentVotes and grandTotalVotes.
The procedure works fine and produces the correct values when tested.
However, of the three ...
0
votes
2
answers
123
views
How stop execution of a stored procedure if the client closes the connection in SQL Azure database?
I have a stored procedure that extracts historical information — a lot of historical information — but sometimes end users, perhaps by mistake or due to bad practices, send queries larger than they ...
0
votes
0
answers
35
views
Can not create index in the postgresql via lambda trigger
I am trying to make table creation, data insertion, index creation tasks in the postgres db via AWS lambda trigger. so for this activity, created a stored procedure for table creation and triggering ...
2
votes
0
answers
51
views
Oracle Db Sp works in one server but other gives "not a GROUP BY expression" (Identical Dbs)
I have two DBs that are created on two different servers. The first DB is CBRRS_QA, and the other is CBRRSAPN. The CBRRSAPN is created buy adding all in CBRRS_QA so basically tables, views, and SP are ...
2
votes
1
answer
42
views
Why is static SQL in Linux DB2 stored procedure rejected?
I've seen plenty of examples of static SQL in sample Linux DB2 stored procedures. But if I code static SQL in my Linux DB2 stored procedure, as follows:
SET v_MsgText = 'DROP LOC CHECK failed.';
...
1
vote
1
answer
85
views
How to see stored procedure progress in Linux DB2?
I created my first Linux DB2 stored procedure through SQuirrel© (to a remote database) and the procedure is working. However, this was difficult and time-consuming because I couldn't see what progress ...
2
votes
0
answers
95
views
Cursor in MySQL procedure displaying errors [closed]
Declaring of cursors where data is through JSON format, I keep getting:
Column is not valid at this position, expecting for, lock, select, table, values, with …
-- Procedure to insert Project ...
0
votes
1
answer
34
views
How to handle dynamic SQL generation safely in OceanBase stored procedures
Environment
OceanBase community edition 4.2.1 (MySQL Mode)
Tables partitioned by range (archive_2023Q1, archive_2023Q2, etc.)
The user has full DML privileges on all archive tables
I'm implementing ...
0
votes
1
answer
44
views
How to debug PL/SQL procedure performance issues in OceanBase
Environment
OceanBase community edition 4.2.1 (MySQL Mode)
Table transactions has 1M+ rows, partitioned by id.
I'm encountering performance issues with a stored procedure in OceanBase. The procedure ...
0
votes
1
answer
54
views
MySQL 8.0 Stored Procedure Showing as Slow Query Due to Total Execution Time
I have a stored procedure that runs daily to archive data from a large table. It moves data in batches of 10,000 rows from table_name to table_archive_table, and deletes the moved rows from table_name....
-3
votes
1
answer
95
views
Make a batch of “Alter procedure” that are stored in a table [duplicate]
Currently I have hundreds of stored procedures that are in multiple servers, and that coexist with other stored procedures that are in other servers with linked server.
The origin of this is that when ...
1
vote
1
answer
91
views
How do I make this query as a dynamic stored procedure?
I need this working query as a stored procedure where I can give two databases (one masterdb one testdb), start chainage, end chainage and UniqueRun as input
DECLARE @StartChainage FLOAT = 17.00;
...
1
vote
1
answer
119
views
Snowflake SQL stored procedure: reference parameter in SQL query
I have been trying to figure out a smooth way to use parameters in a Snowflake SQL stored procedure using this syntax:
CREATE OR REPLACE PROCEDURE Schema1.TestProc (Param1 FLOAT)
RETURNS VARCHAR
...
1
vote
0
answers
45
views
How can I create dynamic DB links in Oracle to synch data between multiple environments?
I am writing an oracle stored procedure to synch data between our databases. We have dev, test, stage, and performance databases. I plan to use DB Links.
The problem I'm trying to solve is I want to ...
0
votes
2
answers
126
views
SQL error: operand type clash: decimal is incompatible with date
I have the following stored procedure:
CREATE PROCEDURE [dbo].[SearchPaymentsByComp]
@CompId INT,
@OrderByCol NVARCHAR(255),
@OrderByDir NVARCHAR(255),
@SearchDate DATE = NULL,
@...
3
votes
2
answers
95
views
Call large SQL queries from inside procedures or functions to create common helper functions in Snowflake
I have a system where I need to identify different types of risk associated with entities. I have many large scripts for detecting different risk behaviours associated with entities, with some scripts ...
0
votes
0
answers
38
views
How to debug complex stored procedures in OceanBase
Environment
OceanBase 4.2.1 (Enterprise Edition - Oracle Mode)
I'm migrating Oracle stored procedures to OceanBase (Oracle compatibility mode) and encountering difficulties in debugging multi-step ...
0
votes
0
answers
94
views
Exact arrival time of a stored procedure on SQL Server
I have a specific stored procedure that executes in a SQL Server in about 0.250 seconds, when executed from SQL Server Management Studio, although it takes half a minute to display the resulting ...
0
votes
0
answers
24
views
How to implement keyset pagination for multi-column sorted queries in OceanBase stored procedures?
Environment
OceanBase CE 4.2.1 (MySQL mode)
Table: 15M rows, indexed on (score, last_updated)
When migrating a MySQL pagination stored procedure to OceanBase, LIMIT-OFFSET performs poorly with deep ...
0
votes
0
answers
41
views
How to properly retrieve multiple result sets from OceanBase stored procedures using JDBC?
Environment
OceanBase Community V4.2.1 (MySQL mode)
MySQL Connector/J 8.0.28
Java 11
When calling an OceanBase 4.2.1 (MySQL mode) stored procedure that returns multiple result sets through JDBC, I ...