Professional Documents
Culture Documents
Thread 1: COMMIT
1. Which of the following static SQL statements can use a host
variable? Assuming that AUTOCOMMIT is ON, how many records will be
successfully inserted into the table MYTAB?
A. FETCH
B. ROLLBACK A. 1
C. DROP INDEX B. 2
D. ALTER TABLE C. 3
D. 4
2. Which of the following JDBC interfaces contains methods that
are called to determine whether or not cursors persist across 8. Given a table that has columns defined:
COMMIT boundaries? SMALLINT_COLUMN SMALLINT NOT NULL
VARCHAR_COLUMN VARCHAR(20)
A. ResultSet
B. Statement Which of the following statements is used to retrieve rows from the
C. DatabaseMetaData table and allows the second column to be checked for NULL
D. ResultSetMetaData values?
3. Which of the following JDBC objects can be used to determine A. FETCH * INTO :hv1, :hv2
the SQLSTATE if execution of a query fails? B. FETCH CURSOR1 INTO :hv1, :hv2
C. FETCH * INTO :hv1, :hv2 :hv2ind
A. Statement D. FETCH CURSOR1 INTO :hv1, :hv2 :hv2ind
B. ResultSet
C. SQLException 9. Given the following TWO SQL stored procedures:
D. ResultSetMetaData Procedure 1:
CREATE PROCEDURE myStorproc(p1 int, p2 char)
4. Which of the following can be used to access a DB2 database language sql
from a workstation that does not have any DB2 code installed? specific spintchar
BEGIN
A. Trigger IF ( P1 = 0 OR P1 = 1 ) THEN UPDATE DUMMY SET COL1 =
B. Java Applet INT(P2);
C. SQL Routines END IF ;
D. External Stored Procedure END
Procedure 2:
5. Which of the following programming interfaces can be used to CREATE PROCEDURE myStorproc(p1 int)
program static queries from a Java application? language sql
specific spint
A. CLI BEGIN
B. JTA IF ( P1 = 0 OR P1 = 1 ) THEN UPDATE DUMMY SET COL1 =
C. JDBC P1 ;
D. SQLJ END IF ;
E. OLEDB END
6. Given a cursor C1 on table T1. For every row fetched from T1, Which of the following statements will remove Procedure 1 from
open a cursor C2 on table T2. For every row fetched from T2, the database?
update column C1 in table T2 and issue a COMMIT.
A. DROP PROCEDURE myStorproc (p1, p2)
Which of the following must define cursor C1? B. DROP PROCEDURE myStorproc (int, char)
C. DROP SPECIFIC PROCEDURE spintchar (p1, p2)
A. DECLARE c1 CURSOR WITH HOLD FOR SELECT * FROM D. DROP SPECIFIC PROCEDURE spintchar (int, char)
t1 E. DROP SPECIFIC PROCEDURE myStorproc (int, char)
B. DECLARE c1 CURSOR WITH RETURN FOR SELECT *
FROM t1 10. During which of the following are SQL statements optimized
when using DB2 CLI?
C. DECLARE c1 CURSOR FOR SELECT * FROM t1 FOR
UPDATE OF t2 A. cursor open
D. DECLARE c1 CURSOR FOR SELECT * FROM t1 FOR B. precompile phase
UPDATE OF c1 C. application binding
D. statement preparation
7. Given an ODBC/CLI program with a single connection, two 11. Given the following table and trigger definition:
threads and the following actions:
TABLE: DEPTINFO
Thread 1: INSERT INTO mytab VALUES (1) DeptID DeptTitle DeptCount
Thread 2: INSERT INTO mytab VALUES (2) ====== ========= =========
Thread 1: INSERT INTO mytab VALUES (3) 1 SALES 5
Thread 1: ROLLBACK 2 MKTG 2
3 DEVELOPMENT 17
(check error information in SQLCA)
CREATE TRIGGER notify (Cleanup)
AFTER UPDATE OF deptid,deptcount ON deptinfo
REFERENCING OLD AS o NEW AS n End Program
FOR EACH ROW DB2SQL MODE
WHEN(o.DeptCount=0 OR n.DeptId<4) What table will be updated in "samplea" if the second DELETE
BEGIN completes successfully?
INSERT INTO notifylog VALUES(CURRENT
TIMESTAMP,'Check on Dept Changes'); A. usera.tablex
END B. userb.tablea
C. usera.tablea
How many rows will be inserted into the NOTIFYLOG table as a D. userb.tablex
result of the trigger activations caused by the successful execution
of the following set of SQL statements?
13. Which of the following ODBC/CLI statement handle attributes
UPDATE DeptInfo SET DeptCount = DeptCount+1 permits an application to change the memory address of all bound
UPDATE DeptInfo SET DeptTitle = 'MARKETING' WHERE parameter markers without making any ODBC/CLI API calls?
DeptId=2
UPDATE DeptInfo SET DeptCount = 10 WHERE DeptID=1 A. SQL_ATTR_PARAM_BIND_TYPE
B. SQL_ATTR_PARAM_STATUS_PTR
A. 2 C. SQL_ATTR_PARAM_OPERATION_PTR
B. 3 D. SQL_ATTR_PARAM_BIND_OFFSET_PTR
C. 4
D. 5 14. Given a table created using the statement:
CREATE TABLE abc.stuff (i INT)
12. Given the following embedded SQL pseudocode: A user called XYZ is to be enabled to access data from table
Start Program ABC.STUFF using an implicit schema.
EXEC SQL BEGIN DECLARE SECTION
USERA CHARACTER (8) Assuming the necessary privileges have been granted, which of the
USERB CHARACTER (8) following statements issued by user ABC will provide this result?
PW CHARACTER (8)
COLVAL CHARACTER (16) A. CREATE ALIAS stuff FOR abc.stuff
EXEC SQL END DECLARE SECTION B. CREATE VIEW abc.stuff FOR xyz.stuff
C. CREATE ALIAS abc.stuff FOR xyz.stuff
EXEC SQL INCLUDE SQLCA D. CREATE VIEW xyz.stuff AS SELECT i FROM abc.stuff
EXEC SQL WHENEVER SQLERROR GOTO ERRCHK
Which of the following statements will successfully insert a row A. Derived view
into the temporary table TEMP1? B. Derived table
C. Scalar subselect
A. INSERT INTO db1.temp1 VALUES (100) D. Common table expression
B. INSERT INTO user1.temp1 VALUES (100)
C. INSERT INTO session.temp1 VALUES (100)
D. INSERT INTO temporary.temp1 VALUES (100) 26. Which of the following must be used by an application to
retrieve multiple rows?
21. Given the following table:
CREATE TABLE employee A. SQLCA
(name CHAR(10), salary DEC) B. CURSOR
INSERT INTO employee (name, salary) VALUES ('SMITH', C. SELECT INTO statement
30000) D. COMPOUND SQL statement
INSERT INTO employee (name) VALUES ('JONES')
INSERT INTO employee (name, salary) VALUES ('ALI', 35000)