URI Datatypes

Peter Goldthorp June 2002

URI datatype are new in 9i. They allow you to store uri's in a database column. This could be an external (http) reference or an internal reference to a location inside the database. Member funtions of the uri type allow you to access the contents of the uri. Examples:

Create a table called metadata_uri to hold the uri's:

create table metadata_uri
(url  sys.uritype not null
, name  varchar2(64));

Insert a row into the table:

insert into metadata_uri values
(sys.HttpUriType('www.oracle.com'), 'oracle')

Select the contents of the uri using a call to getClob():

select e.url.getClob()
 from metadata_uri e
 where e.name = 'oracle'

Reference a mod_plsql package (via Apache):

insert into metadata_uri values
, 'AD_BUGS');

-- direct insert of HttpUriType works but is not recommended in the oracle xml developers guide. It doesn't say why. The recommended approach is to use the urifactory. This works in 9.2 but may fail in 9.0.1:

insert into metadata_uri values
                       , 'AD_BUGS');