SELECT
'SELECT t."'
||t1.Column_Name||
'" as col_name, COUNT(t."'
||t1.Column_Name||
'") as cnt FROM "'
||
t1.table_name||
'" t WHERE t."'
||t1.column_name||
'" like '
'%wc111'
''
||
' GROUP BY t."'
||t1.Column_Name||
'"'
||
' union all '
AS
SQL
FROM
cols t1
left
join
user_col_comments t2
on
t1.Table_name=t2.Table_name
and
t1.Column_Name=t2.Column_Name
left
join
user_tab_comments t3
on
t1.Table_name=t3.Table_name
WHERE
NOT
EXISTS (
SELECT
t4.Object_Name
FROM
User_objects t4
WHERE
t4.Object_Type=
'TABLE'
AND
t4.
Temporary
=
'Y'
AND
t4.Object_Name=t1.Table_Name )
AND
t1.Data_Type=
'CHAR'
or
t1.Data_Type=
'VARCHAR2'
or
t1.Data_Type=
'VARCHAR'
ORDER
BY
t1.Table_Name, t1.Column_ID;