在存儲(chǔ)過(guò)程中有許多的東西很多人都不知道,但是確實(shí)很有用,今天我就碰上了幾個(gè)帶%的類型。
1、%notfound
布爾型屬性,當(dāng)最近一次讀取紀(jì)錄不成功時(shí),返回true.
eg:declare
begin
update stu set name='齊文進(jìn)' where stu_id=28;
if sql%notfound then
statememnet;
end if;
end;
2、%rowtype
這是一個(gè)用來(lái)定義一個(gè)表中指定的移行紀(jì)錄的變量類型。
定義時(shí),變量名 表名%rowtype.
使用時(shí),變量名.表中字段名
3、%type
這是用來(lái)定義表中字段與定義字段類型相同時(shí)用的。
eg:變量 表名.字段%type
1、%notfound
布爾型屬性,當(dāng)最近一次讀取紀(jì)錄不成功時(shí),返回true.
eg:declare
begin
update stu set name='齊文進(jìn)' where stu_id=28;
if sql%notfound then
statememnet;
end if;
end;
2、%rowtype
這是一個(gè)用來(lái)定義一個(gè)表中指定的移行紀(jì)錄的變量類型。
定義時(shí),變量名 表名%rowtype.
使用時(shí),變量名.表中字段名
3、%type
這是用來(lái)定義表中字段與定義字段類型相同時(shí)用的。
eg:變量 表名.字段%type