Computer Knowledge
Database and SQL
4,213 Questions
Master structured query language commands, database joins, table constraints, and alias generation. This section covers relational database management concepts and query outputs essential for technical aptitude. These technical questions feature prominently in banking IT officer exams and computer knowledge sections.
SQL queries and aliasesDatabase table constraintsDatabase joins and transformationsStored procedures and functions
Database and SQL Questions
-
It defines the user-defined error message.
-
The syntax for this procedure is raise_application_error(error_number, message).
-
By using this procedure, all the uncommitted transactions within the PL/SQL block are rolled back automatically.
-
RAISE_APPLICATION_ERROR raises an exception but does not handle it.
-
Both (2) and (4)
B
Correct answer
Explanation
The correct syntax is: raise_application_error(error_number, message[, {TRUE | FALSE}]); where error_number is a negative integer in the range -20000 -20999 and message is a character string up to 2048 bytes long.
-
It returns the invalid cursor error in case of cursor is not declared.
-
It returns the number of rows fetched.
-
An iteration gives the count of rows for the defined cursor.
-
It returns TRUE if a successful fetch has been executed.
-
If no row is returned, then this function returns an error.
D
Correct answer
Explanation
This is false as it does not return this value in case of successful fetched of row.
-
It returns the error number for the latest occurred exception in the PL/SQL block.
-
It returns the error message associated with the later error number.
-
It provides details about the error message.
-
It provides details on the line containing the error.
-
It retunes the error details about the DML statements.
C
Correct answer
Explanation
This is correct about this function.
-
FETCH cursor before opening the cursor.
-
CLOSE cursor before opening the cursor.
-
FETCH cursor after closing the cursor.
-
It is raised when a database call is issued without being connected to the database.
-
None of the above
D
Correct answer
Explanation
This condition is not responsible for invalid cursor error in PL/SQL. It is raised when attempts are made to make a cursor operation that is not allowed.
-
Returns INVALID_CURSOR if cursor is declared, but not open or if cursor has been closed.
-
Returns NULL if cursor is open, but fetch has not been executed.
-
Returns TRUE if a successful fetch has been executed.
-
Returns FALSE if no row was returned.
-
Returns the number of rows fetched.
E
Correct answer
Explanation
Yes, it is correct as it does not return the number of rows to be fetched.
-
PROGRAM_ERROR
-
NO_DATA_FOUND
-
SELF_IS_NULL
-
ACCESS_INTO_NULL
-
None of the above
E
Correct answer
Explanation
STORAGE_ERROR is raised when PL/SQL ran out of memory or memory was corrupted.
-
It is used to specify the priority that the redo information for the committed transaction is to be written to the redo log.
-
It is used to force the commit of a transaction that may be corrupt or in doubt.
-
It is used to specify a comment to be associated with current transaction.
-
This clause is optional.
-
Both (1) and (4)
E
Correct answer
Explanation
These are correct statements about 'WRITE clause' in PL/SQL COMMIT statement.
-
These types of parameters are used to send values and get values from stored procedures.
-
This parameter is used if the value of the parameter will be changed in the procedure.
-
This is a write-only parameter, i.e. one cannot pass values to OUT paramters while executing the stored procedure.
-
This parameters is used to send only the OUTPUT from a procedure or a function.
-
Both (1) and (2)
E
Correct answer
Explanation
Both are correct statements about ' IN OUT Parameter' in PL/SQL procedure.
-
This clause is used with update triggers.
-
It creates a trigger with the given name or overwrites an existing trigger with the same name.
-
This clause is used to reference the old and new values of the data being changed.
-
This clause is used to determine whether a trigger must fire when each row gets affected.
-
This clause is valid only for row level triggers.
A
Correct answer
Explanation
This clause is used when one wants to trigger an event only when a specific column is updated.
-
If a transaction attempts to update a resource that has been updated by another transaction and uncommitted, the transaction will fail.
-
It is used to release the lock for the multiple transactions allocated for the same resource.
-
It assigns a name to the transaction identified by 'transaction_name'.
-
It assigns a name to the transaction identified by 'transaction_name'.
-
None of the above
B
Correct answer
Explanation
This is called 'ISOLATION LEVEL READ COMMITTED ' clause and if a transaction requires row locks held by another transaction, the transaction will wait until the row locks are released.
-
Bracketed key
-
Indented key
-
Candidate key
-
Foreign key
A
Correct answer
Explanation
In this identification key, the number on the right side indicates the next alternative character for consideration.
-
Continue statement
-
Return statement
-
Break statement
-
PreparedStatement
-
ProtectedData
A
Correct answer
Explanation
This statement passes control to the next iteration of the enclosing iteration statement in which it appears.
-
active name table
-
active normal table
-
action name table
-
none of these
A
Correct answer
Explanation
ANT stands for Active Name Table, which stores information about the names of files currently active in the system.
-
unlock the database
-
provide a map of the data
-
uniquely identify a record
-
establish constraints on database operations.
-
None of these
-
unlock the database
-
provide a map of the data
-
uniquely identify a record
-
establish constraints on database operations.
-
None of these