Oracle PL/SQL 入门语句
-- drop table tb_demo;--create table tb_demo (-- id number(6),-- name varchar2(20),-- birthday date,-- email varchar2(50) unique--);-- insert into tb_demo(id, name, birthday, email) values (1, 'nnn', to_date('2004-12-06 03:23:00','YYYY-MM-DD HH24:MI:SS'), 'hps_ing@126.com');-- %rowtypedeclarev_rec tb_demo%rowtype;begin select t.id, t.name, t.birthday, t.email into v_rec from tb_demo t where id=1; dbms_output.put_line(v_rec.email || v_rec.name);end;-- varray数组declaretype varr is varray(3) of varchar2(10);strs varr:=varr('aaa','bbb','ccc');begindbms_output.put_line(strs(1));dbms_output.put_line(strs(2));dbms_output.put_line(strs(3));end;-- table 可变长数组declaretype vartab is table of tb_demo%rowtypeindex by binary_integer;v_list vartab;begin select t.id, t.email into v_list(1).id, v_list(10).email from tb_demo t where id=1; dbms_output.put_line(v_list(1).id); dbms_output.put_line(v_list(10).email);end;-- forbegin for i in 3 .. 9 loop dbms_output.put_line(i); end loop;end;
?