Oracle SQL Interview Questions
1. How will you a activate/deactivate integrity constraints ?
The integrity constraints can be enabled or disabled by ALTER TABLE ENABLE constraint/DISABLE constraint.
2. If an unique key constraint on DATE column is created, will it validate the rows that are inserted with SYSDATE ?
It won't, Because SYSDATE format contains time attached with it.
3. What is a database link ?
Database Link is a named path through which a remote database can be accessed.
4. How to access the current value and next value from a sequence ? Is it possible to access the current value in a session before accessing next value ?
Sequence name CURRVAL, Sequence name NEXTVAL.
It is not possible. Only if you access next value in the session, current value can be accessed.
5. What is CYCLE/NO CYCLE in a Sequence ?
CYCLE specifies that the sequence continues to generate values after reaching either maximum or minimum value. After pan ascending sequence reaches its maximum value, it generates its minimum value. After a descending sequence reaches its minimum, it generates its maximum.
NO CYCLE specifies that the sequence cannot generate more values after reaching its maximum or minimum value.
6. What are the advantages of VIEW ?
To protect some of the columns of a table from other users.
To hide complexity of a query.
To hide complexity of calculations.
7. Can a view be updated/inserted/deleted? If Yes under what conditions ?
A View can be updated/deleted/inserted if it has only one base table if the view is based on columns from one or more tables then insert, update and delete is not possible.
8.If a View on a single base table is manipulated will the changes be reflected on the base table ?
If changes are made to the tables which are base
tables of a view will the changes be reference on the view