Question

I am trying to turn the following query from Transact-SQL to PL/pgSQL

SELECT @val1 = val1, @val2= val2 FROM dbo.MyTable WHERE val3 = @val3

This with I have come out:

v_val1 := val1 FROM MyTable WHERE val3  = v_val3;
v_val2 := val2 FROM MyTable WHERE val3 = v_val3;

Is there a better way to do this? May be in the same sentence like Transact-SQL

Was it helpful?

Solution

select val1, val2 into v_val1, v_val2 
from mytable 
where val3 = v_val3
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top