Oracle Interview Questions- Part 2

What is a 2 Phase Commit?
Two Phase commit is used in distributed data base systems. This is useful to maintain the integrity of the database so that all the users see the same values. It contains DML statements or Remote Procedural calls that reference a remote object. There are basically 2 phases in a 2 phase commit.
a) Prepare Phase : Global coordinator asks participants to prepare
b) Commit Phase : Commit all participants to coordinator to Prepared, Read only or abort Reply


What is the difference between deleting and truncating of tables?
Deleting a table will not remove the rows from the table but entry is there in the database dictionary and it can be retrieved But truncating a table deletes it completely and it cannot be retrieved.


What are mutating tables?
When a table is in state of transition it is said to be mutating. eg : If a row has been deleted then the table is said to be mutating and no operations can be done on the table except select.


What are Codd Rules?
Codd Rules describe the ideal nature of a RDBMS. No RDBMS satisfies all the 12 codd rules and Oracle Satisfies 11 of the 12 rules and is the only Rdbms to satisfy the maximum number of rules.


What is Normalisation?
Normalisation is the process of organising the tables to remove the redundancy.There are mainly 5 Normalisation rules.
a) 1 Normal Form : A table is said to be in 1st Normal Form when the attributes are atomic
b) 2 Normal Form : A table is said to be in 2nd Normal Form when all the candidate keys are dependant on the primary key
c) 3rd Normal Form : A table is said to be third Normal form when it is not dependant transitively


What is the Difference between a post query and a pre query?
A post query will fire for every row that is fetched but the pre query will fire only once.

Deleting the Duplicate rows in the table?
We can delete the duplicate rows in the table by using the Rowid

Can U disable database trigger? How?
Yes. With respect to table
ALTER TABLE TABLE
[[ DISABLE all_trigger ]]

What is pseudo columns ? Name them?
A pseudocolumn behaves like a table column, but is not actually
stored in the table. You can select from pseudocolumns, but you
cannot insert, update, or delete their values. This section
describes these pseudocolumns:
* CURRVAL
* NEXTVAL
* LEVEL
* ROWID
* ROWNUM

How many columns can table have?
The number of columns in a table can range from 1 to 254.

Is space acquired in blocks or extents ?
In extents .


what is clustered index?
In an indexed cluster, rows are stored together based on their cluster key values .
Can not applied for HASH.

what are the datatypes supported By oracle (INTERNAL)?
Varchar2, Number,Char , MLSLABEL.

What are attributes of cursor?
%FOUND , %NOTFOUND , %ISOPEN,%ROWCOUNT

Can you use select in FROM clause of SQL select ?
Yes.

What are the various types of Exceptions ?
User defined and Predefined Exceptions.

Can we define exceptions twice in same block ?
No.

What is the difference between a procedure and a function ?
Functions return a single variable by value whereas procedures do not return any variable by value. Rather they return multiple variables by passing variables by reference through their OUT parameter.

Can you have two functions with the same name in a PL/SQL block ?
Yes.


Can you have two stored functions with the same name ?
Yes.

Can you call a stored function in the constraint of a table ?
No

What are the various types of parameter modes in a procedure ?
IN, OUT AND INOUT.

What is Over Loading and what are its restrictions ?
OverLoading means an object performing different functions depending upon the no. of parameters or the data type of the parameters passed to it.

Can functions be overloaded ?
Yes.


Can 2 functions have same name & input parameters but differ only by return datatype
No.

What are the constructs of a procedure, function or a package ?
The constructs of a procedure, function or a package are :
variables and constants
cursors
exceptions

 

 

Why Create or Replace and not Drop and recreate procedures ?
So that Grants are not dropped.

 

Can you pass parameters in packages ? How ?
Yes. You can pass parameters to procedures or functions in a package.

 

What are the parts of a database trigger ?
The parts of a trigger are:
A triggering event or statement
A trigger restriction
A trigger action

 

What are the various types of database triggers ?
There are 12 types of triggers, they are combination of :
Insert, Delete and Update Triggers.
Before and After Triggers.
Row and Statement Triggers.
(3*2*2=12)

 

What is the advantage of a stored procedure over a database trigger ?
We have control over the firing of a stored procedure but we have no control over the firing of a trigger.

 

