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!

create view in pl/sql

511890Jun 15 2006 — edited Jun 16 2006
Hi 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 14 2006
Added on Jun 15 2006
12 comments
758 views