|
Re: Explicit cursor v Implicit cursor [message #359308 is a reply to message #359306] |
Fri, 14 November 2008 11:48 |
registereduser
Messages: 52 Registered: June 2008 Location: Toronto
|
Member |
|
|
I am bit confused. I got the standard answers as follows:
"You use explicit cursors when you are sure that the SQL statement will return more than one row. "
I believe the answer is incorrect since I can also use implicit cursor to handle this. When I say "implicit cursor", I mean FOR ... IN (SELECT ... ) LOOP.
Now the focus is on the definition of what explicit cursor is and what implicit cursor is. Look at Oracle materials FOR LOOP cursor is classified as shortcut to explicit cursor, but in practical world, it classified as implicit cursor. I think what is why.
Please correct me if I am wrong.
|
|
|
|
Re: Explicit cursor v Implicit cursor [message #359311 is a reply to message #359309] |
Fri, 14 November 2008 12:05 |
registereduser
Messages: 52 Registered: June 2008 Location: Toronto
|
Member |
|
|
For this third kind of cursor, let us call it Explicit Shortcut Cursor, there are two forms:
1. Cursor declared in declaration block
DECLARATION
CURSOR c_1 IS
SELECT col_1
FROM tab_1;
BEGIN
FOR i IN c_1 LOOP
END LOOP;
2. Not declared
BEGIN
FOR i IN (SELECT col_1 FROM tab_1) LOOP
END LOOP;
|
|
|
Re: Explicit cursor v Implicit cursor [message #359313 is a reply to message #359311] |
Fri, 14 November 2008 12:41 |
registereduser
Messages: 52 Registered: June 2008 Location: Toronto
|
Member |
|
|
I think I was wrong. If a cursor has been declared, it is clearly an explicit cursor. The third kind cursor can be called Undeclared Explicit Cursor, on contrast to the Implicit Cursor as called by almost all real world programmers, including Ask Tom Oracle, dba-oracle.com.
|
|
|