Oracle Sql selecting all data from a list of views -


i trying write sql select data list of views particular view.

i'm getting user view way:

select view_name user_views 

say output is:

emp_v dept_v countries_v jobs_v 

is possible me pass 1 of these views parameter in original sql(which pulling views) can data in view?

thanks

this might looking for. loop views , select in them. note: can cause lot of dbms_output. suggest hardcoding cursor specific view first make sure looking for.

(1) create procedure...

create or replace procedure print_view(p_query in varchar2)      l_thecursor     integer default dbms_sql.open_cursor;     l_columnvalue   varchar2(4000);     l_status        integer;     l_desctbl       dbms_sql.desc_tab;     l_rowcnt        number := 0;     l_colcnt        number;  begin      dbms_sql.parse(l_thecursor, p_query, dbms_sql.native);     dbms_sql.describe_columns(l_thecursor, l_colcnt, l_desctbl);      dbms_output.put_line(l_colcnt);      in 1 .. l_colcnt loop         dbms_sql.define_column(l_thecursor, i, l_columnvalue, 4000);     end loop;      l_status := dbms_sql.execute(l_thecursor);      while(dbms_sql.fetch_rows(l_thecursor) > 0) loop         l_rowcnt := l_rowcnt +1;         dbms_output.put_line('========== row '||l_rowcnt||' ==========');         in 1 .. l_colcnt loop             dbms_sql.column_value(l_thecursor, i, l_columnvalue);             dbms_output.put_line(rpad(l_desctbl(i).col_name, 30)||': '||substr(l_columnvalue, 1, 200));         end loop;     end loop;  end print_view; / 

(2) run this...

declare  /* note: edit clause. should try single view first make sure want. */ cursor cursor1 select view_name user_views view_name in ('emp_v','dept_v','countries_v','jobs_v');  begin     c1 in cursor1 loop         print_view('select * '|| c1.view_name); /* pass view parameter requested. */     end loop; end; / 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -