USER_DATASTORE with BLOB_LOC Example
The following procedure might be used with OUTPUT_TYPE BLOB_LOC:
procedure myds(rid in rowid, dataout in out nocopy blob)
is
l_dtype varchar2(10);
l_pk number;
begin
select dtype, pk into l_dtype, l_pk from mytable where rowid = rid;
if (l_dtype = 'MOVIE') then
select movie_data into dataout from movietab where fk = l_pk;
elsif (l_dtype = 'SOUND') then
select sound_data into dataout from soundtab where fk = l_pk;
end if;
end;
The user appowner creates the preference as follows:
begin
ctx_ddl.create_preference('myud', 'user_datastore');
ctx_ddl.set_attribute('myud', 'procedure', 'myproc');
ctx_ddl.set_attribute('myud', 'output_type', 'blob_loc');
end;