create view in pl/sql
511890Jun 15 2006 — edited Jun 16 2006Hi all,
I try to create a view from PL/SQL where the create statement is spread on an associative array. The reason why I use an array is that the statement to create the view may be very long.
The array is defined as follows:
TYPE ARRAY IS TABLE OF VARCHAR2(4000) INDEX BY BINARY_INTEGER;
g_data ARRAY;
I use procedures like put_line() and get_line() to access the data in the array. Alle these procedures and the array is packed in a package p.
Here is an example of the usage:
BEGIN
p.delete_array;
p.put_line('create or replace view del_view');
p.put_line('as select sysdate from dual');
IF (p.get_line_count>0) THEN
FOR x IN 1..p.get_line_count LOOP
dbms_output.put_line(p.get_line(x));
END LOOP;
END IF;
end;
Now I want to create a view from the data in the array. But I don't know how to use EXECUTE IMMEDIATE in this case. Can anybody help me?
I use 10R2.
Thank you very much in advance,
VD