DML and Record
DML 操作中,可以直接使用记录,来简化我们的编码。1. insert SQL select * from test1;A B-------------------- ----------test1 99test1 1010test1 1111test1 1212test1 1313SQL declare 2 rec_test1 test1%rowtype; 3 begin 4 rec_test1.a := ‘yuechaotian‘; 5 rec_test1.b := ‘8888‘; 6 insert into test1 values rec_test1; 7 commit; 8 end; 9 /PL/SQL 过程已成功完成。SQL select * from test1;A B-------------------- ----------test1 99test1 1010test1 1111test1 1212test1 1313yuechaotian 8888已选择6行。在 forall 中也可以这样使用。2. upateSQL declare 2 rec_test1 test1%rowtype; 3 begin 4 rec_test1.a := ‘tianyc‘; 5 rec_test1.b := ‘6666‘; 6 update test1 7 set row = rec_test1 8 where a = ‘yuechaotian‘; 9 commit;10 end;11 /PL/SQL 过程已成功完成。SQL select * from test1;A B-------------------- ----------test1 99test1 1010test1 1111test1 1212test1 1313tianyc 6666已选择6行。row 是关键字,表示更新整行。
| 广告合作:400-664-0084 全国热线:400-664-0084 Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号 珠峰网 版权所有 All Rights Reserved
|