The oracle table demo operation statement may be used during the development process. This article will introduce it. If you need it, refer
SQL code
Copy codeThe Code is as follows: -- Created on 2010/07/29 by WANGNAN
Declare
-- Local variables here
I1 VARCHAR2 (20): = '1 ';
I2 VARCHAR2 (20): = '1 ';
I3 VARCHAR2 (20): = '2 ';
I4 VARCHAR2 (20): = '3 ';
I5 VARCHAR2 (20): = '3 ';
I6 VARCHAR2 (20): = '3 ';
I7 VARCHAR2 (20): = '5 ';
I _before VARCHAR2 (20 );
TYPE t_type is table of VARCHAR2 (20 );
T_table t_type;
BEGIN
-- Test statements here
T_table: = t_type ();
T_table.extend;
T_table (1): = i1;
T_table.extend;
T_table (2): = i2;
T_table.extend;
T_table (3): = i3;
T_table.extend;
T_table (4): = i4;
T_table.extend;
T_table (5): = i5;
T_table.extend;
T_table (6): = i6;
T_table.extend;
T_table (7): = i7;
FOR I IN 1 .. t_table.count LOOP
IF I _before is null or I _before <> t_table (I) THEN
I _before: = t_table (I );
Dbms_output.put_line (t_table (I ));
End if;
End loop;
EXCEPTION WHEN OTHERS THEN
Dbms_output.put_line (Sqlerrm );
End;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service