show table tablename;
help table tablename;
SELECT UPPER(TRIM(T1.COLUMNNAME)), COALESCE(T1.COLUMNTITLE,'NO TITLE'), CASE WHEN T1.COLUMNTYPE = 'BF' THEN 'BYTE' WHEN T1.COLUMNTYPE = 'I1' THEN 'BYTEINT' WHEN T1.COLUMNTYPE = 'VF' THEN 'VARBYTE' WHEN T1.COLUMNTYPE = 'DA' THEN 'DATE' WHEN T1.COLUMNTYPE = 'F' THEN 'FLOAT' WHEN T1.COLUMNTYPE = 'I2' THEN 'SMALLINT' WHEN T1.COLUMNTYPE = 'I' THEN 'INTEGER' WHEN T1.COLUMNTYPE = 'CF' THEN 'CHAR('|| TRIM(T1.COLUMNLENGTH) ||')' WHEN T1.COLUMNTYPE = 'CV' THEN 'VARCHAR('|| TRIM(T1.COLUMNLENGTH) ||')' WHEN T1.COLUMNTYPE = 'D' THEN 'DECIMAL' || '(' || T1.DECIMALTOTALDIGITS || ',' || T1.DECIMALFRACTIONALDIGITS || ')' ELSE 'UNKNOW' END, T1.NULLABLE, CASE WHEN T2.COLUMNNAME is NULL THEN 'N' ELSE 'Y' END FROM DBC.COLUMNS T1 LEFT JOIN DBC.Indices T2 ON T1.DATABASENAME = T2.DATABASENAME AND T1.TABLENAME = T2.TABLENAME AND T1.COLUMNNAME = T2.COLUMNNAME AND (T2.IndexType = 'Q' or T2.IndexType = 'P') WHERE T1.DATABASENAME='p_pdata' AND T1.TABLENAME='ods_prpcmain' order by T1.ColumnId;