Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug when a variable is assigned from a query #1645

Closed
pabloBelt opened this issue Feb 22, 2023 · 3 comments
Closed

Bug when a variable is assigned from a query #1645

pabloBelt opened this issue Feb 22, 2023 · 3 comments

Comments

@pabloBelt
Copy link

pabloBelt commented Feb 22, 2023

Hi,

There is a bug when a variable takes a value from a query.

DECLARE @x NUMBER = (SELECT MAX(population) FROM cities) `

http://jsfiddle.net/wa5hz8nd/1/

It can also be reproduced with the latest 3.0.0 version:

image

Bests,
Pablo

@pabloBelt pabloBelt changed the title Bug variable assigned to statement Bug variable assigned from statement Feb 23, 2023
@pabloBelt pabloBelt changed the title Bug variable assigned from statement Bug when a variable is assigned from statement Feb 23, 2023
@pabloBelt pabloBelt changed the title Bug when a variable is assigned from statement Bug when a variable is assigned from a query Feb 23, 2023
@joan8ruth
Copy link

Hello @pabloBelt ,
I see that the declare could be split into two steps:

declare @v NUMBER;
SET @v = (Select MAX(X) from T);

and is working fine this way (maybe it works only this way? because I believe this is what I usually do when writing queries), but I would like to know if the single line declaration you have mentioned was working in the previous version.

Regards,
Joanna

@abhishek-kumar-91
Copy link

I want to work on this issue, please assign me.

@mathiasrw
Copy link
Member

Fix Released as part of v4.0.6

mathiasrw pushed a commit that referenced this issue Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants
@mathiasrw @joan8ruth @abhishek-kumar-91 @pabloBelt and others