Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Database \ Oracle PL / SQL based cursor     - Install multiple Linux distributions and Fedora 21 first experience on the same hard disk (Linux)

- The AWK use Cygwin tools mysql binlog log viewer (Database)

- Hadoop 1 and 2.x installation notes (Server)

- systemd-nspawn Quick Guide (Linux)

- GitLab remote backup of Linux Shell Scripting (Linux)

- Python is not C (Programming)

- Cobbler remotely install CentOS system (Linux)

- Linux environment to build next Cocos2dx-3.3.1 (Linux)

- Using Java arrays implement sequential stack (Programming)

- Oracle create user authorization and in PLSQL (Database)

- Making Linux root file system problems on-link library (Programming)

- Oracle Standby Redo Log experiment (Database)

- Linux productivity tools and tips (Linux)

- Recovery from MySQL master data consistency summary (Database)

- Variables Python variables (Programming)

- How to implement large-scale distributed Yahoo depth study on the Hadoop cluster (Server)

- Debian Stable (Jessie 8.1) of normal.mod not found (Linux)

- Swift defined type conversion and type aliases (typealias) (Programming)

- Nginx request processing (Server)

- MySQL can not write the data keyword conflicts (Database)

 
         
  Oracle PL / SQL based cursor
     
  Add Date : 2018-11-21      
         
         
         
  Oracle cursor into explicit games, game implicit explicit cursor is a user define their own operation for processing the results of the query SELECT query returns multiple rows; implicit cursor is automatically operated, for processing DML statements and returns a single row of data SELECT query.

In this article, we focus on explicit cursor.

First, the use of the cursor step

Step four steps: Define a cursor, the cursor is opened to retrieve the cursor, close the cursor.

1, the definition of the cursor

Cursor must be declared in the statement PL / SQL block section.

CURSOR cursor_name IS select_statement;

When you define a cursor does not generate seletct_statement (SELECT queries) data, when the cursor is opened, it really generates the data.

2, open the cursor

OPEN cursor_name;

Only after the cursor is opened, only the data from the database query cache buffer memory allocation.

3, to retrieve the cursor

FETCH curso_name INTO variable_list;

Retrieving the cursor on the premise that, you must open the cursor, open cursor only, and will have a data buffer.
 
Cursor to retrieve data, only down, not be rolled back, for example: after retrieving the second data retrieval want to first data, you must close the cursor, open the cursor again, to retrieve the first data.
 
4, close the cursor
 
After processing the data retrieved a cursor, the cursor must be closed in order to free up system resources it takes up, as occupied by the internal buffer

CLOSE curso_name;
Second, using the example of the cursor

declare
  - Declare cursor
  cursor c_dept is
  select * from dept t order by t.deptno;
  v_dept c_dept% rowtype;
begin
  --open cursor c_dept
  open c_dept;
  
  - Search cursor c_dept
  loop
    fetch c_dept into v_dept;
    dbms_output.put_line
    ( 'Deptno:' || v_dept.deptno || ', dname:' || v_dept.dname || ', loc:' || v_dept.loc);
    exit when c_dept% notfound;
  end loop;
  
  --close cursor
  close c_dept;
end;
     
         
         
         
  More:      
 
- Linux Tutorial Share: How to sudo command to define the PATH environment variable (Linux)
- Python decorators to learn and practice the actual usage scenarios (Programming)
- Customize the output format in Linux history (Linux)
- Elasticsearch 2.20 Highlight (Server)
- Linux environment RabbitMQ installation and monitoring of plug-in installation (Linux)
- Struts2 configure a static resource files without Struts processing (regular match) (Programming)
- DRBD rapid installation and deployment (Server)
- To see the Linux device tree (Linux)
- Linux system Passwd file detailed analysis (Linux)
- Linux kernel to achieve soft RPS network to receive soft interrupt load balancing to distribute (Linux)
- How to import JNI resulting .so libraries in Android Studio (Programming)
- Ubuntu 14.04 next upgrade to GNOME 3.12 (Linux)
- How to manage the time and date at systemd Linux systems (Linux)
- Zabbix monitoring platform to extract a single server graphical Python implementation of concurrent (Server)
- Linux simple commands (Linux)
- Android Studio Installation and Configuration Guide tutorial (Linux)
- Linux System Getting Started Learning: Join cron job in Linux (Linux)
- CentOS7 install NTFS-3G driver (Linux)
- Using Java to build micro-services (Server)
- Build ftp server under CentOS 6.5 (Server)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.