how to check the table is empty or not?

Answers were Sorted based on User's Feedback



how to check the table is empty or not?..

Answer / vaneesh khurana

After executing the first query if you find SQLCODE = 100,
then the table is empty.

Is This Answer Correct ?    6 Yes 1 No

how to check the table is empty or not?..

Answer / sriram


EXEC-SQL
SELECT 1
INTO :X
FROM TAB1
END-EXEC
X is defined as s9(4) comp value zeroes
So, if there is a row in the table (i.e. the table is not
empty), 1 gets moved to variable X.
Did not have resources to run the query and validate ,



Please let me know if I am wrong

Is This Answer Correct ?    0 Yes 0 No

how to check the table is empty or not?..

Answer / sriram


EXEC-SQL
SELECT 1
INTO :X
FROM TAB1
END-EXEC
X is defined as s9(4) comp value zeroes
So, if there is a row in the table (i.e. the table is not
empty), 1 gets moved to variable X.
Did not have resources to run the query and validate ,



Please let me know if I am wrong

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More DB2 Interview Questions

What is database alias db2?

0 Answers  


pls explain the precompilation process of cobol-db2 pgm

3 Answers   HCL, IBM,


What is the purpose of the SDSNLOAD dataset in the STEPLIB while running DB2 programs?

2 Answers  


What are packages in db2?

0 Answers  


select * from orders where odate between '2010-01-01'and '2010-03-31' How do u fetch this into cursor?

2 Answers  






Which isolation level provides highest data integrity?

0 Answers  


Suppose the outcome of executing a query results in a row having null. Based on the answer how you use it? Its declaration and inclusion?

2 Answers   Verizon,


What happens to a tablespace when its recovery infromation has been removed and a full recovery is no longer possible?

2 Answers  


what is the difference between normal select query and currosor

2 Answers   Cap Gemini, TCS,


Hello All, We have requirment to Replace BMC Db2 Load product thru CA FAST LOADPlus product. Do anyone have JCL to for FAST LOADPLUS and what all are thing need to take in consideration.

0 Answers   IBM,


what is sql abend code -801,-802?

2 Answers  


What are some SQL aggregates and other built-in functions?

2 Answers  


Categories