반응형
Oracle PL/SQL에서 숫자 배열을 선택하는 방법은 무엇입니까?
배열에 ID 집합을 저장하려고 합니다.
declare
cities_ids array_of_numbers;
begin
select id into cities_ids from objects where id = 1115464;
FOR i IN 1..cities_ids.COUNT LOOP
DBMS_OUTPUT.PUT_LINE(cities_ids(i));
END LOOP;
end;
실행 후 다음 오류가 발생했습니다.
ORA-00932: inconsistent datatypes. Expected UDT, got NUMBER.
제가 뭘 잘못했는지 설명해주세요...
매우 간단합니다.BULK COLLECT
누락되었습니다.
declare
cities_ids array_of_numbers;
begin
select id BULK COLLECT into cities_ids from objects where id = 1115464;
FOR i IN 1..cities_ids.COUNT LOOP
DBMS_OUTPUT.PUT_LINE(cities_ids(i));
END LOOP;
end;
언급URL : https://stackoverflow.com/questions/24488620/how-to-select-into-array-of-numbers-in-oracle-pl-sql
반응형
'code' 카테고리의 다른 글
유형 스크립트에서 최소/최대 길이의 문자열 유형 선언 (0) | 2023.06.07 |
---|---|
MariaDB 이름 길이 가져오기 오류 트리거 (0) | 2023.06.07 |
Firebase 클라우드 기능: onRequest와 onCall의 차이 (0) | 2023.06.07 |
forwardRef: 속성 'ref'가 'IntrinsicAttributes' 유형에 있는 일반 오류가 없습니다. (0) | 2023.06.07 |
'UploadMappingFileTask' 유형 속성 'googleServicesResourceRoot'에 구성된 값이 없습니다. (0) | 2023.06.07 |