What is the difference between explicit and implic

2020-02-02 12:04发布

I am a bit rusty on my cursor lingo in PL/SQL. Anyone know this?

标签: oracle plsql
16条回答
Melony?
3楼-- · 2020-02-02 12:14

Implicit cursors require anonymous buffer memory.

Explicit cursors can be executed again and again by using their name.They are stored in user defined memory space rather than being stored in an anonymous buffer memory and hence can be easily accessed afterwards.

查看更多
Rolldiameter
4楼-- · 2020-02-02 12:17

In PL/SQL, A cursor is a pointer to this context area. It contains all the information needed for processing the statement.

Implicit Cursors: Implicit cursors are automatically created by Oracle whenever an SQL statement is executed, when there is no explicit cursor for the statement. Programmers cannot control the implicit cursors and the information in it.

Explicit Cursors: Explicit cursors are programmer-defined cursors for gaining more control over the context area. An explicit cursor should be defined in the declaration section of the PL/SQL Block. It is created on a SELECT Statement which returns more than one row.

The syntax for creating an explicit cursor is:

CURSOR cursor_name IS select_statement; 
查看更多
爱情/是我丢掉的垃圾
5楼-- · 2020-02-02 12:17

Every SQL statement executed by the Oracle database has a cursor associated with it, which is a private work area to store processing information. Implicit cursors are implicitly created by the Oracle server for all DML and SELECT statements.

You can declare and use Explicit cursors to name the private work area, and access its stored information in your program block.

查看更多
Bombasti
6楼-- · 2020-02-02 12:18

An explicit cursor is defined as such in a declaration block:

DECLARE 
CURSOR cur IS 
  SELECT columns FROM table WHERE condition;
BEGIN
...

an implicit cursor is implented directly in a code block:

...
BEGIN
   SELECT columns INTO variables FROM table where condition;
END;
...
查看更多
淡お忘
7楼-- · 2020-02-02 12:18

With explicit cursors, you have complete control over how to access information in the database. You decide when to OPEN the cursor, when to FETCH records from the cursor (and therefore from the table or tables in the SELECT statement of the cursor) how many records to fetch, and when to CLOSE the cursor. Information about the current state of your cursor is available through examination of the cursor attributes.

See http://www.unix.com.ua/orelly/oracle/prog2/ch06_03.htm for details.

查看更多
登录 后发表回答