what is cursor. write example of it. What are the attributes of cursor.
Answer / Kavindra Singh Thakur
A cursor is a database object that represents a dynamic set of rows returned from a SELECT statement during its execution. You can iterate through each row of a result set using a cursor.
Example:
```sql
DECLARE
my_cursor SYS_REFCURSOR;
emp employees%ROWTYPE;
BEGIN
OPEN my_cursor FOR
SELECT * FROM employees WHERE department_id = 10;
LOOP
FETCH my_cursor INTO emp;
EXIT WHEN my_cursor%NOTFOUND;
-- Process the current row here...
END LOOP;
CLOSE my_cursor;
END;"
The attributes of a cursor are:
- %ISOPEN: Returns true if the cursor is open.
- %ROWS: Returns the number of rows currently in the cursor.
- %NOTFOUND: Returns true when there are no more rows to fetch from the cursor.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is an ndf file?
Write the order of precedence for validation of a column in a table ?
what is the difference between union and union all
14 Answers IBM, Luxoft, Oracle,
what is difference between stored procedures and application procedures,stored function and application function?
Hello All, Could any well write a query for the following scenario. Account(table name) No Name Amount 1 ABCD 2000.00 2 DEFG -2000.00 3 GHIJ 3000.50 4 JKLM 4000.00 5 MNOP 6000.00 O/p Should be in this format No Name Credit Debit 1 ABCD 2000.00 0 2 DEFG 0 -2000.00 3 GHIJ 3000.50 4 JKLM 0 -4000.00 5 MNOP 6000.00 o could any one give appropriate query for this Thnks in Advance Suneel Reddy
Why we use joins in sql?
how many tupples can insert in 1 second in sql
can use the following like overloading concept in a single package: procedure p1(a varchar), procedure p1(a varchar2), procedure p1(a char)
1. Which is an aggregate function? a. Union b. like c. max d. Rank
What are sql ddl commands?
How many null values can be inserted in a coulmn whihc is unique constraint
What are all the ddl commands?
Oracle (3253)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)