+ All Categories

000-545

Date post: 13-Apr-2015
Category:
Upload: vasuki-boopathy
View: 51 times
Download: 1 times
Share this document with a friend
Description:
DB2 SQL 9.5 Procedures dump
58
QUESTION NO: 1 A developer needs to create a user-defined function that will return a list of employees who work in a particular department. Which statement will successfully create a function that meets this objective? A. CREATE FUNCTIONdept_employees (deptno CHAR(3)) RETURNS TABLE LANGUAGE SQL READS SQL DATA RETURN SELECT empno, lastname AS l_name, firstnme AS f_name FROM employee WHERE employee.workdept = dept_employees.deptno B. CREATE FUNCTIONdept_employees (deptno CHAR(3)) RETURNS TABLE DYNAMIC RESULT SETS 1 LANGUAGE SQL READS SQL DATA DECLARE emp_info CURSOR WITH RETURN FOR SELECT empno, lastname AS l_name, firstnme AS f_name FROM employee WHERE employee.workdept = dept_employees.deptno OPEN emp_info; RETURN C. CREATE FUNCTIONdept_employees (deptno CHAR(3)) RETURNS TABLE (empno CHAR(6), l_nameVARCHAR(15), f_nameVARCHAR(12)) LANGUAGE SQL READS SQL DATA RETURN SELECT empno, lastname AS l_name, firstnme AS f_name FROM employee WHERE employee.workdept = dept_employees.deptno D. CREATE FUNCTIONdept_employees (deptno CHAR(3)) RETURNS TABLE (empno CHAR(6), l_nameVARCHAR(15), f_nameVARCHAR(12)) DYNAMIC RESULT SETS 1 LANGUAGE SQL READS SQL DATA DECLARE emp_info CURSOR WITH RETURN FOR IBM 000-545: Practice Exam "Pass Any Exam. Any Time." - 100% Guaranteed 2
Transcript
Page 1: 000-545

QUESTION NO: 1

A developer needs to create a user-defined function that will return a list of employees who work in

a particular department. Which statement will successfully create a function that meets this

objective?

A. CREATE FUNCTIONdept_employees (deptno CHAR(3))

RETURNS TABLE

LANGUAGE SQL

READS SQL DATA

RETURN

SELECT empno, lastname AS l_name, firstnme AS f_name

FROM employee

WHERE employee.workdept = dept_employees.deptno

B. CREATE FUNCTIONdept_employees (deptno CHAR(3))

RETURNS TABLE

DYNAMIC RESULT SETS 1

LANGUAGE SQL

READS SQL DATA

DECLARE emp_info CURSOR WITH RETURN FOR

SELECT empno, lastname AS l_name, firstnme AS f_name

FROM employee

WHERE employee.workdept = dept_employees.deptno

OPEN emp_info;

RETURN

C. CREATE FUNCTIONdept_employees (deptno CHAR(3))

RETURNS TABLE (empno CHAR(6),

l_nameVARCHAR(15),

f_nameVARCHAR(12))

LANGUAGE SQL

READS SQL DATA

RETURN

SELECT empno, lastname AS l_name, firstnme AS f_name

FROM employee

WHERE employee.workdept = dept_employees.deptno

D. CREATE FUNCTIONdept_employees (deptno CHAR(3))

RETURNS TABLE (empno CHAR(6),

l_nameVARCHAR(15),

f_nameVARCHAR(12))

DYNAMIC RESULT SETS 1

LANGUAGE SQL

READS SQL DATA

DECLARE emp_info CURSOR WITH RETURN FOR

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 2

Page 2: 000-545

SELECT empno, lastname AS l_name, firstnme AS f_name

FROM employee

WHERE employee.workdept = dept_employees.deptno

OPEN emp_info;

RETURN

Answer: C

QUESTION NO: 2

In the function shown below:

Which statement can be used to invoke the function above?

A. SELECT * FROMTABLE(fcn1('B01'))

B. SELECTTABLE(fcn1('B01')) FROM SYSIBM.SYSDUMMY1

C. SELECT * FROMfcn1('B01')

D. SELECTfcn1('B01') FROM SYSIBM.SYSDUMMY1

Answer: A

QUESTION NO: 3

Which statement correctly describes characteristics of external functions?

A. External functions cannot return tables.

B. All cursors opened within an external function should stay open until the database isquiesced.

C. Scratchpads can be used to allocate dynamic memory required for multiple function

invocations.

D. Transactions can be terminated within external functions.

Answer: C

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 3

Page 3: 000-545

QUESTION NO: 4

Click the Exhibit button.

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 4

Page 4: 000-545

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 5

Page 5: 000-545

Referring to the exhibit, how many rows will be returned by the SQL query shown below? SELECT