What is the maximum no. of statements that can be specified in a trigger statement?

One. 

Can views be specified in a trigger statement ?
No

 

What are the values of :new and :old in Insert/Delete/Update Triggers ?
INSERT : new = new value, old = NULL
DELETE : new = NULL, old = old value
UPDATE : new = new value, old = old value

 

 

What are cascading triggers? What is the maximum no of cascading triggers at a time?
When a statement in a trigger body causes another trigger to be fired, the triggers are said to be cascading. Max = 32.

 

What are mutating triggers ?
A trigger giving a SELECT on the table on which the trigger is written.

 

What are constraining triggers ?
A trigger giving an Insert/Updat e on a table having referential integrity constraint on the triggering table.

 

Describe Oracle database's physical and logical structure ?
Physical : Data files, Redo Log files, Control file.
Logical : Tables, Views, Tablespaces, etc.

 

Can you increase the size of a tablespace ? How ?
Yes, by adding datafiles to it.

 

Can you increase the size of datafiles ? How ?
No (for Oracle 7.0)
Yes (for Oracle 7.3 by using the Resize clause ----- Confirm !!).

 

What is the use of Control files ?
Contains pointers to locations of various data files, redo log files, etc.

 

What is the use of Data Dictionary ?
Used by Oracle to store information about various physical and logical Oracle structures e.g. Tables, Tablespaces, datafiles, et

 

What are the advantages of clusters ?
Access time reduced for joins.

 

What are the disadvantages of clusters ?
The time for Insert increases.

 

 

Can Long/Long RAW be clustered ?
No.

 

Can null keys be entered in cluster index, normal index ?
Yes.

 

Can Check constraint be used for self referential integrity ? How ?
Yes. In the CHECK condition for a column of a table, we can reference some other column of the same table and thus enforce self referential integrity.

 

What are the min. extents allocated to a rollback extent ?
Two

 

What are the states of a rollback segment ? What is the difference between partly available and needs recovery ?
The various states of a rollback segment are :
ONLINE, OFFLINE, PARTLY AVAILABLE, NEEDS RECOVERY and INVALID.

 

What is the difference between unique key and primary key ?
Unique key can be null; Primary key cannot be null.

 

An insert statement followed by a create table statement followed by rollback ? Will the rows be inserted ?
No.

Can you define multiple savepoints ?
Yes.

 

Can you Rollback to any savepoint ?
Yes.

 

What is the maximum no. of columns a table can have ?
254.

 

What is the significance of the & and && operators in PL SQL ?
The & operator means that the PL SQL block requires user input for a variable. The && operator means that the value of this variable should be the same as inputted by the user previously for this same variable.
If a transaction is very large, and the rollback segment is not able to hold the rollback information, then will the transaction span across different rollback segments or will it terminate ?
It will terminate (Please check ).

 

Can you pass a parameter to a cursor ?
Explicit cursors can take parameters, as the example below shows. A cursor parameter can appear in a query wherever a constant can appear.
CURSOR c1 (median IN NUMBER) IS
SELECT job, ename FROM emp WHERE sal > median;

 

What are the various types of RollBack Segments ?
Public Available to all instances
Private Available to specific instance

 

Can you use %RowCount as a parameter to a cursor ?
Yes

 

Is the query below allowed :
Select sal, ename Into x From emp Where ename = 'KING'
(Where x is a record of Number(4) and Char(15))

Yes

 

Is the assignment given below allowed :
ABC = PQR (Where ABC and PQR are records)
Yes

 

Is this for loop allowed :
For x in &Start..&End Loop

Yes

 

How many rows will the following SQL return :
Select * from emp Where rownum < 10;

9 rows














Comments (0)

Post a Comment
* Your Name:
* Your Email:
(not publicly displayed)
Reply Notification:
Approval Notification:
Website:
* Security Image:
Security Image Generate new
Copy the numbers and letters from the security image:
* Message:

Email to Friend

Fill in the form below to send this article to a friend:

Email to Friend
* Your Name:
* Your Email:
* Friend's Name:
* Friend's Email:
* Security Image:
Security Image Generate new
Copy the numbers and letters from the security image
* Message: