question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Variables in SQL script

See original GitHub issue

Hello

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:closed
  • Created 6 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
serge-ridercommented, Jan 21, 2018

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.

image

Further improvements and bug should be tracked in separate tickets.

0reactions
ChetanSolurcommented, Sep 17, 2019

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.

image

Further improvements and bug should be tracked in separate tickets

A lot of people miss this fundamental check, thanks! This helped me

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found