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 |
How to know the primary key of a table without defining the primary key in the table?
What is the function of buffer manager?
What is the self-referencing constraint?
How can you classify the locks in db2?
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?
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?
How to take backup of table in db2?
Define check constraint.
B37 abend during spufi?
Which one allows duplicate values Union or Union All ?
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?
what's the best lock size that you could use when you create a tablespace?