Not able to parametarize the limit in stored procedure
See original GitHub issueconst command = SELECT * FROM TableName ORDER BY id LIMIT ?;
;
await connect.promise().execute(command, [itemsPerPage]);
Hello, i am parameterize the limit VALUE and requesting the query using execute command, its throwing me error status 500, how can i achieve the same?
Issue Analytics
- State:
- Created a year ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
SQL - Limiting stored procedure input parameters
One way is to add simple validation: CREATE PROCEDURE UPDATECATS @UPDTYPE CHAR(1) AS BEGIN IF @UPDTYPE IN ('R', 'U') BEGIN -- your code...
Read more >SP does not accept variables in LIMIT clause - MySQL Bugs
It is bug that results in a serious limitation on functionality and means that paging is not possible when using stored procedures.
Read more >SQL Server Stored Procedure with Parameters
In this tutorial topic we will cover how to create SQL Server stored procedures that use input parameters.
Read more >Stored Procedure With an Optional Parameter Limiting Rows ...
The "easiest" way is to parameterize input to TOP. The number I'm using is the maximum value for BIGINT. You'll probably never have...
Read more >Limits and differences for stored procedure support
Limits. The following are limits on stored procedures in Amazon Redshift: The maximum number of stored procedures for a database is 10,000.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Himadri93 not sure if related, but have a look at https://github.com/sidorares/node-mysql2/issues/1239
TLDR: currently execute sends js numbers as DOUBLE mysql type in a PS call parameter, and mysql server > 8.0.22 does not like this combination ( LONG int in expected parameter type and DOUBLE in actual type ). One way to work around this issue right now is to convert your number parameter to a string, in that case its sent as VAR_STRING and for some reason string -> long conversion is allowed )
closing as exact duplicate of #1239