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 |
Is it Possible to read from PS file and write it to database by using dynamic sql(execute immediate)
What is reorg?
how to copy the host variables from ps file into cobol program other than include statement
what is contained in the DB2 node lock file? A) data base names B) data base users names C) license keys D) server names
How can the duplicate values be eliminated from db2 select?
What is check constraint in db2?
by using cursors , we can access particular records from the table based on some condition, i want to delete those selected records, how can we write a query for this in the program?
Can you access the DB2 Directory table using SQL?
What is the difference between CS and RR isolation levels?
how can you access index
What are the various isolation levels possible?
What is an instance in db2?