Monday, 15 April 2013

Oracle: How can I introspect a view? -


How can I make a scene independent in Oracle? For example, if I have

  create scene v, select foo, bar by baz  

I would like to know that foo And bar first and second columns are selected.

You can also use all_tab_columns for views, then see v The first two columns will be something like this:

  all_tab_columnWhere TABLE_NAME = 'V' and column_id IN (1, 2) from SELECT *;  

Then you can ask for specific columns:

  SELECT COUNT (*) TOTAL_tab_columns to total where TABLE_NAME = 'V' and (table_name, column_id ) IN (('FOO', 1), ('Bar', 2));  

If the total is 2 then it means that the first and second columns selected are foo and bar with the case or decode it Make more readable: Select

  when the total = 2 results from 1 or 1 0 (for all numbers select * (*) from TOTAL_tab_column where total TABLE_NAME = 'V 'And (table_name, column_id) IN ((' FOO ', 1), (' bar ', 2));  

No comments:

Post a Comment