Page 1 of 1

Assignment of query output to a variable

Posted: Sat Aug 06, 2016 7:36 pm
by mailyaseen
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

Re: Assignment of query output to a variable

Posted: Wed Aug 10, 2016 5:09 pm
by Victorgm