DECLARE
-- Definition type .
TYPE test_type IS TABLE OF test_main%ROWTYPE;
test_data test_type;
-- Define cursors .
CURSOR c_test_main IS
SELECT id, value FROM test_main;
BEGIN
-- Open cursor .
OPEN c_test_main;
-- Start the cycle
LOOP
-- Fill in the data Batch fill , Each read 2 strip .
FETCH c_test_main
BULK COLLECT INTO test_data LIMIT 2; -- Debug output .
FOR i IN 1..test_data.count
LOOP
dbms_output.put_line(test_data(i).value);
END LOOP; -- When there is no data , sign out .
EXIT WHEN c_test_main%NOTFOUND; END LOOP;
-- Close cursor .
CLOSE c_test_main;
END;

Oracle Cursor returns multiple data in the case of more related articles

  1. Oracle Insert 100 Ten thousand data

    In the process of doing a project , Need a large number of data in the database to verify the program , But we don't have data , At this time, we need to build a table manually , Insert a lot of data , To verify . So the one that inserts a lot of data sql The statement is as follows : insert into E ...

  2. ORACLE in INSERT Insert multiple data

    insert ALL into u_role_permission(rid,pid) values (4,12) into u_role_permission(rid,pid) values (3,4 ...

  3. SELECT INTO and INSERT INTO SELECT The difference between similar aaa?a=1&b=2&c=3&d=4, How to change the data after the question mark into a key value pair C# Get the random number of a certain interval 0、1 Two values in addition to random number value method (0、1 The probability of two values being taken is equal ) C# MD5 encryption , Decrypt C# in DataTable Delete multiple data

    SELECT INTO and INSERT INTO SELECT The difference between   Data replication and backup in database SELECT INTO: form : SELECT value1,value2,value3 INTO Ta ...

  4. Oracle Use cursor to delete all record scripts in all user data tables

    Application scenarios : Because the data in the database involves confidential information , I hope all data can be deleted at one time , Keep only the data table structure , For new project development program test result : All data have been deleted after query Existing problems : If there are foreign keys in the data table, the following script may not be executed successfully , Please help yourself ...

  5. turn : from Mysql Random read from a table n Of data SQL Query statement

    If you want to be in i ≤ R ≤ j This range yields a random integer R , You need to use expressions FLOOR(i + RAND() * (j – i + 1)). for example , If you want to be in 7 To 12 The scope of the ( Include 7 and 12) Get a random number in ...

  6. 【 turn 】Oracle How to use a SQL Quickly generate 10 10000 test data

    from http://blog.csdn.net/welken/article/details/4971887   People who do database development or management often have to create a lot of test data , You need tens of thousands of them , If you enter one by one , ...

  7. from Mysql Random read from a table n Of data SQL Query statement

    If you want to be in i ≤ R ≤ j  This range yields a random integer R , You need to use expressions  FLOOR(i + RAND() * (j – i + 1)). for example , If you want to be in 7  To  12  The scope of the ( Include 7 and 12) Get a random number in ...

  8. mybatis Report errors : When querying one to many or many to many, only one piece of data is returned

    problem : Only one data problem is returned when using mapping file to query one to many or many to many resolvent : The problem is that the primary keys in the two tables are the same, so there is the problem of data coverage . Solution one : Modify the primary key in the database table ( This method is troublesome ...

  9. sql- Realization select Take the line number 、 Sort in groups after grouping 、 The first... In each group n Data

    Table structure design : Realization select Take the line number sql Of a local variable 2 Ways of planting set @name='cm3333f'; select @id:=1; difference :set It can be used = No. assignment , and select no way , You have to use := ...

Random recommendation

  1. Write quality code : improve Java programmatic 151 A suggestion ( The first 3 Chapter : class 、 Object and method ___ Suggest 47~51)

    Suggest 47: stay equals Use in getClass Make type judgment In this section, we will continue to talk about override equals The problem of , This time we write an employee Employee Class inheritance Person class , This is normal , Employees are also people , And in JavaBe ...

  2. scp Download a file from a remote server

    scp -P202 xx3.x6.xx.xx:/usr/local/zookeeper-.zip /tmp # Specify the port of the remote server and the target file of the remote server , Finally, specify the directory to download to It can also be served remotely ...

  3. Linux Take advantage of CGroup control CPU、 Memory and IO Operation record of

    CGroup The introduction of the system and its subsystems will not be repeated here , You can refer to :Linux Next CGroup Use the instructions to sort out the nonsense , Here's a record of using CGroup control CPU. Memory and IO Operation record of : libcgroup The tool is installed here to ...

  4. VMware Lower setup CentOS The virtual machine and the host are in the same network segment

    Because in the development often use their own computer to build a virtual machine for personal development , The virtual machine uses a smaller command line interface every time it logs in , It doesn't look comfortable either . The following is mainly about centos The virtual machine is configured to share the same network segment with the host IP, Through third party software (put ...

  5. python Basic data type set

    set It's an unordered and non repetitive sequence set It's an unordered and non repetitive sequence set Duplicate sets are not allowed .set Repetitive sequences are not allowed 1. establish s=set() # This is the only way to create an empty collection s={11,222,233, ...

  6. vue2

    props Passing data to subcomponents is often used , It's usually defined in sub components props To accept the data , When the parent component changes the data, the data of the child component is also updated . But there's a hole here , Look at the code first : <pagination :pa ...

  7. JDK8.0 New characteristics

    Link to reprint address :http://www.2cto.com/kf/201609/544044.html Eclipse: http://aiyiupload.oss-cn-beijing.aliyuncs. ...

  8. To configure ssl

    1. To configure <Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000&q ...

  9. MySQL ERROR 1300 (HY000): Invalid utf8 character string

    load data Report errors reason : The raw data contains   chinese \ chinese Such a slashed string . Solution : Replace when exporting  replace(d.role_name,'\\','.' ), So you don't have to deal with it when you import it

  10. GitBash: Right click to add Git Bash Here menu

    step : 1. By means of “ function ” Input in ‘regedit’, Open the registry . 2. find [HKEY_CLASSES_ROOT\Directory\Background]. 3. stay [Background] If not [ ...