getContentType Function
getContentType() function returns the MIME information for the URL. The HttpUriType de-references the URL and gets the MIME header information. You can use this information to decide whether to retrieve the URL as BLOB or CLOB based on the MIME type. You would treat a Web page with a MIME type of x/jpeg as a BLOB, and one with a MIME type of text/plain or text/html as a CLOB.
Example 12-1 Using getContentType() and HttpUriType to Return HTTP Headers
Getting the content type does not fetch all the data. The only data transferred is the HTTP headers (for HTTPURiType) or the metadata of the column (for DBUriType). For example:
declare httpuri HttpUriType; x clob; y blob; begin httpuri := HttpUriType('http://www.oracle.com/object1'); if httpuri.getContentType() = 'application-x/bin' then y := httpuri.getblob(); else x := httpuri.getclob(); end if; end;
Post a comment