databases Online Quiz - 114
|Description: databases Online Quiz - 114|
|Number of Questions: 20|
|Created by: Aliensbrain Bot|
Which clause in a query limits the rows selected?
The INTO clause is mandatory for SELECT statements within PL/SQL blocks.
PL/SQL blocks may be nested within exception block.
The following block statement will run successfully SCOTT.EMP.EMPNO := 1234;
5 + NULL evaluates to 5 and ‘PL/’ || NULL || ‘SQL’ evaluates to ‘PL/SQL’
what is the concatenation operator in dbms_output.put_line() function
what will be the output of the following block: set serveroutput on; declare a int; b int; begin a:=NULL; b:=NULL; if a< b then dbms_output.put_line('y'); else dbms_output.put_line('n'); end if; end;
To answer this question, let's go through the code step by step:
set serveroutput on;enables the output display in Oracle.
declareis used to declare variables within the block.
The value of
bare set to
ifstatement checks if
ais less than
b. Since both
NULL, the condition evaluates to
NULLis considered an unknown value. When comparing
NULLwith any other value, the result is always
elsepart of the
ifstatement is executed because the condition is not satisfied. It prints 'n' using the
end if;marks the end of the
Based on the above explanation, the correct answer is:
Option B) n
which statement is used to break a loop in pl/sql
which of the following lines is invalid: FOR i IN 1…256 LOOP --Line 1 x := x + i ; --Line 2 i := I + 5; --Line 3 END LOOP; --Line 4
which of the following is not an explicit cursor attribute
To answer this question, we need to understand the concept of explicit cursor attributes in Oracle.
Explicit cursors are used to retrieve and manipulate data from a query. They have certain attributes that can provide information about the cursor. The available explicit cursor attributes in Oracle are:
A) %NOTFOUND - This attribute returns TRUE if the last fetch did not return a row, and FALSE otherwise.
B) %ROWCOUNT - This attribute returns the number of rows fetched so far from the cursor.
C) %ISOPEN - This attribute returns TRUE if the cursor is open, and FALSE otherwise.
D) %ISCLOSE - This attribute is not a valid explicit cursor attribute in Oracle. Therefore, option D is the correct answer.
The correct answer is D) %ISCLOSE, as it is not an explicit cursor attribute in Oracle.
DUP_VAL_ON_INDEX corressponds to which of the following error.
Which Database is oldest database in world ?
Which of the following statements contains an error?
The user issues the following statement. What will be displayed if the EMPID selected is 60494? SELECT DECODE(empid,38475, “Terminated”,60494, “LOA”, “ACTIVE”) FROM emp;
To answer this question, let's analyze the given SQL statement:
SELECT DECODE(empid,38475, "Terminated",60494, "LOA", "ACTIVE") FROM emp;
DECODE function in SQL is used to compare an expression (in this case,
empid) with a list of values and return a corresponding result.
In the given statement, the
empid is compared to three values: 38475, 60494, and the default value "ACTIVE".
empid matches 38475, the result will be "Terminated". If the
empid matches 60494, the result will be "LOA". If the
empid does not match any of these values, the result will be "ACTIVE".
In this case, the
empid selected is 60494. Therefore, the result of the statement will be "LOA".
So, the correct answer is B) LOA.
The default character for specifying runtime variables in SELECT statements is :-
Creating a foreign-key constraint between columns of two tables defined with two different datatypes will produce an error.
SELECT (TO_CHAR(NVL(SQRT(59483), “INVALID”)) FROM DUAL is a valid SQL statement.
Which function below can best be categorized as similar in function to an IF-THEN-ELSE statement?
MAXVALUE is a valid parameter for sequence creation.
Dropping a table has which of the following effects on a nonunique index created for the table?
To answer this question, we need to understand what happens to a nonunique index when a table is dropped.
Option A) No effect - This option is incorrect because dropping a table does have an effect on the index.
Option B) The index will be rendered invalid - This option is incorrect. When a table is dropped, the index is not rendered invalid. It is either dropped or remains intact.
Option C) The index will be dropped - This option is correct. When a table is dropped, all associated indexes are also dropped. This includes nonunique indexes created for the table.
Option D) The index will contain NULL values - This option is incorrect. Dropping a table does not affect the existing values in the index. Instead, the index itself is either dropped or remains intact.
The correct answer is C) The index will be dropped. This option is correct because when a table is dropped, all associated indexes, including nonunique indexes, are also dropped.