databases Online Quiz - 34
|Description: databases Online Quiz - 34|
|Number of Questions: 20|
|Created by: Aliensbrain Bot|
What SYSTEM VARIABLE is used to refer DATABASE TIME ?
CREATE OR REPLACE FUNCTION CALC_PLAYER_AVG (V_ID in PLAYER_BAT_STAT.PLAYER_ID%TYPE) RETURN NUMBER IS V_AVG NUMBER; BEGIN SELECT HITS / AT_BATS INTO V_AVG FROM PLAYER_BAT_STAT WHERE PLAYER_ID = V_ID; RETURN (V_AVG); END; Which statement will successfully invoke this function in SQL *Plus
To answer this question, let's go through each option to understand why it is correct or incorrect:
Option A) SELECT CALC_PLAYER_AVG(PLAYER_ID) FROM PLAYER_BAT_STAT; This option is correct because it correctly invokes the function CALC_PLAYER_AVG by passing the PLAYER_ID column from the PLAYER_BAT_STAT table as the argument.
Option B) EXECUTE CALC_PLAYER_AVG(31); This option is incorrect because the EXECUTE statement is not supported in SQL *Plus. Instead, you should use a SELECT statement to invoke the function.
Option C) CALC_PLAYER('RUTH'); This option is incorrect because it does not match the function name. The correct function name is CALC_PLAYER_AVG.
Option D) CALC_PLAYER_AVG(31); This option is incorrect because it does not include the necessary SELECT statement to invoke the function. The correct syntax is to use a SELECT statement as shown in option A.
The correct answer is A. This option is correct because it uses the correct function name and syntax to invoke the function CALC_PLAYER_AVG.
Which is the true statements about dependent objects?
You have created a stored procedure DELETE_TEMP_TABLE that uses dynamic SQL to remove a table in your schema. You have granted the EXECUTE privilege to user A on this procedure. When user A executes the DELETE_TEMP_TABLE procedure, under whose privileges are the operations performed by default?
CREATE OR REPLACE PRODECURE add_dept (p_dept_name VARCHAR2 DEFAULT ‘placeholder’, p_location VARCHAR2 DEFAULT ‘Boston’) IS BEGIN INSERT INTO departments VALUES (dept_id_seq.NEXTVAL, p_dept_name, p_location); END add_dept; / Which is invalid call to the add_dep procedure? (Choose three
To answer this question, the user needs to understand the concept of package variables in PL/SQL.
Package variables are variables that are declared in the package specification and can be accessed by any subprogram or procedure defined in the package. The state of a package variable after executing the package depends on its type.
Option A is correct. Package variables persist across transactions within a session. This means that the value of a package variable remains the same during the lifetime of the session, even if multiple transactions are executed. The value of the variable can be changed by any subprogram or procedure defined in the package.
Option B is incorrect. Package variables do not persist from session to session for the same user. When a user logs out of the session and logs back in, the package variable is reinitialized with its default value.
Option C is incorrect. Package variables persist across transactions within a session. The value of a package variable remains the same during the lifetime of the session, even if multiple transactions are executed.
Option D is incorrect. Package variables do not persist from user to user when the package is invoked. When a different user invokes the package, the package variable is reinitialized with its default value.
Therefore, the correct answer is:
The Answer is: A
What part of a database trigger determines the number of times the trigger body executes?
To answer this question, you need to understand the different components of a database trigger.
A database trigger is a stored program that automatically executes in response to an event, such as a data modification operation (insert, update, delete) performed on a specified table. The trigger consists of three main parts: the trigger event, the trigger timing, and the trigger body.
The trigger event (option C) determines when the trigger should execute, such as before or after an insert, update, or delete operation on a table.
The trigger timing (option D) determines whether the trigger executes before or after the triggering event occurs.
The trigger body (option B) contains the code or instructions that are executed when the trigger is fired.
The part of a database trigger that determines the number of times the trigger body executes is the trigger type (option A). The trigger type specifies whether the trigger is a row-level trigger or a statement-level trigger.
- A row-level trigger executes once for each row affected by the triggering event.
- A statement-level trigger executes once for each triggering event, regardless of the number of rows affected.
Therefore, the correct answer is option A) Trigger type. This option is correct because the trigger type determines the number of times the trigger body executes.
"A student has such attributes as name, address, and gender. A student can also attend a graduate, undergraduate, or elective class that has the following attributes: class name, section name, major, and instructor. Based on the scenario above, which is the composite key in a junction table if many students can attend many classes?