Do we need cursor for Count(*)?
Answers were Sorted based on User's Feedback
Answer / nak
No,Count(*) will give u the number of record in a table.
Ex: select Count(*) from EMP table where EMPNAME='sunil'
| Is This Answer Correct ? | 13 Yes | 1 No |
Answer / yaswanth
we will use cursors when we have situation like the query
returning multiple rows but in this case
select Count(*) from EMP table where EMPNAME='some' will
return only one row, i.e how many rows it found with
EMPNAME='some' eg:3 or 4 or 5 ... so there is no concept of
cursor here
| Is This Answer Correct ? | 9 Yes | 3 No |
Answer / shravan kumar.p
no need..
select count(*) from the emp.
it will give the total no of rows in a table..
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / sachin borase
select 8 from table fetch first 3 rows only
| Is This Answer Correct ? | 0 Yes | 5 No |
Shall i use this query to retrieve first 4 records, Select empno, sal from emptbl where empno < 5. like this can we fetch first 100 records?
How to get the ddl of a table in db2?
What is FREEPAGE and PCTFREE in TABLESPACE creation?
how 2 resolve the -311 sqlcode
What is a DB2 plan?
Can you access the DB2 Directory table using SQL?
what happend with out using Commit,when closing cursor and program?
What statistic will tell the DBA how must space can be reclaimed from dropped table spaces on the next reorg run?
What is a db2 table?
Explain in brief how does db2 determine what lock-size to use?
What is plan in cobol db2?
What are the disadvantages of using VARCHAR?