# Database Discussions > PostgreSQL >  Access variable in a variable

## sandaab

Hi All,

I have a variable X that gets assigned with a variable name... How to retrieve value of the variable whose name gets assigned to 'X'
Ex: I have following variables,
A='I am a'
B='I am b'
C='I am c'
Now when I assign variable 'X' as 'B', I need to get 'I am b'
And on the fly when inputs comes as 'C' for 'X', I need to get 'I am c'

DECLARE val $$X didn't work
 Used in where clause as, WHERE cycle='$$X' -- didn't work

Any help is highly appreciated

----------

