You are on page 1of 4


1. Difference between DCL and DML commands?

DCL commands will commit implicitly where in DML commands we have to
commit explicitly.
2. Table, Rowid, Rownum
Table is a database object, which is having more than one column associated with
its data type.
Rowid is the unique binary address of the row in a table
Rownum it is a temporary number in a memory and was assigned to each row
selected by the statement.
3. Pseudo-Columns
Columns that are not created explicitly by the user and can be used explicitly in
queries. The pseudo-Columns are rowid, rownum, currval, nextval, sysdate, and
4. What is a View?
View is Virtual Table, which hold the data at runtime
5. Difference between ordinary view and complex view?
Simple views can be modified easily and these cant hold the data where as
complex views cant be modified directly and complex view can hold the data to
modify a complex view we have to use INSTEAD OF TRIGGERS.
6. Forced view
Creating a view on a table, which is not there in the database.
7. Inline view
Inline view is basically a subquery with an alias that you can use like a view
inside a SQL statement.
8. What is an INDEX and what are the types?
INDEX is a database object used in oracle to provide quick access to rows.
9. Synonym
Synonym is an alias name for any database object like tables, views, functions,
10.SELECT statement syntax?
SELECT <Column name>
From <table name>
Where <condition>
Having <statement>
Group by <column name>
Connect prior
Oracle Application 11.5.9 Bias Technologies
11.What is Constraint? Different Constraints?
Constraints are representators of the columns to enforce data entity and
consistency. UNIQUE, NOT NULL, Primary key, foreign key, Check.
12.Difference between Primary key and Unique + Not Null constraints?
Unique + Not Null is a combination of two constraints and we can use more than
one Unique + Not Null in any table. Primary Key is a single constraint we can use
only one time for a table. It can be a referential key for any column in any table.
13.What is NULL?
Default Value.
14.Dual Table
It is a one row, one column table with value X.
15.Difference between Truncate and Delete?
Truncate will delete all the rows from the table with out any condition. It will
commit automatically when it fires Where delete will delete all or specified rows
based upon the condition here we have to commit explicitly.
16.Difference between Char and Varchar2?
Varchar2 is similar to char but can store available number of characters and while
querying the table varchar2 will trims the extra spaces and fetches the rows that
exactly match the criteria.
17.Difference between LOB and LONG data types?
The maximum size of an LOB is 4GB. It will support random access to data where
in LONG maximum size is 2GB. It will support sequential access to data.
18.Single Row functions: It will work on single row and give result for all the
Ex: to_char, to_date etc.
19.Group Functions: It will work on group of rows in a table and gives a single row
result. Ex: Sum(), Avg(), min(), max().. Etc.
20.String Handling Functions?
Instr � it returns the position of the string where it occur according to the
Instrb � instr and instrb returns same but in the form of bytes.
Substr � It returns the portion of a string depending on the parameters from and
Substrb � Substr and Substrb returns the same thing but Substrb returns in the
form of bytes
21.Sign: Sign is a function it will take numbers, as inputs and it will give
i. 1 for positive integer
ii. -1 for negative integer
iii. 0 for ZERO
SQL> Select sign(-1234) from dual; O/P: -1
Oracle Application 11.5.9 Bias Technologies
22.Differences between UNION and UNION ALL?
Union: The values of the first query are returned with the values of the second
query eliminating the duplicates.
Union All: The values of the first query are returned with the values of the second
query including the duplicates.
23.Difference between NVL and NVL2 functions?
NVL is used to fill a NULL value to known value. NVL2 will identify the NULL
values and Filled values it returns exp3 if it is null otherwise it returns exp2.
have to pass 3 parameters for NVL2 and 2 parameters for NVL.
24.How can we compare range of values with out using the CASE?
By using Decode with in Decode.
25.Can we Decode with in a Decode?
26.Decode and Case Difference?
Case compares a Range of values and Decode will work as if else statement.
27.Difference between Replace and Translate?
Replace is used to replace the whole string and we can pass null values in
replace. Translate is used to translate character-by-character here we have to
pass the three parameters.
28.Difference between where and having clause?
Where used to specify condition and used to restrict the data. Having used to
specify the condition on grouped results and used to filter the data.
29.Difference between IN and EXISTS clause?
EXISTS gives the status of the inner query. If the inner query is success then it
returns true other wise it returns false and IN will compare the list of values.
30.Difference between subquery and correlated subquery?
Query with in a query is subquery. Inner query will executes first and based on
the result the outer query will be displayed. Correlated subquery outer query will
executes first and then inner query will be executed.
31. What is EXPLAIN PLAN? Syntax?
Explain plan gives the execution plan of the statement. For using this explain plan
we have the plan_table in the database.
Syntax: SQL> Explain plan
Set statemet_id = �xyx�
[Into plan_table]
Oracle Application 11.5.9 Bias Technologies
32.SQL TRACE Definition, Process and Query to get the Trace file path?
SQL trace gives the wide range of information and statistics that used to tune a
group of SQL operations. To get the trace file we have to follow some steps
# Enable the Trace.
# Run DML statements.
# Disable the Trace.
# Convert the Trace file into readable format using the TKPROF.
Trace file Path: SQL> select value from v$parameter
Name = �user_dump_dest�;
33.PL/SQL Block structure?
Variable declarations;
Exception block;
34.Anonymous Block?
It is a PL/SQL block with no name and set of statements and cannot be stored in
the database.
35.Procedure and Function Differences?
The procedure may or may not return a value. It will return the values by its own
name and function must and should return a value and it will return values with
function name.
36.Package procedure and Procedure differences?
The package procedure is faster than the ordinary procedure because if we call
the package in a procedure it will load into the SGA memory and then it starts
functioning. The ordinary procedures use this SGA memory at runtime only.
37.Global Variable?
Declaring the variable in the package specification is the Global variable.
38.Triggers and Procedures differences?
Triggers is a database object which will fire implicitly when the event occur and
TCL command will not work in the triggers by using the PRAGMA AUTONOMOUS
TRANSACTION only we can use the TCL commands in triggers.
Procedure is a database object where we have to raise explicitly and TCL
commands will work in the Procedures.
Oracle Application 11.5.9 Bias Technologies
39.Dynamic SQL?
If we want to do DML and DDL operations in the PL/SQL block we use this
dynamic SQL. Two types are there in the Dynamic SQL
Execute immediate
40.Difference between DBMS_SQL and execute immediate?
DBMS_SQL is slower process when compare to execute immediate because in the
DBMS_SQL we have to open, parse, fetch and execute to do the DML operations.
It is the version of 7.3.
Execute immediate is earlier version 9i it is a one step process used to execute
41.Define a Cursor, Types and its attributes?
Cursor is a private SQL area provided by the oracle engine its main use is to fetch
more than one row.
# Implicit
# Explicit
Implicit cursor rises whenever we use DML statements in the PL/SQL block. User
does not have control over it
Explicit cursor used to process select statement, which is used to retrieve more
than one row. We have to open, fetch, close the cursor manually. User has
control over it.
Cursor Attributes:
%ROWCOUNT � It returns the integer that how many rows that previous fetch
%FOUND � It returns TRUE if the previous fetch returns a row otherwise FALSE.
%NOTFOUND � It returns FALSE if the previous fetch returns a row otherwise
%ISOPEN � It returns TRUE if the named cursor is open otherwise FALSE.
42.PL/SQL Tables
It is an object type table and is used to hold the data at runtime and the size of
the PL/TABLE is dynamic.
43.VARRAYS and PL/SQL Table Differences?
VARRAYS size is fixed and PL/SQL table size is dynamic.
44.Difference between PL/SQL table and Cursor?
Cursor will not use index to fetch the fifth row it has to fetch all the five rows
give the fifth row.
Cursor will not work on multiple tables.
Oracle Application 11.5.9 Bias Technologies
PL/SQL table will use the index. By using the index we can directly fetch whatever
row we want in the table
PL/SQL table can work on multiple tables.
45.What is Pragma?
Pragma is a precompiler directive, which directs the compiler before compilation
of the program.
46.Pragma Autonomous Transaction
Used to split the whole transaction into two parts parent and child, which run
parallely and both have the relation ship
47.Pragma Exception_Init?
Used to associate a user-defined exception with oracle-defined error.
Ex: Bank Account Min Balance
It is used to create our own error messages, which can be more descriptive than
named exceptions.
Syn: RAISE_APPLICATION_ERROR (error_number, error_message,
Where error_number is between �20,000 and �20,999, error_message is
the text associated with this error, and keep_errors is a Boolean value.
49.Mutating Error, Mutating table?
It will occur whenever we try to do DML operations on a table, which is effected
by a trigger. The table, which is affected by trigger, is known as Mutating Error.
50.Difference between Package Procedure and Procedure?
Whenever we create a procedure in the package it will compile at that time. When
we call it will execute directly. Where in the ordinary procedure each and every
time it compiles and execute. The main difference is package procedure better in