I have written a PL/SQL script to find the size of a long column in a table. Just to make the script generic I am passing the table Name and column name as variables , but I am getting an error saying that table or view does not exist. the details are :
ORA-06550: line 8, column 34: PL/SQL: ORA-00942: table or view does not exist ORA-06550: line 8, column 11: PL/SQL: SQL Statement ignored ORA-06550: line 9, column 42: PLS-00364: loop index variable 'J' use is invalid ORA-06550: line 9, column 3: PL/SQL: Statement ignored
The Script is :
declare a number := 0; x number := 0; i number := 0; tablename varchar2(100):= 'FILES'; columnname varchar2(100):= 'FILESIZE'; begin for j in (select columnname from tablename) loop a:=UTL_RAW.LENGTH (UTL_RAW.CAST_TO_RAW(j.columnname)); i := i+1; dbms_output.put_line(i); x:= x + a; end loop; dbms_output.put_line(x); end;
The table name is FILES. And the column name is FILESIZES.
Can you suggest what I am doing wrong. And what can I do to find the size of long Column??