1

1 つのスキーマに次のテーブルがあります: User_Codes(useri_id, user_code). ストアド プロシージャ内の別のスキーマからこのテーブルにアクセスし、スキーマ間の往復回数を最小限に抑えたいと考えています。

ストアド プロシージャには、ユーザー ID と共にユーザー データを含むコレクションがあります。user_ids を使用して、対応する user_codes を他のスキーマから取得したいと考えています。rowsetそのため、user_id が入力され、user_code が入力されるユーザー データを含むコレクションまたは SQL TABLE であると仮定すると、次のようなものが必要になります。

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
);

これは可能ですか?

4

1 に答える 1

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;
于 2011-11-28T23:20:22.427 に答える