Ora-01008 Not all variables bound
666835Aug 16 2011 — edited Aug 16 2011I'm trying to list all columns in a table that have only NULL values.
I'm trying to run this in Toad and get Ora-01008 Not all variables bound... Usually a prompt appears that ask you the values of (in this case) :schema_name and :table_name
I' mark the whole thing and click "run statement" -button
Anyone know if I've made a mistake, is there a bug in Toad? Anyway to do a workaround?
DECLARE
v_nums number;
CURSOR c1 IS
SELECT
COLUMN_NAME
FROM
ALL_TAB_COLUMNS
WHERE
OWNER = :schema_name AND
TABLE_NAME = :table_name
order by column_id;
BEGIN
FOR r in c1
LOOP
v_nums:=0;
EXECUTE IMMEDIATE
'select count(*) into :p1 from ' || :schema_name || '.' || :table_name ||
' where ' || r.column_name || ' is not null'
INTO v_nums;
IF v_nums = 0 then
insert into result_table
values(r.column_name, 'All records are NULL');
ELSE
insert into result_table
values(r.column_name, '');
END IF;
END LOOP;
END;