Hi all,
My need is to find value in table (don't know column name yet).
Trying to use column list and loop.
Honestly I'm afraid I can't write proper code to find COLUMN VALUE (2581365), because my code works fine only to find COLUMN NAME (dealid).
Please help me to find COLUMN VALUE.
declare
l_cnt number;
begin
for i in (
select column_name from ALL_TAB_COLUMNS where owner = 'CREATOR' AND TABLE_NAME LIKE UPPER('%dbt_reserve%')
)
loop
select count(1) into l_cnt
From CREATOR.dbt_reserve t
where arcdate between date '2013-09-30' - 60 and date '2013-09-30' + 60
and ISAPPROVED=1
and upper(i.column_name) = upper('dealid'); --to_char(2581365) ;
if l_cnt > 0 then
raise_application_error(-20001, l_cnt || ' ' || i.column_name);
end if;
end loop;
end;
Oracle 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production