You are on page 1of 3

1) A stored procedure has been created with the following statement:

CREATE PROCEDURE proc1 (IN var1 VARCHAR(10), OUT rc INTEGER)


SPECIFIC myproc LANGUAGE SQL …
What is the correct way to invoke this procedure from SQLRPGLE ?
a. CALL proc1 (‘SALES’, ?)
b. CALL myproc (‘SALES’, ?)
c. CALL proc1 (SALES, ?)
d. RUN proc1 (SALES, ?)

2) What SQLCODE = -1008 signify


a. File name specified in the cursor doesn’t exists
b. Host Variable not declared
c. Program not compiled with commitment control *NONE
d. Error code -1008 doesn’t exists

3) Of which what are the variables (which are defined in SQLRPGLE


program) and cannot be used inside SQL statements
a. Indicators
b. UDATE
c. Name Constants
i. A only
ii. A and C
iii. A, B and C

4) An RPG for iSeries program containing SQL statements that is


called by a program that also contains SQL statements, should be
ended :
a. By the RETURN statement
b. By setting the RT indicator on.
i. A only
ii. B only
iii. A or B

5) To embed an RPG for iSeries comment within the SQL statement,


a. place * in position 7.
b. Place /* in position 7
c. Comments cannot be placed inside /EXEC and /END-EXEC

6) Given the following table and the statements within /EXEC and
/END-EXEC below:
TAB1
COL_1 COL_2
A 10
B 20
C 30
D 40
E 50
DECLARE c1 CURSOR WITH HOLD FOR SELECT * FROM tab1
ORDER BY col_1
OPEN c1
FETCH c1
FETCH c1
FETCH c1
COMMIT
FETCH c1
CLOSE c1
FETCH c1
Which of the following is the last value obtained for COL_2?
a. 20
b. 30
c. 40
d. 50
The correct answer is C. When a cursor that has been declared
with the WITH HOLD option specified (as in the example shown) is
opened, it will remain open across transaction boundaries until
it is explicitly closed; otherwise, it will be implicitly closed
when the transaction that opens it is terminated. In this
example, the cursor is opened, the first three rows are fetched
from it, the transaction is committed (but the cursor is not
closed), another row is fetched from it, and then it is closed

7) Given the following table:

TAB1
COL_1 COL_2
A 10
B 20
C 30
A 10
D 40
C 30
Which of the following statements will return only one record for
each set of repeated rows
found in the final result data set produced?
a. SELECT UNIQUE * FROM tab1
b. SELECT DISTINCT * FROM tab1
c. SELECT UNIQUE(*) FROM tab1
d. SELECT DISTINCT(*) FROM tab1

8) Which of the following query DELETES all record from employee


master file
a. DELETE FROM EMPMAS
b. DELETE * FROM EMPMAS
c. DELETE * FROM EMPMAS WHERE EMPNUM IN (SELECT EMPNUM FROM
EMPMAS)

You might also like