Hi
I have the following query:
select uc.table_name
,uc.column_name
,ucc.constraint_name
,uco.search_condition
,uc.column_id
from user_tab_columns uc
left outer join user_cons_columns ucc on ( uc.table_name = ucc.table_name
and uc.column_name = ucc.column_name)
left outer join user_constraints uco on (ucc.constraint_name = uco.constraint_name)
where uc.table_name = '&&TABLE_NAME'
and ( uco.constraint_type = 'C' or uco.constraint_type is NOT null)
and 'N' = '&&IS_NULL'
union all
select uc.table_name
,uc.column_name
,ucc.constraint_name
,uco.search_condition
,uc.column_id
from user_tab_columns uc
left outer join user_cons_columns ucc on ( uc.table_name = ucc.table_name
and uc.column_name = ucc.column_name)
left outer join user_constraints uco on (ucc.constraint_name = uco.constraint_name)
where uc.table_name = '&&TABLE_NAME'
and ( uco.constraint_type = 'C' or uco.constraint_type is null)
and 'Y' = '&&IS_NULL'
order by column_id;
When I specify "N" for the IS_NULL parameter, then the correct rows appear, but when specifying "Y", then both NULL and NOT null columns appear.
Is there a way I can get only one list or the other ?
for example, for the following table:
CREATE GLOBAL TEMPORARY TABLE TBL_GT (ID INTEGER, X VARCHAR2(10) NOT NULL);
I would like to see only the columns ID if "Y" is specified and only the column X if "N" is specified.