Hello DBA,
Can any one help me this?
The table TEST contains
CNAME CNO EXTRA
------------------------------ ---------- ----------
bijaya 645896
mantri 525896
mantri12 525126
testing for null
My requirement is to find the column which contains all the rows null(null column)
I have created the following procedure to accomplish this
create or replace procedure test_null
is
cursor c1 is select column_name from user_tab_columns where table_name = 'TEST';
cnt number := 0;
begin
for i in c1
loop
select count(i.column_name) into cnt from test;
dbms_output.put_line(i.column_name || ' contains ' || cnt);
if cnt = 0 then
insert into test_temp values(i.column_name);
end if;
cnt:=0;
end loop;
end;
/
This give the result
CNAME contains 4
CNO contains 4
EXTRA contains 4
if i run the SELECT statment in sql plus then
SQL> select count(extra) from test;
COUNT(EXTRA)
------------
0
i am not able to find the difference.
please help me to short out this problem
Thanks,
BMantri