Home  >  Article  >  Database  >  Oracle Table Demo语句应用介绍

Oracle Table Demo语句应用介绍

WBOY
WBOYOriginal
2016-06-07 17:55:471174browse

在开发过程中可能会用到oracle table demo 操作语句,本文将以此进行介绍,需要的朋友可以参考下

在开发过程中可能会用到oracle table demo 操作语句,本文将以此进行介绍,需要的朋友可以参考下
Sql代码
代码如下:
-- 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;
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn