Oracle FAQ -8

Oracle FAQ -8

Q.How will you delete duplicating rows from a base table?

delete from table_name where rowid not in (select max(rowid) from table group by duplicate_values_field_name); or delete duplicate_values_field_name dv from table_name ta where rowid <(select min(rowid) from table_name tb where ta.dv=tb.dv);

Q.How do you find the numbert of rows in a Table?

A bad answer is count them (SELECT COUNT(*) FROM table_name)
A good answer is :-
'By generating SQL to ANALYZE TABLE table_name COUNT STATISTICS by querying Oracle System Catalogues (e.g. USER_TABLES or ALL_TABLES).
The best answer is to refer to the utility which Oracle released which makes it unnecessary to do ANALYZE TABLE for each Table individually.

Q.Difference between database triggers and form triggers?

-Data base trigger(DBT) fires when a DML operation is performed on a data base table. Form trigger(FT) Fires when user presses a key or navigates between fields on the screen
-Can be row level or statement level No distinction between row level and statement level.
-Can manipulate data stored in Oracle tables via SQL Can manipulate data in Oracle tables as well as variables in forms.
-Can be fired from any session executing the triggering DML statements. Can be fired only from the form that define the trigger.
-Can cause other database triggers to fire. Can cause other database triggers to fire, but not other form triggers.

Q.How will you a activate/deactivate integrity constraints?

The integrity constraints can be enabled or disabled by ALTER TABLE ENABLE constraint/DISABLE constraint.

Q.What is a view ?

A view is stored procedure based on one or more tables, it’s a virtual table.

Q.What is difference between UNIQUE and PRIMARY KEY constraints?

A table can have only one PRIMARY KEY whereas there can be any number of UNIQUE keys. The columns that compose PK are automatically define NOT NULL, whereas a column that compose a UNIQUE is not automatically defined to be mandatory must also specify the column is NOT NULL.

Q.What is syntax for dropping a procedure and a function .Are these operations possible?

Drop Procedure procedure_name
Drop Function function_name

Q.What is use of a cursor variable? How it is defined?

A cursor variable is associated with different statements at run time, which can hold different values at run time. Static cursors can only be associated with one run time query. A cursor variable is reference type (like a pointer in C).
Declaring a cursor variable:
TYPE type_name IS REF CURSOR RETURN return_type type_name is the name of the reference type,return_type is a record type indicating the types of the select list that will eventually be returned by the cursor variable.

Q.What is the maximum buffer size that can be specified using the DBMS_OUTPUT.ENABLE function?

1,000,00

Q.What is the Subquery?

Sub query is a query whose return values are used in filtering conditions of the main query.

Q.What are cursor attributes?


-%ROWCOUNT
-%NOTFOUND
-%FOUND
-%ISOPEN

Q.There is a % sign in one field of a column. What will be the query to find it?

'' Should be used before '%'.

Q.What is a cursor for loop?

Cursor For Loop is a loop where oracle implicitly declares a loop variable, the loop index that of the same record type as the cursor's record.

Q.How you will avoid duplicating records in a query?

By using DISTINCT

Q.What is the fastest way of accessing a row in a table ?

Using ROWID.CONSTRAINTS

Q.What is a join ? Explain the different types of joins?

Join is a query which retrieves related columns or rows from multiple tables.Self Join - Joining the table with itself.Equi Join - Joining two tables by equating two common columns.Non-Equi Join - Joining two tables by equating two common columns.Outer Join - Joining two tables in such a way that query can also retrieve rows that do not have corresponding join value in the other table.

Q.What is difference between TRUNCATE & DELETE?

TRUNCATE commits after deleting entire table i.e., can not be rolled back. Database triggers do not fire on TRUNCATEDELETE allows the filtered deletion. Deleted records can be rolled back or committed. Database triggers fire on DELETE.

Q.What is a transaction?

Transaction is logical unit between two commits and commit and rollback.

Q.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.

Q.Where the integrity constraints are stored in Data Dictionary?

The integrity constraints are stored in USER_CONSTRAINTS.

Q.What is ON DELETE CASCADE?

When ON DELETE CASCADE is specified ORACLE maintains referential integrity by automatically removing dependent foreign key values if a referenced primary or unique key value is removed.

Q.What is an Integrity Constraint?

Integrity constraint is a rule that restricts values to a column in a table.

Q.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.

Q.What are the usage of SAVEPOINTS ?value in a session before accessing next value?

SAVEPOINTS are used to subdivide a transaction into smaller parts. It enables rolling back part of a transaction. Maximum of five save points are allowed.

Q.Explain Connect by Prior ?in a session before accessing next value?


Retrieves rows in hierarchical order.e.g. select empno, ename from emp where.

Q.How many LONG columns are allowed in a table ? Is it possible to use LONG columns in WHERE clause or ORDER BY?

Only one LONG columns is allowed. It is not possible to use LONG column in WHERE or ORDER BY clause.

Q.What is Referential Integrity?

Maintaining data integrity through a set of rules that restrict the values of one or more columns of the tables based on the values of primary key or unique key of the referenced table.

Q.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.

Q.What is ROWID ?in a session before accessing next value?

ROWID is a pseudo column attached to each row of a table. It is 18 character long, blockno, rownumber are the components of ROWID.

Q.How does one stop and start the OMS? (for DBA)

Use the following command sequence to stop and start the OMS (Oracle Management Server):
oemctl start oms
oemctl status oms sysman/oem_temp
oemctl stop oms sysman/oem_temp
Windows NT/2000 users can just stop and start the required services. The default OEM administrator is "sysman" with a password of "oem_temp".
NOTE: Use command oemctrl instead of oemctl for Oracle 8i and below.

-----------------------------
Also Read:
Oracle Interview Questions -1

Oracle Interview Questions -2

Oracle Interview Questions -3

Oracle Interview Questions -4

Oracle Interview Questions -5

Oracle Interview Questions -6

Oracle Interview Questions -7

Oracle Interview Questions -9

Oracle Interview Questions -10

Oracle Interview Questions -11

Oracle Interview Questions -12

Oracle Interview Questions -13
Oracle Interview Questions -14

Oracle Interview Questions -15

Oracle Interview Questions -16

Oracle Interview Questions -17
 
Oracle Interview Questions -18

Oracle Interview Questions -19

Oracle Interview Questions -20

Oracle Interview Questions -21
 
Oracle Interview Questions -22

0 comments:

Post a Comment