i am trying trying to get a query from oracle table called "sys.all_objects" into a string variable, so then i can give it to "dbms_obfuscation_toolkit.DESEncrypt" as input, after than encrypted string will go in to "utl_file" so i can write it into a txt file.
Here's the problem, when i try to query with this code;
DECLARE
TYPE name_array is array(50) OF varchar2(100);
var_input name_array;
BEGIN
SELECT owner
INTO var_input
FROM sys.all_objects;
FOR i IN var_input.FIRST .. var_input.LAST
LOOP
dbms_output.put_line(var_input(i));
END LOOP;
END;
and the error is;
ORA-06550: line 7, column 12:
PLS-00642: local collection types not allowed in SQL statements
any idea about geting through this issue ?
for the ones who want to see the full code ;
CREATE OR REPLACE DIRECTORY data AS 'd:\folder';
GRANT read, write ON DIRECTORY data TO PUBLIC;
DECLARE
var_input varchar2(64) := 'Rndminpt';
var_key varchar2(16) := 'Anahtar1';
var_enc varchar2(1024);
var_dec varchar2(1024);
var_file utl_file.file_type;
BEGIN
-- (query part)
dbms_obfuscation_toolkit.DESEncrypt(
input_string => var_input,
key_string => var_key,
encrypted_string => var_enc);
dbms_output.put_line('Encrypted...');
var_file := utl_file.fopen('DATA','textfile.txt','W');
utl_file.put_line(var_file,var_enc);
utl_file.fclose(var_file);
dbms_output.put_line('Writen in to text... ');
END;