Set - 6

Question 41 :

What is difference between UNIQUE and PRIMARY KEY constraints?

Answer :

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.

Question 42 :

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

Answer :

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.

Question 43 :

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

Answer :

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.

Question 44 :

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

Answer :


Question 45 :

What are cursor attributes?

Answer :