You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Ns G <ns...@gmail.com> on 2015/08/06 04:08:04 UTC

reg: Querying using columns from system.catalog

Hi All,

I want to query a table after finding all the columns for a table that
belong to a column family from system catalog.

I have written the below query

SELECT 'SELECT ' ||
ARRAY_TO_STRING(ARRAY(SELECT COLUMN_NAME::VARCHAR(50)
FROM SYSTEM.CATALOG
WHERE TABLE_SCHEM ='SCM_262' AND COLUMN_FAMILY LIKE a%
), ', ') || ' FROM SCM_262.ELEMENT';


I get error
"Error Code: 602, SQL State: 42P00]  ERROR 602 (42P00): Syntax error.
Missing "LPAREN" at line 1, column 8"

my actual requirement is that, columns are inserted dynamically and based
on certain conditions, I need to copy all values of columns that belong to
column family that begin with 'a' should be copied to other row of the
table.


Thanks for your help!

Satya