Oracle 집합
1. 연관 배열
그 정의 문법 은 type 배열 이름 is table of 요소 형식 index by 색인 형식 입 니 다.
색인 형식 은 varchar 2 형식 과 pls 일 수 있 습 니 다.integer 형식 입 니 다. 예 를 들 어:
declare
--
type student_list is table of student%rowtype index by pls_integer;
--
student_list_var student_list;
--
cursor student_cursor is
select * from student;
begin
-- , student_index
for student_index in student_cursor
loop
-- id student number , . java map
student_list_var(student_index.id) := student_index;
end loop;
2. 내장 배열
문법: type 배열 이름 is table of 원소 형식
예 를 들 면:
--
type list_of_name is table of varchar2(100);
-- , student
type list_of_student is table of student%rowtype;
사용 예시:
--
create type student_table is table of student%rowtype;
--
create or replace of function list_studect(student_name in student.name%type) return student_table is
--
cursor student_cursor(student_name in student.name%type) is
select * from student where name like student_name||'%';
--
student_var student%rowtype;
--
student_table_var student_table;
--
index_var pls_integer := 0;
begin
--
student_table_var =: student_table();
--
for cur_index in student_cursor(student_name)
loop
--
student_table_var.extend;
-- 1 , ,
index_var := index_var + 1;
--
student_table_var(index_var) := cur_index;
end loop;
return student_table_var;
end;
3. VARRAY (가 변 길이 배열)
문법: type 배열 이름 is varray (배열 길이) of 요소 유형
예 를 들 면:
--
type list_of_name is varray(100) of varchar2(100);
-- , student
type list_of_student is varray(500) of student%rowtype;
VARRAY 의 사용 과 끼 워 넣 는 표 의 차이 가 많 지 않 습 니 다. 유일한 차이 점 은 VARRAY 가 길이 제한 이 있다 는 것 입 니 다.
그들의 차 이 는 다음 그림 과 같다.
속성
연관 배열
상감 표
varray
위도
일차 원
일차 원
일차 원
SQL 에 사용 할 지 여부
사용 할 수 없다
사용 가능
사용 가능
표 에 열 거 된 데이터 형식 으로 사용 할 수 있 는 지 여부
사용 할 수 없다
사용 가능
사용 가능
초기 화 된 상태
빈 (NULL 일 수 없 음) 요 소 는 정의 되 지 않 았 습 니 다.
자동 으로 NULL 입 니 다. 요소 에 대한 인용 은 불법 입 니 다.
자동 으로 NULL 입 니 다. 요소 에 대한 인용 은 불법 입 니 다.
초기 화
성명 시 자동 완성
구조 함수 또는 할당 또는 fetch 작업 을 통 해 완료 합 니 다.
구조 함수 또는 할당 또는 fetch 작업 을 통 해 완료 합 니 다.
드문드문
예.
시작은 아니 었 다.지우 면 돼 요.
아니다
경계 가 있 는 지 없 는 지
무한 하 다
확장 가능
아니다
임의의 원소 에 수시로 값 을 부여 할 수 있다
되다
안 됩 니 다. extend 로 확장 해 야 합 니 다.
안 됩 니 다.먼저 extend 로 확장 할 수 있 으 며, extend 확장 시 상 경 계 를 초과 할 수 없습니다.
확장 방법
새 아래 표 시 된 요소 에 값 을 부여 합 니 다.
extend 프로 세 스 (또는 trim 압축) 를 사용 하여 미리 정 의 된 최대 값 이 없습니다.
extend (또는 trim), 하지만 최대 성명 의 최대 크기 까지 만 가능 합 니 다.
여부
안 된다
네, Oacle10g 또는 이후 버 전 으로 요청 합 니 다.
안 된다
집합 연산 자 를 통 해 조작 할 지 여부
안 된다
네, Oacle10g 또는 이후 버 전 으로 요청 합 니 다.
안 된다
데 이 터 를 액세스 할 때 순서 나 아래 표 시 를 유지 할 지 여부 입 니 다.
N/A
보류 하지 않 음
보류 하 다.
다음 편 은 Spring 을 쓰 겠 습 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
자바 작업 은 Clob 또는 NClob 데이터 형식의 저장 프로 세 스 인 스 턴 스 를 포함 합 니 다.텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.