Oracle Interview Questions

Difference between varchar and varchar2 data types?

Varchar can store upto 2000 bytes and varchar2 can store upto 4000 bytes. Varchar will occupy space for NULL values and Varchar2 will not occupy any space. Both are differed with respect to space.

In which language Oracle has been developed?

Oracle has been developed using C Language

What is RAW datatype?

RAW datatype is used to store values in binary data format. The maximum size for a raw in a table in 32767 bytes.

What is the use of NVL function?

The NVL function is used to replace NULL values with another or given value. Example is –
NVL(Value, replace value)

Whether any commands are used for Months calculation? If so, What are they?

In Oracle, months_between function is used to find number of months between the given dates. Example is –
Months_between(Date 1, Date 2)

What are nested tables?

Nested table is a data type in Oracle which is used to support columns containing multi valued attributes. It also hold entire sub table.

What is COALESCE function?

COALESCE function is used to return the value which is set to be not null in the list. If all values in the list are null, then the coalesce function will return NULL.
Coalesce(value1, value2,value3,…)

What is BLOB datatype?

A BLOB data type is a varying length binary string which is used to store two gigabytes memory. Length should be specified in Bytes for BLOB.

How do we represent comments in Oracle?

Comments in Oracle can be represented in two ways –

  1. Two dashes(–) before beginning of the line – Single statement
  2. /*—— */ is used to represent it as comments for block of statement

What is DML?

Data Manipulation Language (DML) is used to access and manipulate data in the existing objects.  DML statements are insert, select, update and delete and it won’t implicitly commit the current transaction.

What is the difference between TRANSLATE and REPLACE?

Translate is used for character by character substitution and Replace is used substitute a single character with a word.

How do we display rows from the table without duplicates?

 Duplicate rows can be removed by using the keyword DISTINCT in the select statement.

What is the usage of Merge Statement?

Merge statement is used to select rows from one or more data source for updating and insertion into a table or a view. It is used to combine multiple operations.

What is NULL value in oracle?

NULL value represents missing or unknown data. This is used as a place holder or represented it in as default entry to indicate that there is no actual data present.

What is USING Clause and give example?

The USING clause is used to specify with the column to test for equality when two tables are joined.
[sql]Select * from employee join salary using employee ID[/sql]
Employee tables join with the Salary tables with the Employee ID.

What is key preserved table?

 A table is set to be key preserved table if every key of the table can also be the key of the result of the join. It guarantees to return only one copy of each row from the base table.

What is WITH CHECK OPTION?

The WITH CHECK option clause specifies check level to be done in DML statements. It is used to prevent changes to a view that would produce results that are not included in the sub query.

What is the use of Aggregate functions in Oracle?

Aggregate function is a function where values of multiple rows or records are joined together to get a single value output. Common aggregate functions are –

  • Average
  • Count
  • Sum

What do you mean by GROUP BY Clause?

A GROUP BY clause can be used in select statement where it will collect data across multiple records and group the results by one or more columns

What is a sub query and what are the different types of subqueries?

Sub Query is also called as Nested Query or Inner Query which is used to get data from multiple tables. A sub query is added in the where clause of the main query.
There are two different types of subqueries:

  • Correlated sub query

A Correlated sub query cannot be as independent query but can reference column in a table listed in the from list of the outer query.

  • Non-Correlated subquery

This can be evaluated as if it were an independent query. Results of the sub query are submitted to the main query or parent query.

Summary
Review Date
Reviewed Item
Awesome post. Thanks to iteanz for posting these useful interview questions.
Author Rating
51star1star1star1star1star