I have two tables
1.
shiv_tab_col
TABLENAME | COLUMNNAME
--------------------------
SER_SHIV_SYN | TABLENAME
SER_SHIV_SYN | COLUMNNAME
AND SER_SHIV_SYN
TABLENAME | COLUMNNAME
--------------------------
A | B
E | NULL
NULL | NULL
NULL | NULL
NULL | NULL
NULL | NULL
BUT WHEN I M TRYING TO RUN THE BELOW CODE IT IS GIVING ME '0' AS VALUE OF TNAME
DECLARE
tname varchar(20):=null;
CURSOR C1 IS
SELECT *
FROM SHIV_TAB_COL;
BEGIN
for rec in C1
loop
select count(*) into tname from (select nvl(rec.columnname,1)b from ser_shiv_syn) where b ='1';
dbms_output.put_line(tname);
dbms_output.put_line(rec.columnname);
END LOOP;
END;
Actually i m looking to count the no. of null values in each column which will be stored in variable TNAME
for first column it should give 4
for 2 column it should give 5