* FROM TABLE(getnumemployee(21?) AS dSELECT * FROM TABLE(getnumemployee(?21?) AS

d

A. 0

B. 1

C. 7

D. 10

Answer: C

QUESTION NO: 5

Which three optional clauses can be used when creating an external function? (Choose three.)

A. SCRATCHPAD

B. NOTEPAD

C. LANGUAGE

D. EXTERNAL NAME

E. DATABASEINFO

Answer: A,C,D

QUESTION NO: 6

Which statement is permitted within a scalar user-defined function body?

A. COMMIT

B. INSERT

C. SIGNAL

D. LOOP

Answer: C

QUESTION NO: 7

Click the Exhibit button.

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 6

Page 6: 000-545

A user-defined function was created using the statement shown in the exhibit. Which additional

option can be added to the CREATE FUNCTION statement to tell the optimizer that the function

does not always return the same results for a given argument value?

A. NO EXTERNAL ACTION

B. NOT FENCED

C. NOT DETERMINISTIC

D. STATIC DISPATCH

Answer: C

QUESTION NO: 8

Given the following SQL:

Which statement is incorrect?

A. The procedure declaration requires the DYNAMIC RESULT SETS 1 clause in order to return a

result set.

B. The cursor declaration requires the WITH RETURN TO CLIENT clause in order to return a

result set.

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 7

Page 7: 000-545

C. The cursor declaration requires the WITH RETURN TO CALLER clause in order to return a

result set.

D. The cursor declaration requires the WITH RETURN clause in order to return a result set.

Answer: A

QUESTION NO: 9

Given the following SQL:

Which of the following statements is true?

A. The procedure declaration requires the DYNAMIC RESULT SETS 1 clause in order to return a

result set.

B. The cursor declaration requires WITH RETURN TO CLIENT clause in order to return a result

set.

C. The cursor declaration requires WITH RETURN TO CALLER clause in order to return a result

set.

D. The cursor declaration requires WITH RETURN clause in order to return a result set.

Answer: B

QUESTION NO: 10

In the stored procedure below:

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 8

Page 8: 000-545

What will the value of the P_ID parameter be if the procedure is invoked and a value of 2 is

specified for the START_VALUE parameter?

A. 1

B. 2

C. 3

D. 4

Answer: C

QUESTION NO: 11

Which procedure demonstrates the correct use of dynamic SQL?

A. CREATE PROCEDURE update_count1 (INnew_count INTEGER, IN item_code INTEGER)

BEGIN

DECLARE v_dynSQL VARCHAR(200);

SET v_dynSQL = 'UPDATE stock SET quantity_on_hand=? WHERE item_number=?';

PREPARE v_stmt1 FROM v_dynSQL;

EXECUTE v_stmt1 USING new_count, item_code;

END

B. CREATE PROCEDURE update_count2 (INtab_name VARCHAR(128), IN new_count

INTEGER, IN item_code INTEGER)

BEGIN

DECLARE v_dynSQL VARCHAR(200);

SET v_dynSQL = 'UPDATE ? SET quantity_on_hand=? WHERE item_number=?';

PREPARE v_stmt1 FROM v_dynSQL;

EXECUTE v_stmt1 USING tab_name, new_count, item_code;

END

C. CREATE PROCEDURE update_count4 (INtab_name VARCHAR(128), IN col_name1

VARCHAR(128), IN col_name2 VARCHAR(128), IN

new_countINTEGER, IN item_code INTEGER)

BEGIN

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 9

Page 9: 000-545

DECLARE v_dynSQL VARCHAR(200);

SET v_dynSQL = 'UPDATE ? SET ?=? WHERE ?=?';

PREPARE v_stmt1 FROM v_dynSQL;

EXECUTE v_stmt1 USING tab_name, col_name1, new_count, col_name2, item_code;

END

D. CREATE PROCEDURE update_count5 (INnew_count INTEGER, IN item_code INTEGER)

BEGIN

DECLARE v_dynSQL VARCHAR(200);

DECLARE v_col_name VARCHAR(128);

SET v_col_name = 'item_number';

SET v_dynSQL = 'UPDATE stock SET quantity_on_hand=? WHERE ?=?';

PREPARE v_stmt1 FROM v_dynSQL;

EXECUTE v_stmt1 USING new_count, v_col_name, item_code;

END

Answer: A

QUESTION NO: 12

A developer wants to code the following statements in an SQL procedure:

What order must these statements be coded in?

A. 1, 2, 3, 4

B. 2, 4, 3, 1

C. 3, 4, 2, 1

D. 4, 3, 2, 1

Answer: B

QUESTION NO: 13

What is a reason to use SQL procedures in DB2?

A. to use different programming languages

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 10

Page 10: 000-545

B. to reduce code sharing

C. to move business logic rules into the database

D. to eliminate the need for testing

Answer: C

QUESTION NO: 14

Which SQL procedure declaration is coded correctly?

A. CREATE PROCEDUREmyproc(IN salary DOUBLE, OUT commission DOUBLE)

BEGIN

DECLARE EXIT HANDLER FOR SQLEXCEPTION

SET commission = 0;

DECLARE my_cur CURSOR FOR SELECT * FROM employee;

DECLARE a DOUBLE;

SET a = .06 * salary;

SET commission = a;

END

B. CREATE PROCEDUREmyproc(IN salary DOUBLE, OUT commission DOUBLE)

BEGIN

DECLARE EXIT HANDLER FOR SQLEXCEPTION

SET commission = 0;

DECLARE a DOUBLE;

DECLARE my_cur CURSOR FOR SELECT * FROM employee;

SET a = .06 * salary;

SET commission = a;

END

C. CREATE PROCEDUREmyproc(IN salary DOUBLE, OUT commission DOUBLE)

BEGIN

DECLARE a DOUBLE;

DECLARE EXIT HANDLER FOR SQLEXCEPTION

SET commission = 0;

DECLARE my_cur CURSOR FOR SELECT * FROM employee;

SET a = .06 * salary;

SET commission = a;

END

D. CREATE PROCEDUREmyproc(IN salary DOUBLE, OUT commission DOUBLE)

BEGIN

DECLARE a DOUBLE;

DECLARE my_cur CURSOR FOR SELECT * FROM employee;

DECLARE EXIT HANDLER FOR SQLEXCEPTION

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 11

Page 11: 000-545

SET commission = 0;

SET a = .06 * salary;

SET commission = a;

END

Answer: D

QUESTION NO: 15

The CREATE PROCEDURE statement shown below was executed against a database called

MYDB.

CREATE PROCEDURE myschema.proc1(IN p1 INTEGER, OUT p2 CHAR(4), OUT p3

SMALLINT)

BEGIN

SET p2 = 'abc';

END

Which two CREATE PROCEDURE statements, when executed against the same database, will

succeed? (Choose two.)

A. CREATE PROCEDUREmyschema.proc1(IN p1 CHAR(4), OUT p2 INTEGER)

BEGIN

SET p2 = 123;

END

B. CREATE PROCEDUREmyschema.proc1(IN p1 INTEGER, OUT p2 CHAR(4), OUT p3

CHAR(4))

BEGIN

SET p2 = 'abc';

END

C. CREATE PROCEDUREmyschema.proc1(IN p1 CHAR(4), OUT p2 INTEGER, OUT p3

SMALLINT)

BEGIN

SET p2 = 123;

END

D. CREATE PROCEDUREotherschema.proc1(IN p1 CHAR(4), OUT p2 CHAR(4), OUT p3

CHAR(4))

BEGIN

SET p2 = 'abc';

END

E. CREATE PROCEDUREmyschema.proc1(IN p1 NUMBER, OUT p2 NUMBER, OUT p3

NUMBER)

BEGIN

SET p2 = 'abc';

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 12

Page 12: 000-545

END

Answer: A,D

QUESTION NO: 16

If this statement was used to create an SQL procedure named P_EXIT:

What will the return status be?

A. 10

B. 20

C. 99

D. NULL

Answer: C

QUESTION NO: 17

The CREATE OR REPLACE PROCEDURE statement is similar semantically to which of the

following combined statements?

A. DROP and CREATE PROCEDURE

B. ALTER and CREATE PROCEDURE

C. UPDATE and CREATE PROCEDURE

D. DROP and ALTER PROCEDURE

Answer: A

QUESTION NO: 18

Given the two SQL procedures shown below:

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 13

Page 13: 000-545

What is the expected output if procedure S1 is invoked with the value 1 provided for parameter

V1?

A. NULL

B. 2

C. 5

D. 7

Answer: D

QUESTION NO: 19

Which CREATE PROCEDURE statement option should be used if you plan on issuing a

DECLARE GLOBAL TEMPORARY TABLE statement from within the SQL procedure body?

A. CONTAINS SQL

B. READS SQL DATA

C. MODIFIES SQL DATA

D. LANGUAGE SQL

Answer: C

QUESTION NO: 20

Click on the Exhibit button.

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 14

Page 14: 000-545

Referring to the exhibit, what is the OUT_PHONENUMBERS result set when the SQL procedure

is invoked by the call statement shown below?

CALL find_customers(ARRAY[?16-305-3745?

?05-416-4565?

?16-305-3746?

'905-414-4566'],

?16??)

A. [?16-305-3745??05-416-4565? ?16-305-3746']

B. [?16-305-3745??05-416-4565? ?16-305-3746? '905-414-4566']

C. [?05-416-4565? '905-414-4566']

D. [?16-305-3745? ?16-305-3746[?16-305-3745? ?16-305-3746?

Answer: D

QUESTION NO: 21

Which two statements are true with regards to nesting SQL procedures? (Choose two.)

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 15

Page 15: 000-545

A. An SQL procedure cannot invoke procedures built in other languages (e.g., C, Java).

B. An SQL procedure can invoke the same SQL procedure more than once.

C. An SQL procedure defined with the CONTAINS SQL clause can invoke an SQL procedure

defined with the READS SQL DATA clause.

D. An SQL procedure defined with the CONTAINS SQL clause can invoke an SQL procedure

defined with the MODIFIES SQL DATA clause.

E. An SQL procedure defined with the CONTAINS SQL clause can invoke an SQL procedure

defined with the NO SQL clause.

Answer: B,E

QUESTION NO: 22

Which statement can be used to define variable that can be shared between procedures?

A. DECLAREmy_gl_var INTEGER DEFAULT 1

B. CREATE OR REPLACE VARIABLEmy_gl_var INTEGER

C. DEFINE GLOBAL VARIABLEmy_gl_var INTEGER

D. CREATE GLOBAL VARIABLEmy_gl_var

Answer: B

QUESTION NO: 23

In which type of table space must global temporary tables be created?

A. REGULAR

B. LONG

C. SYSTEM TEMPORARY

D. USER TEMPORARY

Answer: D

QUESTION NO: 24

Which statement is true about the data types VARCHAR and VARCHAR2?

A. The VARCHAR data type cannot be used with a database that has been created in Oracle

compatibility mode.

B. The VARCHAR2 data type treats empty strings as null; the VARCHAR data type treats empty

strings as not null with zero length.

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 16

Page 16: 000-545

C. The VARCHAR2 data typelength is limited to 2000 bytes; the VARCHAR data type length can

be up to 32K.

D. The VARCHAR2 data type cannot be used in a database that has not been created in Oracle

compatibility mode.

Answer: B

QUESTION NO: 25

Which statement can be used to define an array of 30 names that have a maximum size of 25

characters each?

A. CREATE TYPE names ASVARCHAR(25) ARRAY[30];

B. CREATE ARRAYnames[30] VARCHAR(25);

C. CREATE TYPEnames[30] VARCHAR(25);

D. CREATE ARRAY names ASVARCHAR(25);

Answer: A

QUESTION NO: 26

In the code segment shown below:

Which statement accurately describes the result?

A. For activities whose description has not changed, update the description in the ARCHIVE table.

For new activities, insert into the ARCHIVE table. The ARCHIVE and ACTIVITIES table both have

ACTIVITY as a primary key.

B. For activities whose description has changed, update the description in the ARCHIVE table. For

new activities, insert into the ARCHIVE table. The ARCHIVE and ACTIVITIES table both have

ACTIVITY as a primary key.

C. For activities whose description has changed, update the description in the ACTIVITY table. For

new activities, insert into the ACTIVITIES table. The ARCHIVE and ACTIVITIES table both have

ACTIVITY as a primary key.

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 17

Page 17: 000-545

D. The statement will fail since MERGE is not a supported operator.

Answer: B

QUESTION NO: 27

Which of the following statements is true for declared global temporary tables?

A. Declared global temporary table descriptions are stored in the system catalog

B. When a session terminates, all declared global temporary tables created in the session are

dropped.

C. Declared global temporary tables are persistent and can be shared with multiple sessions.

D. Declared temporary tables support LONG VARCHAR columns.

Answer: B

QUESTION NO: 28

Using Optimistic Locking, both Transaction 1 and Transaction 2 have read the same row including

the RID_BIT and ROW CHANGE TOKEN values. Transaction 1 updates the row after ensuring

that the row has not changed after the previous SELECT by adding a RID_BIT and ROW

CHANGE TOKEN predicate to the UPDATE statement. Transaction 2 now tries to update that

same row using the same predicate as transaction 1. What will be the result?

A. The row will be found with the same ROW CHANGE TOKEN. Transaction 2 will now insert its

values replacing those of transaction 1.

B. The row will be found with a different ROW CHANGE TOKEN and Transaction 2 will overwrite

the values set in transaction 1.

C. The row will not be found because the value of the ROW CHANGE TOKEN has changed in

regard to the UPDATE of transaction 1. Transaction

2 has to retry in order to retrieve the current data.

D. The row will not be found because the value of the ROW CHANGE TOKEN has changed in

regard to the UPDATE of transaction 1. Transaction

2 will complete with an insert of a new row.

Answer: C

QUESTION NO: 29

What is correct use of the MODULE?

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 18

Page 18: 000-545

A. Encryption and encapsulation

B. Grouping object definitions together that has a common business purpose

C. Improving performance of transactions

D. Supporting referential integrity

Answer: B

QUESTION NO: 30

Which statement is TRUE about associative arrays?

A. Associative array values can be stored in table columns.

B. The index values for an associative array must be a continuous set of integer values.

C. Associative array cannot be a type of a table column.

D. The index data type for an associated array must be an integer.

Answer: C

QUESTION NO: 31

Given the following script:

What would be result from the SELECT * FROM audi1?

A. NLEVEL MESSAGE

----------- --------------------

1 FROM TRIGGER

B. NLEVEL MESSAGE

----------- --------------------

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 19

Page 19: 000-545

2 FROM TRIGGER

C. NLEVEL MESSAGE

----------- --------------------

2 TEST1

D. NLEVEL MESSAGE

----------- --------------------

5 FROM TRIGGER

Answer: B

QUESTION NO: 32

Which code fragment illustrates the proper way to capture and save SQL error handler values so

they can be used to control procedure logic?

A. DECLARE CONTINUE HANDLER FOR SQLEXCEPTION, SQLWARNING, NOT FOUND

SET retcode = SQLCODE;

B. DECLARE ERROR HANDLER FOR SQLEXCEPTION, SQLWARNING, NOT FOUND

SET retcode = EXCEPTION;

C. DECLARE ERROR HANDLING SQLEXCEPTION, SQLWARNING, NOT FOUND

SET retcode = SQLERRN;

D. DECLARE ERROR HANDLING FOR SQLEXCEPTION, SQLWARNING, NOT FOUND

SET retcode = SQLMSG;

Answer: A

QUESTION NO: 33

Given the following statements:

In the above given procedure, the statement in which line is not valid?

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 20

Page 20: 000-545

A. 1

B. 7

C. 9

D. 10

Answer: B

QUESTION NO: 34

Which statement can be used to declare a variable inside an SQL procedure that can be used to

represent a monetary value?

A. DECLAREv_money MONEY;

B. DECLAREv_money DOUBLE;

C. DECLAREv_money DECIMAL(9,2);

D. DECLAREv_money CURRENCY;

Answer: C

QUESTION NO: 35

Which statement will successfully create an SQL procedure that returns the name of the current

month?

A. CREATE PROCEDUREproc.current_month(OUT month VARCHAR(20))

BEGIN

DECLARE today DATE;

SET (today = CURRENT_DATE);

SET month = MONTHNAME(today);

END

B. CREATE PROCEDUREproc.current_month(OUT month VARCHAR(20))

BEGIN

DECLARE today DATE;

SELECT (CURRENT_DATE) INTO today;

SET month = MONTHNAME(today);

END

C. CREATE PROCEDUREproc.current_month(OUT month VARCHAR(20))

BEGIN

DECLARE today DATE;

VALUES (CURRENT_DATE) INTO today;

SET month = MONTHNAME(today);

END

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 21

Page 21: 000-545

D. CREATE PROCEDUREproc.current_month(OUT month VARCHAR(20))

BEGIN

SET month = MONTHNAME(SELECT (CURRENT_DATE))

END

Answer: C

QUESTION NO: 36

If table TAB1 were created as follows: CREATE TABLE tab1 (col1 INT NOT NULL); Which

statement illustrates the proper way to define an anchor variable that references column COL1 in

table TAB1?

A. DECLARE var1 REFERENCES tab1.col1

B. DECLARE var1 tab1.col1%TYPE

C. DECLARE var1 ANCHOR DATA TYPE TO tab1.col1

D. DECLARE var1 ANCHOR DATA TYPE TO tab1.col1%TYPE

Answer: C

QUESTION NO: 37

What values are generated each time an SQL statement is executed?

A. SQLERRN and SQLMSG

B. SQLSTATE and EXCEPTION

C. EXCEPTION and SQLCODE

D. SQLSTATE and SQLCODE

Answer: D

QUESTION NO: 38

Given the variable declaration shown below: DECLARE v_mydate DATE; Which statement will

assign a value to the variable V_MYDATE?

A. VALUES (08262010) INTOv_mydate;

B. VALUES CURRENT TIMESTAMP INTOv_mydate;

C. SELECT CURRENT TIMESTAMP INTOv_mydate FROM SYSIBM.SYSDUMMY1;

D. SELECT CURRENT DATE INTOv_mydate FROM SYSIBM.SYSDUMMY1;

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 22

Page 22: 000-545

Answer: D

QUESTION NO: 39

Which of the following statements is true?

A. A DATETIME value can be assigned to a DATE variable.

B. Values cannot be assigned to variables inside ERROR HANDLERS.

C. A TIMESTAMP value can be assigned to a TIME variable.

D. The result of a GET DIAGNOSTICS statement cannot be assigned to a variable.

Answer: C

QUESTION NO: 40

Assuming EMP_ROW and NEW_HIRE have the same user-defined row data type, what is the

best way to assign the elements of NEW_HIRE to EMP_ROW?

A. emp_row.rowid = new_hire.rowid;

B. emp_row.all = new_hire.all;

C. SETemp_row = new_hire;

D. SET emp_row.* = new_hire.*;

Answer: C

QUESTION NO: 41

In the given text below:

What will be the value of the output variable BONUS?

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 23

Page 23: 000-545

A. 500

B. 1000

C. 5200

D. 5500

Answer: A

QUESTION NO: 42

Assuming C1 and C2 are cursor type variables, which of the following operations cannot be

performed?

A. IF (c1 = c2)THEN ?END;

B. SET c2 = c1;

C. SET c1 = CURSOR FOR SELECT * FROM t;

D. SET c1 = CURSOR FOR VALUES ('a', 'b', 'c');

Answer: A

QUESTION NO: 43

The cursor BASEINFO was defined as follow:

Which statement would be used to create a local variable named BASEINFOROW that can be

used to store results from the BASEINFO cursor?

A. DEFINE ROWbaseinforow FOR CURSOR baseinfo

B. DECLARE ROW baseinforow ASSOCIATED WITH CURSOR baseinfo

C. DECLARE baseinforow ANCHOR ROW baseinfo

D. CREATE VARIABLEbaseinforow ASSOCIATED WITH baseinfo

Answer: C

QUESTION NO: 44

Click the Exhibit button.

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 24

Page 24: 000-545

The procedure TEST5 shown in the exhibit was invoked. How many rows will be added to the

DEPT table?

A. 1

B. 2

C. 3

D. 4

Answer: C

QUESTION NO: 45

Click the Exhibit button.

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 25

Page 25: 000-545

Which statement is true about the CASE statement shown in the exhibit?

A. An employee with a rating of 1 receives a 10% salary increase.

B. An employee with a rating of 3 receives no salary increase.

C. An employee with a rating of 2 receives a 3% salary increase.

D. All employees will receive at least a 5% salary increase.

Answer: A

QUESTION NO: 46

Which steps must be followed to return a result set from an SQL procedure?

A. 1. Create the procedure using the DYNAMIC RESULT SETS clause.

2. Declare the cursor.

3. Open the cursor in the SQL procedure.

4. Close the cursor.

5. Return to the application.

B. 1. Create the procedure using the DYNAMIC RESULT SETS clause.

2. Declare the cursor using the WITH RETURN clause.

3. Open the cursor in the SQL procedure.

4. Return to the application.

C. 1. Create the procedure using the WITH RETURN clause.

2. Declare the cursor using the DYNAMIC RESULT SETS clause.

3. Open the cursor in the SQL procedure.

4. Return to the application.

D. 1. Create the procedure using the WITH RETURN clause.

2. Declare the cursor using the DYNAMIC RESULT SETS clause.

3. Open the cursor in the SQL procedure.

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 26

Page 26: 000-545

4. Close the cursor.

Answer: B

QUESTION NO: 47

How is the FOR statement distinct from other conditional statements?

A. FOR statements are evaluated at the completionof each iteration of the loop.

B. FOR statements are evaluatedbefore each iteration of the loop.

C. FOR statements have a terminating condition clause.

D. FOR statements are used to iterate over rows in a defined read-only result set.

Answer: D

QUESTION NO: 48

Click the Exhibit button.

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 27

Page 27: 000-545

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 28

Page 28: 000-545

If the procedure TEST1 shown in the exhibit is called with the value 'A00' specified for the

SOMEID parameter, what is the expected return code?

A. 0

B. -1

C. -2

D. -3

Answer: A

QUESTION NO: 49

Click the Exhibit button.

Which statement correctly describes the result of the FOR loop shown in the exhibit?

A. FULLNAME is set to the last name of the employee, followed by a comma, the first name, a

blank space, and the middle initial. Only the last value for FULLNAME is inserted into table

TNAMES.

B. FULLNAME is set to the last name of the employee, followed by a comma, the first name, a

blank space, and the middle initial. Only the first value for FULLNAME is inserted into table

TNAMES.

C. FULLNAME is set to the last name of the employee, followed by a comma, the first name, a

blank space, and the middle initial for each row. Each value for FULLNAME is inserted into table

TNAMES in alphabetical order.

D. FULLNAME is set to the last name of the employee, followed by a comma, the first name, a

blank space, and the middle initial for each row. Each value for FULLNAME is inserted into table

TNAMES.

Answer: D

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 29

Page 29: 000-545

QUESTION NO: 50

Which tool can be used to get an Explain plan for all SQL statements used in a unit of work?

A. db2look

B. DB2 Command Center

C. Data Studio

D. db2exfmt

Answer: D

QUESTION NO: 51

What are two ways to execute an SQL procedure using IBM Data Studio? (Choose two.)

A. Open a SQL editor, enter the appropriate CALL statement and hit the Run button.

B. Right-click on the SQL procedure and select the Run option from the menu.

C. Open a Command Line Processor window from IBM Data Studio and execute the appropriate

CALL statement.

D. Open a text editor, enter the appropriate CALL statement and hit the run button.

E. Right-click on the SQL procedure and select the Open Visual Explain option from the menu.

Answer: A,B

QUESTION NO: 52

Which of the following can be done while debugging a SQL procedure with IBM Data Studio?

A. Change the order of statements being executed.

B. Edit the procedure and continue.

C. Change the value of any variables used.

D. Re-execute the current statement.

Answer: C

QUESTION NO: 53

Which action is supported by Data Studio in the SQL procedure lifecycle?

A. Create global temporary tables to use in the SQL procedure.

B. Debug the SQL procedure.

C. Use auto complete SQL statements.

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 30

Page 30: 000-545

D. Create user-define types in the SQL procedure.

Answer: B

QUESTION NO: 54

For which types of servers can you use IBM Data Studio to create and manage SQL procedures?

A. DB2 for LUW, DB2 for z/OS, Oracle

B. DB2 for LUW, DB2 for z/OS, SQL Server

C. DB2 for LUW, DB2 for z/OS,MySQL

D. DB2 for LUW, DB2 for z/OS, Sybase

Answer: A

QUESTION NO: 55

Which command can be used to convert literals in SQL statements to parameter markers to avoid

compilation of similar SQL statements?

A. UPDATE DB CFG USING STMT_CONC ON

B. UPDATE DB CFG USING LIT_PARM ON

C. UPDATE DB CFG USING CURSOR_SHARING FORCED

D. UPDATE DB CFG USING CURSOR_SHARING ON

Answer: A

QUESTION NO: 56

Click the Exhibit button.

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 31

Page 31: 000-545

The table and triggers in the exhibit have been created successfully, when the statements shown

below are executed.

INSERT INTO emp_hours VALUES('KAY', '9:00', '17:00');

INSERT INTO emp_hours (emp_name, starting) VALUES('BILL', '9:00');

What is the result?

A. Table EMP_HOURS will contain these rows:

KAY 9:00:00 AM 5:00:00 PM

BILL 9:00:00 AM 10:00:00 AM

B. Table EMP_HOURS will contain this row:

BILL 9:00:00 AM

C. Table EMP_HOURS will contain these rows:

KAY 9:00:00 AM 5:00:00 PM

BILL 9:00:00 AM

D. Table EMP_HOURS will contain this row:

BILL 9:00:00 AM 17:00:00 PM

Answer: A

QUESTION NO: 57

Which CREATE TRIGGER statement is valid?

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 32

Page 32: 000-545

A. CREATE TRIGGER test1

NO CASCADE AFTER INSERT ON employee

REFERENCING NEW AS n

FOR EACH ROW

MODE DB2SQL

WHEN (n.bonus IS NULL)

SET n.salary = n.salary + 2000

B. CREATE TRIGGER test1

NO CASCADE BEFORE INSERT ON employee

REFERENCING NEW AS n

FOR EACH ROW

MODE DB2SQL

WHEN (n.bonus IS NULL)

SET n.salary = n.salary + 2000

C. CREATE TRIGGER test1

AFTER DELETE ON employee

REFERENCING OLD_TABLE AS oldemployee

FOR EACH STATEMENT

MODE DB2SQL

DELETE FROM staff

WHERE id IN (SELECT empno FROM oldemployee)

D. CREATE TRIGGER test1

NO CASCASE BEFORE DELETE ON employee

FOR EACH STATEMENT

MODE DB2SQL

DELETE FROM staff

WHERE id IN (SELECT empno FROM oldemployee)

Answer: B

QUESTION NO: 58

Given the SQL statement shown below:

Which privilege allows a user to execute the CREATE TRIGGER statement shown?

A. SYSCTRL authority

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 33

Page 33: 000-545

B. SELECT and UPDATE privilege on the EMPLOYEE table

C. SYSMAINT authority

D. SELECT and ALTER privilege on the EMPLOYEE table

Answer: B

QUESTION NO: 59

A trigger was created using the CREATE TRIGGER statement shown below.

Which statement is true about the INCRS_COMM trigger?

A. The trigger will be executed if the STAFF table is populated by a load operation.

B. The trigger will be executed before a row is inserted into the STAFF table.

C. This trigger will be executed after a row is inserted into the STAFF table.

D. This trigger will increase the COMM value of a newly inserted row by 10 percent.

Answer: C

QUESTION NO: 60

Which SQL statement is allowed in a BEFORE trigger?

A. INSERT

B. CALL

C. MERGE

D. UPDATE

Answer: B

QUESTION NO: 61

Given the statement shown below:

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 34

Page 34: 000-545

What happens to NEWPROD if 'http://posample.org/product.xsd' is dropped?

A. NEWPROD will validate against a new schema.

B. NEWPROD will raise an exception.

C. NEWPROD is marked as inoperative.

D. NEWPROD is dropped.

Answer: C

QUESTION NO: 62

Given the function:

What is the output of the statement: VALUES LENGTH(fcn1(' one good day '))?

A. 'one good day'

B. 12

C. ' one goodday '

D. 14

Answer: B

QUESTION NO: 63

Click the Exhibit button.

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 35

Page 35: 000-545

A user-defined function was created using the statement shown in the exhibit. Which additional

option can be added to the CREATE FUNCTION statement to tell the optimizer that the function

does not always return the same results for a given argument value?

A. NO EXTERNAL ACTION

B. NOT FENCED

C. NOT DETERMINISTIC

D. STATIC DISPATCH

Answer: C

QUESTION NO: 64

Given the function shown below:

Which statement will execute successfully?

A. SELECTto_upper('Seize the day!')

B. SELECT * FROMto_upper_fcn('Seize the day!')

C. SELECTto_upper('Seize the day!') FROM SYSIBM.SYSDUMMY1;

D. SELECT * FROMTABLE(to_upper_fcn('Seize the day!')) AS T

Answer: C

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 36

Page 36: 000-545

QUESTION NO: 65

Click the Exhibit button.

An SQL function was created using the statement shown in the exhibit. Assume this function is

invoked by executing the SQL statement shown below:

VALUES e_degree(SMALLINT(17))

What will be returned?

A. SQL0440N No authorized routine named "E_DEGREE" of type "FUNCTION" having compatible

arguments was found. SQLSTATE=42884

B. 1

------------

BACHELOR

1 record(s) selected.

C. 1

------------

MASTER

1 record(s) selected.

D. 1

------------

UNKNOWN

1 record(s) selected.

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 37

Page 37: 000-545

Answer: D

QUESTION NO: 66

Which statement will create a scalar function named FCN1?

A. CREATE SCALAR FUNCTIONfcn1(v1 CHAR(3)) RETURNS CHAR(3) ?CREATE SCALAR

FUNCTION fcn1(v1 CHAR(3)) RETURNS CHAR(3)

B. CREATE FUNCTIONfcn1(v1 CHAR(3)) RETURNS ROW CONTAINING CHAR(3) ?CREATE

FUNCTION fcn1(v1 CHAR(3)) RETURNS ROW CONTAINING CHAR(3)

C. CREATE SCALAR FUNCTIONfcn1(v1 CHAR(3)) RETURNS ROW CONTAINING CHAR(3)

?CREATE SCALAR FUNCTION fcn1(v1 CHAR(3)) RETURNS ROW CONTAINING CHAR(3)

D. CREATE FUNCTIONfcn1(v1 CHAR(3)) RETURNS CHAR(3) ?CREATE FUNCTION fcn1(v1

CHAR(3)) RETURNS CHAR(3)

Answer: D

QUESTION NO: 67

Click the Exhibit button.

Given the user-defined function shown in the exhibit, what will the function return if invoked using

the statement shown below?

SELECT check_id(1) FROM SYSIBM.SYSDUMMY1

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 38

Page 38: 000-545

A. Error: ID 1 is not valid

B. Application Error

C. SQLSTATE 80000 will be returned, with the custom error message "Error: ID 1 is not valid"

D. NULL

Answer: D

QUESTION NO: 68

Which two statements are true when working with triggers? (Choose two.)

A. Triggers can be used to enforce data integrity rules.

B. Triggers can be used with both tables and views.

C. Triggers can be altered.

D. Triggers can be used on Materialized Query Tables.

E. Triggers can be used on Created Temporary Tables.

Answer: A,B

QUESTION NO: 69

Given the following DDL:

whatwill the SALARY be?

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 39

Page 39: 000-545

A. salary * 1.03

B. salary * 1.05

C. salary * 1.10

D. salary * 1.50

Answer: D

QUESTION NO: 70

Given the procedure shown below:

How many rows will be inserted in the table?

A. 0

B. 1

C. 2

D. 3

Answer: A

QUESTION NO: 71

Which statement will let you use the result set from the nested procedure CALLEE?

A. ASSOCIATE RESULT SETLOCATOR( loc1) WITH PROCEDURE callee;

B. BIND RESULT SET WITH PARAMETERS FOR PROCEDUREcallee;

C. INSERT RESULT SET FROMcallee INTO CURSOR c1;

D. SELECT * FROMcallee;

Answer: A

QUESTION NO: 72

Click the Exhibit button.

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 40

Page 40: 000-545

A trigger was created as shown in the exhibit.

The UPDATE statement shown below is executed. UPDATE dept SET sales_id = '300' WHERE

sales_id = '200'

How many row(s) are updated in the EMPLOYEE table?

A. 0

B. 1

C. 2

D. 3

Answer: B

QUESTION NO: 73

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 41

Page 41: 000-545

When considering authorization for CREATE OR REPLACE PROCEDURE statements, the

authorization id must have:

A. DBADM authority

B. group privileges on the table or view specified in the procedure

C. IMPLICIT_SCHEMA authority on the database

D. ownership of the existing procedure

Answer: D

QUESTION NO: 74

Which object is used to return a result set from an SQL procedure?

A. Temporary table

B. Array

C. Cursor

D. Scratchpad

Answer: C

QUESTION NO: 75

Given the following CREATE PROCEDURE statement:

In what order must declarations occur within the lines ap: BEGIN and END ap?

A. Variables, cursors, and condition handlers

B. Cursors, variables, condition handlers

C. Condition handlers, variables, cursors

D. Condition handlers, cursors, variables

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 42

Page 42: 000-545

Answer: A

QUESTION NO: 76

Which two statements are true with regards to nesting SQL procedures? (Choose two.)

A. An SQL procedure cannot invoke procedures built in other languages (e.g., C, Java).

B. An SQL procedure can invoke the same SQL procedure more than once.

C. An SQL procedure defined with the CONTAINS SQL clause can invoke an SQL procedure

defined with the READS SQL DATA clause.

D. An SQL procedure defined with the CONTAINS SQL clause can invoke an SQL procedure

defined with the MODIFIES SQL DATA clause.

E. An SQL procedure defined with the CONTAINS SQL clause can invoke an SQL procedure

defined with the NO SQL clause.

Answer: B,E

QUESTION NO: 77

Given the following procedures:

What would be value of the variable TOTAL_SCORE if the PROCESS_SCORES procedure is

called with the value 23 provided as input?

A. 0

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 43

Page 43: 000-545

B. 6B.6

C. 23C.23

D. 10D.10

Answer: B

QUESTION NO: 78

What is the correct order for declarations in a compound statement defined by BEGIN and END?

A. variable, cursor, handler, condition

B. variable, condition, cursor, handler

C. variable, condition, handler, cursor

D. variable, cursor, condition, handler

Answer: B

QUESTION NO: 79

Which two statements are true? (Choose two.)

A. SQL procedures can contain static and/or dynamic SQL statements.

B. Static or dynamic SQL execution is not associated with a package.

C. The SQL procedure is always associated with a package that contains access paths of SQL

statements in the procedure.

D. It is necessary for an end-user to have object level privileges if that user has execute privileges

on an associated package and the SQL procedure.

E. SQL procedures can have COMMIT or ROLLBACK within atomic compound statements.

Answer: A,C

QUESTION NO: 80

Which two statements are true about SQL procedures? (Choose 2)

A. SQL procedures reside outside of the database for easy portability.

B. SQL procedures cannot be called from triggers.

C. SQL procedures may return multiple result sets to the caller or to a client application.

D. SQL procedures support recursion.

E. SQL procedures support the PRINT statement.

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 44

Page 44: 000-545

Answer: C,D

QUESTION NO: 81

Which statement describes what must be done to create an SQL procedure that returns a result

set?

A. Specify the clause DYNAMIC RESULT SETS 1 in the CREATE PROCEDURE statement;

declare a cursor within the procedure body; open the cursor; exit the procedure without closing the

cursor.

B. Specify the clause DYNAMIC RESULT SETS 1 in the CREATE PROCEDURE statement; code

a SELECT statement in the procedure body.

C. Execute the CREATE PROCEDURE statement using the defaults; declare a cursor within the

procedure body; open the cursor; exit the procedure without closing the cursor.

D. Execute the CREATE PROCEDURE statement using the defaults; declare a cursor within the

procedure body; open the cursor; retrieve each row into output variables; close the cursor before

exiting the procedure.

Answer: A

QUESTION NO: 82

Which of the following can be done while debugging a SQL procedure with IBM Data Studio?

A. Change the order of statements being executed.

B. Edit the procedure and continue.

C. Change the value of any variables used.

D. Re-execute the current statement.

Answer: C

QUESTION NO: 83

When you right-click a SQL procedure in the Data Source Explorer of IBM Data Studio and select

Drop from the options menu, what happens?

A. The SQL procedure is temporarily hidden in the Data Source Explorer view.

B. The SQL procedure is removed from the data development project.

C. The SQL procedure is dropped from the database.

D. The SQL procedure is dropped from the database and removed from the data development

project.

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 45

Page 45: 000-545

Answer: C

QUESTION NO: 84

Which of the following steps are required to debug a stored procedure using IBM Data Studio?

A. Deploy the stored procedure from the data development project, debug the stored procedure.

B. Debug the stored procedure from the Data Source Explorer.

C. Deploy the stored procedure from the data development project, choose option for debugging

and then debug.

D. Debug the stored procedure from the IBM Data Studio command line console.

Answer: C

QUESTION NO: 85

Which two types of stored procedures can be developed in IBM Data Studio? (Choose two.)

A. SQL

B. PHP

C. PL/SQL

D. Perl

E. Ruby

Answer: A,C

QUESTION NO: 86

Which command can be used to optimize static SQL statements containing parameterized

queries?

A. SET CURRENT EXPLAIN MODE=REOPT

B. SET CURRENT EXPLAIN MODE=EXPLAIN

C. SET CURRENT EXPLAIN MODE=YES

D. SET CURRENT EXPLAIN MODE=PARAM

Answer: A

QUESTION NO: 87

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 46

Page 46: 000-545

Which tool can be used to get quick static SQL Explain data from packages?

A. db2expln

B. db2exfmt

C. Control Center

D. DB2 command center

Answer: A

QUESTION NO: 88

Which two DB2 commands can be performed using the ADMIN_CMD procedure? (Choose two.)

A. RUNSTATS

B. BACKUP

C. RESTORE

D. RECOVER

E. CREATE DATABASE

Answer: A,B

QUESTION NO: 89

Given that CREATE MODULE salesModule statement has been successfully executed, what is

the correct method to manage this MODULE?

A. REPLACE MODULEsalesModule

B. UPDATEsalesModule MODULE FOR

C. ALTER MODULEsalesModule

D. CREATE OR REPLACEselesModule UPDATE salesFunc

Answer: C

QUESTION NO: 90

In the code segment shown below:

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 47

Page 47: 000-545

Which statement accurately describes the result?

A. For activities whose description has not changed, update the description in the ARCHIVE table.

For new activities, insert into the ARCHIVE table. The ARCHIVE and ACTIVITIES table both have

ACTIVITY as a primary key.

B. For activities whose description has changed, update the description in the ARCHIVE table. For

new activities, insert into the ARCHIVE table. The ARCHIVE and ACTIVITIES table both have

ACTIVITY as a primary key.

C. For activities whose description has changed, update the description in the ACTIVITY table. For

new activities, insert into the ACTIVITIES table. The ARCHIVE and ACTIVITIES table both have

ACTIVITY as a primary key.

D. The statement will fail since MERGE is not a supported operator.

Answer: B

QUESTION NO: 91

If the following SQL statements were executed in the order shown:

What would be the values of RET_CODE1 and RET_CODE2 after executing the SIZEPRINTER

procedure?

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 48

Page 48: 000-545

A. 100, 100

B. 100 , 1

C. 123, 123

D. 100, 0

Answer: B

QUESTION NO: 92

Which of the following statements is true for declared global temporary tables(DGTT)?

A. The value of the USER special register is the implicit schema name of the DGTT

B. The DGTT must be stored in a system temporary table space

C. SESSION is the implicit schema name of the DGTT

D. The data in a DGTT cannot be compressed.

Answer: C

QUESTION NO: 93

Which statement is true about the NUMBER data type?

A. In DB2, the NUMBER data type has maximum precision of 31; in Oracle, it has a maximum

precision of 38.

B. In DB2, the NUMBER datatype is the same as in Oracle, provided the DB2 database was

created in Oracle compatibility mode.

C. Declaring a column asNUMBER(10,-2) is valid both in Oracle and in DB2 provided the DB2

database was created in Oracle compatibility mode.

D. Declaring a column asNUMBER(6,8) is valid both in Oracle and in DB2 provided the DB2

database was created in Oracle compatibility mode.

Answer: A

QUESTION NO: 94

Given the following code

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 49

Page 49: 000-545

What would be value of parm2 if the following proc1 called as call proc1(3, ?)?

A. 0

B. 10

C. 3

D. 8

Answer: B

QUESTION NO: 95

Which statement is TRUE about associative arrays?

A. Associative array values can be stored in table columns.

B. The index values for an associative array must be a continuous set of integer values.

C. Associative array cannot be a type of a table column.

D. The index data type for an associated array must be an integer.

Answer: C

QUESTION NO: 96

Which option is used when declaring a global temporary table that will keep its data across

transaction boundaries?

A. ON ROLLBACK DELETE ROWS

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 50

Page 50: 000-545

B. ON ROLLBACK PRESERVE ROWS

C. ON COMMIT PRESERVE ROWS

D. ON COMMIT DELETE ROWS

Answer: C

QUESTION NO: 97

Which statement will create global variable?

A. CREATE VARIABLEglob_emp_sal ANCHORE TO employee.salary

B. PUBLISH VARIABLEglob_emp_sal DECIMAL(9,2)

C. DECLARE GLOBAL VARIABLEglob_emp_sal DECIMAL(9,2)

D. DECLARE GLOBAL VARIABLEglob_emp_sal ANCHORE TO employee.salary

Answer: A

QUESTION NO: 98

Given the procedure show below:

What will be the value of P2?

A. 50

B. 51

C. 100

D. 102

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 51

Page 51: 000-545

Answer: C

QUESTION NO: 99

Given the SQL statement shown below:

Which statement correctly describes the cursor MY_CURSOR?

A. The cursor does not have sensitivity to insert, update, or delete operations that are made to

rows in the underlying result table.

B. The cursor will not be closed as a consequence of a commit operation.

C. The result table of the cursor is intended to be used as a result set that will be returned from a

procedure.

D. The cursor can be used to perform positioned delete operations.

Answer: D

QUESTION NO: 100

In a SQL Procedure, rows_fetched is an integer variable and curEmp is a cursor variable of

SELECT statement on a table. After opening the cursor curemp, which of the statement will

determine the number of rows fetched?

A. SETrows_fetched = curEmp%CURSOR_ROWCOUNT

B. SETrows_fetched = curEmp%ROWCOUNT

C. SETrows_fetched = CURSOR_ROWCOUNT(curemp)

D. SETrows_fetched = ROWCOUNT(curemp)

Answer: C

QUESTION NO: 101

Which declaration is not valid?

A. DECLARE var1DECIMAL(9,2);

B. DECLARE var1VARCHAR(20);

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 52

Page 52: 000-545

C. DECLARE var1 CHAR;

D. DECLARE var1 INTEGER DEFAULT;

Answer: D

QUESTION NO: 102

Given the following statements in an SQL procedure:

Which of the following assignment statements is valid?

A. SET c1 = VALUES (1, 2, 3);

B. SET c1 = CURSOR FOR VALUES (1, 2, 3);

C. c1 = CURSOR VALUES (1, 2, 3);

D. SET VALUES (1, 2,3) for CURSOR c1;

Answer: B

QUESTION NO: 103

Given the following statement:

How many values are inserted in to the array called quantity?

A. 1

B. 2

C. 3

D. 4

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 53

Page 53: 000-545

Answer: D

QUESTION NO: 104

Which of the following is the simplest way to define a record with fields corresponding to all of the

columns that are fetched from a cursor or cursor variable?

A. Using the VARRAY attribute

B. Using the READ FROM CURSOR attribute

C. Using the %ROWTYPE attribute

D. Using the %CURSOR attribute

Answer: C

QUESTION NO: 105

Click the Exhibit button.

Referring to the exhibit, which two statements are correct? (Choose two.)

A. If the EMPLOYEE_TEMP table exists, the execution order is 1,2,3.

B. If the EMPLOYEE_TEMP table does not exist, the execution order is 1,4,3.

C. If the EMPLOYEE_TEMP table exists, the execution order is 4,1,2,3.

D. If the EMPLOYEE_TEMP table does not exist, the execution order is 4,1,3.

E. If the messages table does not exist, the SQL procedure will still compile.

Answer: A,B

QUESTION NO: 106

In the given text below:

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 54

Page 54: 000-545

What will be the value of the output variable BONUS?

A. 500

B. 1000

C. 5200

D. 5500

Answer: A

QUESTION NO: 107

Which code fragment illustrates the proper way to perform error checking in SQL stored

procedures?

A. ...

IF

EXCEPTION < 0

ELSE THEN;

NULL;

ENDIF;

...

B. ...

BEGIN

EXCEPTION < 0

ELSE;

NULL;

END;

...

C. ...

IF SQLCODE < 0 THEN

RETURN -6786;

END IF;

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 55

Page 55: 000-545

...

D. ...

BEGIN

IF SQLCODE < 0 THEN

RETURN -6786

END;

Answer: C

QUESTION NO: 108

Click the Exhibit button.

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 56

Page 56: 000-545

How many rows will be in table INFO2 after the procedure MOVE_DATA shown in the exhibit is

executed?

A. 0

B. 4

C. 5

D. 7

Answer: B

QUESTION NO: 109

Which of the following can be used to assign multiple values to a row data type variable?

A. A SELECT * statement, a VALUES * statement, or a FETCH * statement.

B. A SELECT INTO statement,a VALUES INTO statement, or a FETCH INTO statement.

C. A DIRECT ASSIGNMENT statement.

D. A VARIABLE VALUES statement.

Answer: B

QUESTION NO: 110

Which two statements describe a CASE statement? (Choose two.)

A. CASE statements are used to enter into some logic based on a literal value.

B. CASE statements are used to enter into some logic based on the value of an expression.

C. CASE statements are used to return control to the beginning of an expression.

D. CASE statements are used to enter into some condition and loop until the condition is met.

E. CASE statements are used to iterate into some logic based on a literal value.

Answer: A,B

QUESTION NO: 111

Which code fragment illustrates the proper way to capture and save SQL error handler values so

they can be used to control procedure logic?

A. DECLARE CONTINUE HANDLER FOR SQLEXCEPTION, SQLWARNING, NOT FOUND

SET retcode = SQLCODE;

B. DECLARE ERROR HANDLER FOR SQLEXCEPTION, SQLWARNING, NOT FOUND

SET retcode = EXCEPTION;

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 57

Page 57: 000-545

C. DECLARE ERROR HANDLING SQLEXCEPTION, SQLWARNING, NOT FOUND

SET retcode = SQLERRN;

D. DECLARE ERROR HANDLING FOR SQLEXCEPTION, SQLWARNING, NOT FOUND

SET retcode = SQLMSG;

Answer: A

QUESTION NO: 112

Which statement will change the value of a special register?

A. UPDATE SPECIAL REGISTER TIME= ?2:30:00?UPDATE SPECIAL REGISTER TIME =

?2:30:00

B. UPDATE SPECIAL REGISTER SCHEMA = 'DB2ADMIN'

C. SET CURRENT TIME= ?2:30:00?SET CURRENT TIME = ?2:30:00

D. SET CURRENT SCHEMA = 'DB2ADMIN'

Answer: D

QUESTION NO: 113

Which of the following CURSOR declare statement is incorrect?

A. DECLARE c1 CURSOR WITHOUT RETURN FOR SELECT * FROM tab1

B. DECLARE c1 ASENSITIVE CURSOR WITH RETURN TO CLIENT FOR SELECT * FROM tab1

C. DECLARE c1 INSENSITIVE CURSOR WITH RETURN TO CLIENT FOR SELECT * FROM

tab1

D. DECLARE c1 SENSITIVE CURSOR WITH RETURN TO CLIENT FOR SELECT * FROM tab1

Answer: D

QUESTION NO: 114

Which rule applies to the REFERENCING clause in a CREATE TRIGGER statement?

A. The OLD correlation-name and the OLD TABLE identifier can be used if the trigger event is an

INSERT operation.

B. The scope of each correlation-name and identifier used is the entire trigger definition.

C. The OLD TABLE or NEW TABLE identifiers can be defined in a BEFORE trigger.

D. A NEW correlation-name can be specified more than once for a trigger.

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 58

Page 58: 000-545

Answer: B

QUESTION NO: 115

Which of the following statement is TRUE about a REPEAT loop?

A. The condition is checked at the end of the loop.

B. The condition is checked at the beginning of the loop.

C. A REPEAT loop behaves like a WHILE loop.

D. A REPEAT loop behaves like a FOR loop.

Answer: A

IBM 000-545: Practice Exam

"Pass Any Exam. Any Time." - 100% Guaranteed 59


Recommended