陣列RECORD使用

2021-09-02 12:42:19 字數 892 閱讀 2737

record 型別的變數只能儲存從資料庫中查詢出的一行記錄,如果查詢出了多行記錄,就會出現錯誤。

-- record型別變數直接賦值

declare

type type_record_user is record(

user_id number(10),

user_name varchar2(20));

record_user type_record_user;

begin

record_user.user_id := 11;

record_user.user_name := 'aaa';

dbms_output.put_line('userid:' || record_user.user_id);

dbms_output.put_line('username:' || record_user.user_name);

end;

-- record型別變數讀表賦值

declare

type type_record_emp is record(

emp_no emp.empno%type,

emp_name emp.ename%type);

record_emp type_record_emp;

begin

select empno,

ename

into record_emp

from emp

where empno = &emp_no; -- 7369

dbms_output.put_line('顧客編號:' || record_emp.emp_no);

dbms_output.put_line('顧客名稱:' || record_emp.emp_name);

end;

Oracle記錄型別(record 使用

record 儲存單行多列結構的資料.type語句定義記錄型別的語法形式 type 記錄名 is record field1 name data type not null default value fieldn name data type not null default value 例項 定...

Record24 陣列型別及陣列指標基礎

目錄 陣列的理論知識 基本定義 陣列的初始化 陣列名的技術盲點 陣列型別 陣列指標 總體 從元素型別角度看,陣列是相同型別的變數的有序集合 測試指標變數占有記憶體空間大小 從記憶體角度看,陣列是互相 聯絡的一大片記憶體空間,如圖。分為隱式指定和顯式指定兩種,其中 隱式指定,相當於不指定陣列長度,為 ...

學習record相關知識

概念 當使用元組進行程式設計的時候,如果過於龐大的元素數量,將會很難記住。record提出來,是用於提供c語言裡面的一種類似structure的乙個有著固定數目字段的資料結構。記錄定義 record person,構造乙個record p1 person.例項 author erlang.hell ...