0

databases Online Quiz - 172

Description: databases Online Quiz - 172
Number of Questions: 20
Created by:
Tags: databases
Attempted 0/20 Correct 0 Score 0

Examine this code: CREATE OR REPLACE FUNCTION gen_email_name (p_first_name VARCHAR2, p_last_name VARCHAR2, p_id NUMBER) RETURN VARCHAR2 is v_email_name VARCHAR2(19); BEGIN v_email_home := SUBSTR(p_first_name, 1, 1) || SUBSTR(p_last_name, 1, 7) || [email protected] .; UPDATE employees SET email = v_email_name WHERE employee_id = p_id; RETURN v_email_name; END; You run this SELECT statement: SELECT first_name, last_name gen_email_name(first_name, last_name, 108) EMAIL FROM employees; What occurs?

  1. Employee 108 has his email name updated based on the return result of the function.

  2. The statement fails because functions called from SQL expressions cannot perform DML.

  3. The statement fails because the functions does not contain code to end the transaction.

  4. The SQL statement executes successfully, because UPDATE and DELETE statements are ignoring in stored functions called from SQL expressions.

  5. The SQL statement executes successfully and control is passed to the calling environment.


Correct Option: B
  1. You need to execute the command CALCTAX(1000); .

  2. You need to execute the command EXECUTE FUNCTION calc tax; .

  3. You need to create a SQL *Plus environment variable X and issue the command :X := CALCTAX(1000); .

  4. You need to create a SQL *Plus environment variable X and issue the command EXECUTE :X := CALCTAX;

  5. You need to create a SQL *Plus environment variable X and issue the command EXECUTE :X := CALCTAX(1000);


Correct Option: E
  1. Use a drop procedure statement to drop a standalone procedure.

  2. Use a drop procedure statement to drop a procedure that is part of a package. Then recompile the package specification.

  3. Use a drop procedure statement to drop a procedure that is part of a package. Then recompile the package body.

  4. For faster removal and re-creation, do not use a drop procedure statement. Instead, recompile the procedure using the alter procedure statement with the REUSE SETTINGS clause.


Correct Option: A

Which type of argument passes a value from a calling environment?

  1. VARCHAR2.

  2. BOOLEAN.

  3. OUT.

  4. IN.


Correct Option: D
  1. When the procedure contains no SQL statements.

  2. When the procedure contains no PL/SQL commands.

  3. When the procedure needs to be used by many client applications accessing several remote databases.

  4. When the procedure needs to be used by many users accessing the same schema objects on a local database.


Correct Option: D

Examine this package body:CREATE OR REPLACE PACKAGE BODY forward_packISV_sum NUMBER;- 44 -PROCEDURE calc_ord(. . . );PROCEDURE generate_summary(. . . )ISBEGINCalc_ord(. . . );. . .END calc_ord;END forward_pack;/ Which construct has a forward declaration?

  1. V_SUM

  2. CALC_ORD.

  3. FORWARD_PACK

  4. GENERATE_SUMMARY.


Correct Option: B
  1. When declaring arguments length is not allowed.

  2. When declaring arguments each argument must have a mode specified.

  3. When declaring arguments each argument must have a length specified.

  4. When declaring a VARCHAR2 argument it must be specified.


Correct Option: A

All users currently have the INSERT privileges on the PLAYER table. You want only your users to insert into this table using the ADD_PLAYER procedure. Which two actions must you take? (Choose two)

  1. a) GRANT SELECT ON ADD_PLAYER TO PUBLIC;

  2. b) GRANT EXECUTE ON ADD_PLAYER TO PUBLIC;

  3. c) GRANT INSERT ON PLAYER TO PUBLIC;

  4. d) GRANT EXECUTE, INSERT ON ADD_PLAYER TO PUBLIC;

  5. e) REVOKE INSERT ON PLAYER FROM PUBLIC;


Correct Option: B,E

The PROCEDURE_ADD_PRODUCT is defined within a package specifications as follows: PROCEDURE_ADD_PRODUCT (P_PRODNO NUMBER,P_PRODNAME VARCHER2); Which procedure declaration can’t be added to package specifications?

  1. a) PROCEDURE add_product (p_order_date DATE);

  2. b) PROCEDURE add_product (p_name VARCHER2, P_ORDERED DATE);

  3. c) PROCEDURE add_product (p_prodname VARCHER2, P_PRISE NUMBER);

  4. d) PROCEDURE add_product (p_prize NUMBER, P_DESCRIPTION VARCHER2);


Correct Option: D

Command to see the current user ?

  1. show users;

  2. display user;

  3. show name;

  4. show user;


Correct Option: D

Command to change SQL prompt name ?

  1. SQL> set sqlprompt “Qwest > “

  2. SQL> set prompt “Qwest > “

  3. SQL> sqlprompt set “Qwest > “

  4. SQL> prompt “Qwest > “


Correct Option: A

Command to switch to UNIX prompt ?

  1. bye

  2. end

  3. host

  4. None of above


Correct Option: C

Which one of the following is not an Explicit Cursor attributes

  1. cursor_name%Found

  2. cursor_name%NOTFOUND

  3. cursor_name%OPEN

  4. cursor_name%ROWCOUNT


Correct Option: C
  1. SQL%Found

  2. SQL%ISOPEN

  3. SQL%NOTFOUND

  4. SQL%ROWCOUNT


Correct Option: B
- Hide questions