how to check the table is empty or not?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
What are the various locking levels available?
Where besides the DB2 catalog is database object information stored by DB2?
how to resolve -818 error. how to see timestamp token in load module and plan
What is the difference between bind and rebind in db2?
5 rows are inserted to a DB2 Table. Next 3 of those are updated, then a rollback is issued. What would happen when the rollback is issued?
Name the various locking levels available?
I need to view the number of tables existing under one particular Owner. Is it possible? If so, pl give the SQL query for this?
What are the advantages of using a PACKAGE?
what is the difference between normal select query and currosor
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?
Define data page.
What are the functions in DB2?