Skip to main content

21.Oracle - The self documenting dictionary

Oracle - The self documenting dictionary

Oracle's Data dictionary is itself self documenting. we can query DICTIONARY AND DICT_COLUMNS views for descriptions of the data dictionary views and their columns.


The following query gives the descriptions of all of the data dictionary views.

SELECT table_name, comments
FROM dictionary
ORDER BY table_name;


It gives the large amount of output. By using where class we can focus a smaller set of views as like the following query.

SELECT table_name, comments
FROM dictionary
WHERE table_name LIKE '%TABLE%'
ORDER BY table_name

It returns all views containing the word 'TABLE'

Like wise We can query the DICT_COLUMNS view also. It gives the descriptions for the columns for all views. Following query retrieves descriptions for the columns in ALL_TAB_COLUMNS.


SELECT column_name, comments
FROM dict_columns
WHERE table_name = 'ALL_TAB_COLUMNS';

This is a sample one. We can learn lot about oracle through data dictionary views, they are not available at any oracle site.


Thanks..!

Comments

Anonymous said…
NIce blog do visit my blog
www.mobi-viz.blogspot.com
www.k2karea.blogspot.co

Popular posts from this blog

Question 5: Where and having clauses

Which two statements are true about WHERE and HAVING clauses? (Choose two) A. A WHERE clause can be used to restrict both rows and groups. B. A WHERE clause can be used to restrict rows only. C. A HAVING clause can be used to restrict both rows and groups. D. A HAVING clause can be used to restrict groups only. Answer: B, C Explanation : HAVING clause to specify which groups are to be displayed and thus further restrict the groups on the basis of aggregate information. The Oracle server performs the following steps when youuse the Having clause 1. rows are grouped 2. the group function is applied to the group 3. the group that match the criteria in the Having clause are displayed. WHERE clause cannot be use to restrict groups HAVING clause use to restrict groups WHERE clause cannot be use when there is group functions. Incorrect Answers : A. Where clause cannot be use to restrict groups D. When HAVING clause is use rows are grouped as well.

Question 15

Write a PL/SQL Program for the following output --*-- -***- ***** -***- --*-- Answer The output based on the value of 'n' declare n number(2) default 20; i number(2); j number(2); h number(2); s number(2); b varchar2(1) default 'I'; begin s := 1; if n mod 2 = 0 then n := n+1; end if; h := n/2 -1; for i in 1..n loop for j in 1..h loop dbms_output.put('-'); end loop; for j in 1..s loop dbms_output.put('*'); end loop; for j in 1..h loop dbms_output.put('-'); end loop; dbms_output.put_line(' '); if n = s then b := 'D'; end if; IF b='I' then s := s+2; h := h-1; else s := s-2; h := h+1; end if; end loop; end;