Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Ora-01008 Not all variables bound

666835Aug 16 2011 — edited Aug 16 2011
I'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;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 13 2011
Added on Aug 16 2011
11 comments
2,424 views