DB2 Stored Procedures and Oracle Database Fundamentals

Covers DB2 stored procedure development, debugging, data types, transactions, and Oracle database concepts including tablespace management, access methods, and SQL functions.

19 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

You can declare this only by using table contraint syntax

  1. Not NULL
  2. Primary key
  3. Foreign key
  4. Composite primary keys
Question 2 Multiple Choice (Single Answer)

Which character is used to continue a statement in SQL*Plus?

  1. *
  2. /
  3. -
  4. =
Question 3 Multiple Choice (Single Answer)

Which character function can be used to return a specified portion of a character string

  1. INSTR
  2. SUBSTRING
  3. SUBSTR
  4. POS
Question 4 Multiple Choice (Single Answer)

Which Oracle access method is the fastest way for Oracle to retrieve a single row?

  1. Primary key access
  2. Access via unique index
  3. Table access by ROWID
  4. Full table scan
Question 5 Multiple Choice (Single Answer)

When a user creates an object without a TABLESPACE clause, where will Oracle store the segment?

  1. System tablespace
  2. Users tablespace
  3. Default tablespace for the user
  4. Undefined
Question 6 Multiple Choice (Single Answer)

To produce a meaningful result set without any cartesian products, what is the minimum number of conditions that should appear in the WHERE clause of a four-table join?

  1. 8
  2. 3
  3. 2
  4. 4
Question 7 Multiple Choice (Single Answer)

To use Global temporary tables in a compound statement you require which type of tablespace to be present

  1. User temporary
  2. Large
  3. System
  4. Regular
Question 8 Multiple Choice (Single Answer)

Which of the following is not true for Stored Procedures?

  1. Simplifies code reuse, code standardization and code maintenance
  2. Controlled access to other database objects
  3. Improving application performance
  4. DB2 Stored Procedures can be written only in SQL.
Question 9 Multiple Choice (Single Answer)

GET DIAGNOSTICS

  1. Is used to obtain info about the previous executed sql statement
  2. Analyze the db2diag error messages
  3. Returns the user ID calling the stored proc
  4. Gives the access plan of the packages
Question 10 Multiple Choice (Single Answer)

CREATE PROCEDURE wise.Test123 (IN VAR1 INTEGER) P1: BEGIN DECLARE C1 CURSOR WITH RETURN TO CLIENT FOR SELECT DISTINCT NO FROM (VALUES (1),(2),(3),(3),(2)) AS TEST (NO); SET VAR1= VAR1 * VAR1 +VAR1; END P1@ What happens when you call wise.Test123 (10)

  1. Return Status = 0
  2. 3 rows returned by result-set
  3. 5 rows returned by result-set
  4. 110
Question 11 Multiple Choice (Single Answer)

A file rahul.db2 has following content : Drop procedure rahul ( ) @ Create procedure rahul ( ) P1: begin Declare c1 cursor with return to client for Select current date from sysibm.sysdummy1; Open c1; End P1 @ What will following command do when fired on db2 command linedb2 –td@ -f rahul.db2

  1. NO SQL
  2. CONTAINS SQL
  3. READS SQL
  4. MODIFIES SQL
Question 12 Multiple Choice (Single Answer)

Which of the following can be a user defined SQLSTATE

  1. 20000
  2. 35000
  3. 60000
  4. 71000
Question 13 Multiple Choice (Single Answer)

A Simple stored procedure is created with Dynamic Result sets 3 However only 2 cursors with return to client are defined within the source code. What will happen when you call the SP ?

  1. Will executes successfully
  2. Fails as limit is 3 but only 2 opened
  3. Executes with warning
  4. Would not allow compiling the SP at the first place
Question 14 Multiple Choice (Single Answer)

What one is valid special register?

  1. CURRENT_CLIENT_ACCT
  2. CURRENT_SCHEMA
  3. CURRENT_DATETIME
  4. CURRENT_PARTITION
Question 15 Multiple Choice (Single Answer)

What will be the initial value of V_MAX in the declaration statement shown below? DECLARE v_max DECIMAL(9,2);

  1. 0.0
  2. 2
  3. 9
  4. Null
Question 16 Multiple Choice (Single Answer)

Which is not a valid data type in DB2 LUW?

  1. BIGINT
  2. DECFLOAT
  3. XML
  4. DATETIME
Question 17 Multiple Choice (Single Answer)

CREATE PROCEDURE testproc( IN i1 INT, INOUT i3 INT) SPECIFIC testproc BEGIN SET i3 = i1; END @ CREATE PROCEDURE testproc( IN i1 INT, INOUT i2 INT, INOUT i3 INT) SPECIFIC testp BEGIN SET i3 = i1 * i2; END @ Given that the statements in the exhibits have executed successfully, which solution contains the complete set of commands that could be used to drop both procedures in the order presented?

  1. DROP PROCEDURE testp; DROP PROCEDURE testp;
  2. DROP PROCEDURE testp; DROP PROCEDURE testproc;
  3. DROP SPECIFIC PROCEDURE testproc; DROP PROCEDURE testproc;
  4. DROP PROCEDURE testproc(INT); DROP PROCEDURE testproc(INT);
Question 18 Multiple Choice (Single Answer)

CREATE PROCEDURE p1() BEGIN CREATE TABLE T1 (C1 CHAR); INSERT INTO T1 VALUES ('A'); SAVEPOINT SAVEPOINT1 ON ROLLBACK RETAIN CURSORS; INSERT INTO T1 VALUES ('B'); SAVEPOINT SAVEPOINT2 ON ROLLBACK RETAIN CURSORS; INSERT INTO T1 VALUES ('C'); SAVEPOINT SAVEPOINT3 ON ROLLBACK RETAIN CURSORS; INSERT INTO T1 VALUES ('D'); ROLLBACK TO SAVEPOINT SAVEPOINT3; ROLLBACK TO SAVEPOINT SAVEPOINT1; COMMIT WORK; INSERT INTO T1 VALUES ('E'); END@ Call p1() @ How many rows will be present in Table T1

  1. 0
  2. 1 (A)
  3. 5 (A,B,C,D,E)
  4. 2 (A,E)
Question 19 Multiple Choice (Single Answer)

Which IBM tool can you use to debug stored procedure?

  1. Control centre
  2. IBM Data studio
  3. Visual Explain
  4. Command editor