Assignment of query output to a variable

Moderator: NorbertKrupa

Post Reply
mailyaseen
Newbie
Newbie
Posts: 1
Joined: Sat Aug 06, 2016 7:19 pm

Assignment of query output to a variable

Post by mailyaseen » Sat Aug 06, 2016 7:36 pm

Hi,

Can we set the output of the query to a variable like,

CNT=SELECT COUNT(*) FROM DATABASENAME.TABLENAME;

I know, we have

\set CNT 'SELECT COUNT(*) FROM DATABASENAME.TABLENAME'
\echo :CNT

SELECT COUNT(*) FROM DATABASENAME.TABLENAME


But i need to output of the query in the CNT, i need the number value, not the select statment in the CNT variable.

Is this doable in vertica?

Thank you,
Yaseen

Victorgm
Beginner
Beginner
Posts: 25
Joined: Fri Jul 17, 2015 2:22 pm

Re: Assignment of query output to a variable

Post by Victorgm » Wed Aug 10, 2016 5:09 pm


Post Reply

Return to “Vertica SQL”