Assignment of query output to a variable
Posted: 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
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