Variables in SQL script
See original GitHub issueHello
On a DB2 database with DBeaver 4.2.4, db2jcc4.jar 4.22.29, i have to calculate bank charge like
SELECT AMOUNT * :value1 + :value2
WHERE CODE LIKE :value3
I understand that if I want to set default value for variables it is automatically remember for the next time in the bind parameters windows.
CODE is a VARCHAR(8) which always begins with 999 four other numbers and a control alphabetic character (ex: 9991234A).
So I wrote ‘999%’ in the parameters window and I have to complete with the four numbers I need before the % character.
Is there a way to let the quote and the % character in the SQL request ?
I tried WHERE CODE LIKE '999:value3%'
but it doesnt work.
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
SQL Variables: Basics and usage - SQLShack
Firstly, if we want to use a variable in SQL Server, we have to declare it. The DECLARE statement is used to declare...
Read more >SQL Server Declare, Set and Select Variable - Guru99
SQL variables are the object which acts as a placeholder to a memory location. Various types of SQL Server variables, such as SQL...
Read more >Variables (Transact-SQL) - SQL Server - Microsoft Learn
A Transact-SQL local variable is an object that can hold a single data value of a specific type. Variables in batches and scripts...
Read more >Variables in SQL procedures (DECLARE, SET statements) - IBM
Values can be assigned to variables using the SET statement or the SELECT INTO statement or as a default value when the variable...
Read more >An Overview of the SQL Variables Usage - {coding}Sight
The SQL variable is a local variable that can store a single data value temporarily. Its lifecycle starts with declaration and ends with...
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 FreeTop 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
Top GitHub Comments
First version of SQL variables support will be added in 4.3.3. As it is experimental feature it is disabled by default. Please check how it works. Default values are not yet supported.
Further improvements and bug should be tracked in separate tickets.
A lot of people miss this fundamental check, thanks! This helped me