Oracle 複雜資料型別

2021-04-20 02:53:44 字數 1173 閱讀 2929

1 記錄型別變數定義

set serveroutput on;

declare 

type stuinfo_record is record(

--用%type定義與stuinfo表字段相匹配的變數型別

temp_stuname stuinfo.stuname% type,

temp_stuno stuinfo.stuno% type,

temp_stu*** stuinfo.stu***% type,

temp_stuage stuinfo.stuage% type,

temp_stuseat stuinfo.set***t% type,

temp_stuaddress stuinfo.stuaddress % type);

--宣告接收資料的變數

emp_record stuinfo_record;

begin

select * from into stuinfo where stuname='mark';

dbms_output_line(emp_record.temp_stuname || emp_record.temp_stuno);

end;

2 表型別變數定義

set serveroutput on;

declare

type stuinfo is table of char(8) index by binary_integer;

emp_stuinfo stuinfo;

i binary_integer:=0;

begin

for recinfor in(select stuname for stuinfo)loop

i:=i+1;

emp_stuinfo(i):recinfor.stuname;

end loop;

end;

3 記錄型別變數定義

declare rec_infor stuinfo%rowtype;

--rec_infor與stuinfo表的每個行的結構型別完全相同

begin

select * into rec_infor from stuinfo stuname='mark';

dmbs_output_line('姓名'+||rec_infor.stuname);

end;

複雜資料型別

1 在c語言中,除了之前學到的基本資料型別 整型,浮點型,字元型 外,還有指標型別和構造型別 結構型,聯合型,列舉型 2 結構體型別,用於把不同型別的資料組合成乙個集合體,宣告格式 struct 結構名 例如 includestruct students void main 結構體的特點是 表示更豐...

複雜資料型別

1結構體 相當於是高階語言裡的類,但是他沒有方法,也就是行為,只有屬性,也就是成員,結構體相當於是自定義類 宣告struct students 當我們需要使用結要用結構體裡的類的屬性時,我們需要通過 運算子來進行呼叫,比如 students.age 2列舉它被用來存放固定的不可改變的型別,比如說,四...

複雜資料型別

1 定義形式 指向的內容的型別 指標名 2 存在空指標 3 指標變數存的是位址。提到指標便會有乙個指向關係。4 指標可以動態申請陣列new。使用後可以delete 5 陣列名是乙個常指標。它指向的位址不再改變。6 指標 指標有當前指向的位置,也就是指標存的位址,加乙個此指標所指向的內容的位元組數大小...