Oracle SQL : Interview Questions
1)What is difference between Rename and Alias
Rename is a permanent name given to a table or column whereas Alias is a temporary
name given to a table or column which do not exist once the SQL statement is
executed.
2)How you will avoid your query from using indexes
SELECT * FROM emp
Where emp_no+' '=12345;
3). Difference between NO DATA FOUND and %NOTFOUND
NO DATA FOUND is an exception raised only for the SELECT....INTO statements
when the where clause of the querydoes not match any rows.
When the where clause of the explicit cursor does not match any rows the %NOTFOUND attribute is set to TRUE instead
4)What should be the return type for a cursor variable.Can we use a scalar data type as return type.
The return type for a cursor must be a record type.
It can be declared explicitly as a user-defined or %ROWTYPE can be used. eg TYPE t_studentsref IS REF CURSOR RETURN students%ROWTYPE
5)What is difference between a formal and an actual parameter
The variables declared in the procedure and which are passed, as arguments are called
actual, the parameters in the procedure declaration.
Actual parameters contain the values that are passed to a procedure and receive results.
Formal parameters are the placeholders for the values of actual parameters
1)What is difference between Rename and Alias
Rename is a permanent name given to a table or column whereas Alias is a temporary
name given to a table or column which do not exist once the SQL statement is
executed.
2)How you will avoid your query from using indexes
SELECT * FROM emp
Where emp_no+' '=12345;
3). Difference between NO DATA FOUND and %NOTFOUND
NO DATA FOUND is an exception raised only for the SELECT....INTO statements
when the where clause of the querydoes not match any rows.
When the where clause of the explicit cursor does not match any rows the %NOTFOUND attribute is set to TRUE instead
4)What should be the return type for a cursor variable.Can we use a scalar data type as return type.
The return type for a cursor must be a record type.
It can be declared explicitly as a user-defined or %ROWTYPE can be used. eg TYPE t_studentsref IS REF CURSOR RETURN students%ROWTYPE
5)What is difference between a formal and an actual parameter
The variables declared in the procedure and which are passed, as arguments are called
actual, the parameters in the procedure declaration.
Actual parameters contain the values that are passed to a procedure and receive results.
Formal parameters are the placeholders for the values of actual parameters