02 December 2006

HttpUriType In Oracle

Oracle supports to store and manipulate url types. Base type of uri types is UriType type. There are three sub types called HTTPURITYPE, XDBURITYPE and DBURITYPE. For more information please check the docs.
I want to show a simple example with HttpUriType below:

Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as SYS

SQL>
SQL> DECLARE
  2    content CLOB;
  3    uri     httpuritype;
  4  BEGIN
  5    uri     := httpuritype.createUri('http://www.google.com');
  6    content := uri.getClob();
  7    dbms_output.put_line('URI is ' || uri.getUrl());
  8    dbms_output.put_line('Content Type is ' || uri.getContentType());
  9    dbms_output.put_line('Length is ' || length(content));
 10    dbms_output.put_line('Sample of page is ' || substr(content, 1, 100));
 11  END;
 12  /

URI is http://www.google.com
Content Type is text/html
Length is 3164
Sample of page is Google</t</font></p> <p><font color="#000000" face="Courier New">PL/SQL procedure successfully completed</font></p> <p><font color="#000080" face="Courier New">SQL></font> </p></div>

No comments: