2011-11-28 3 views
1

하나의 스키마에 다음 표가 있습니다. User_Codes(useri_id, user_code). 저장 프로 시저의 다른 스키마에서이 테이블에 액세스하고 스키마 간의 왕복 횟수를 최소화하려고합니다.Oracle PL/SQL Bulk 조건에 따라 컬렉션의 한 열에 수집

저장된 proc에는 사용자 ID와 함께 사용자 데이터가 포함 된 모음이 있습니다. user_ids를 사용하여 다른 스키마에서 해당 user_codes를 가져 오려고합니다.

select uc.user_code 
bulk collect into rowset.user_code 
from other_schema.user_codes uc 
where uc.user_id in (
select distinct rowset_table.user_id 
from table(rowset) rowset_table 
where rowset_table.user_id is not null 
); 

가 어떻게이게 가능 : 그래서 rowset 콜렉션이라고 가정 또는 SQL 표 채워진 user_ids와 사용자 데이터를 포함하고 작성 user_codes로,이 같은 내가 원하는 무엇입니까?

답변

0
그냥 추측

,하지만 어쩌면이 당신을 위해 작동합니다

select rs.user_id, uc.user_code 
    bulk collect into rowset 
    from other_schema.user_codes uc, table(rowset) rs 
    where uc.user_id = rs.user_id; 
관련 문제