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

How to know the primary key of a table without defining the primary key in the table?

5 Answers   Satyam,


What is the function of buffer manager?

1 Answers  


What is the self-referencing constraint?

2 Answers  


How can you classify the locks in db2?

0 Answers  


If we keep the DCLGEN structure for a table in a copybook and include it in the COBOL program using the COPY statement, will there be any impact during compilation or at any stage of program execution?

2 Answers  






I have two tables A and B. Both tables are connected with SSN number as foreign key. I want to retrieve a column data from B table. How will you write a query?

3 Answers   CTS,


How to take backup of table in db2?

0 Answers  


Define check constraint.

0 Answers  


B37 abend during spufi?

0 Answers   IBM,


Which one allows duplicate values Union or Union All ?

3 Answers  


Why do we need to create an alias if we can directly use the table name? What are the benefits of referring a table name by its alias? Also, when should we go for alias and when for synonyms?

1 Answers  


what's the best lock size that you could use when you create a tablespace?

2 Answers   IBM,


Categories