CODE
Oracle Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
PSOUG Home Code Snippets Oracle Reference Oracle Functions PSOUG Forum Oracle Blogs Bookmark and Share
 
 Search the Reference Library pages:  

Free
Oracle Magazine
Subscriptions
and Oracle White Papers

Oracle HTP Web HTTP
Version 11.1
 
General Information
Source {ORACLE_HOME}/rdbms/admin/pubht.sql
First Availability 8.1.7
Constants
Name Data Type Value

NL_CHAR

VARCHAR2(10) owa_cx.nl_char

owa_version

VARCHAR2(64) '10.1.2.0.0'
Data Types -- PL/SQL table used for output buffering
HTBUF_LEN number := 255;
type htbuf_arr is table of VARCHAR2(256) index by binary_integer;
type htraw_arr is table of raw(256) index by binary_integer;
Dependencies SELECT name FROM dba_dependencies WHERe referenced_name = 'HTP'
UNION
SELECT referenced_name FROM dba_dependencies WHERE name = 'HTP';
Security Model No privileges granted
 
HTP Procedures
Procedure Name Syntax
Structure Tags
BODYCLOSE htp.bodyClose;
set serveroutput on

BEGIN
  htp.htmlOpen;
  htp.headOpen;
  htp.title('Structure Tags Demo');
  htp.headClose;
  htp.bodyOpen
  htp.print('Structure Tags Demo');
  htp.bodyClose;
  htp.htmlClose;
END;
/

exec owa_util.showpage;
BODYOPEN htp.bodyOpen (
cbackground  VARCHAR2 DEFAULT NULL,
cattributes  VARCHAR2 DEFAULT NULL);
See BODYCLOSE Demo
HEADCLOSE htp.headClose;
See BODYCLOSE Demo
HEADOPEN htp.headOpen;
See BODYCLOSE Demo
HTMLCLOSE htp.htmlClose;
See BODYCLOSE Demo
HTMLOPEN htp.htmlOpen;
See BODYCLOSE Demo
Head Related Tags
BASE
generates the <BASE> tag that records the URL of the document
htp.base (
ctarget     IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
<BASE HREF="<current URL>" TARGET="ctarget" cattributes>
HTITLE htp.htitle(
ctitle      IN VARCHAR2 CHARACTER SET ANY_CS,
nsize       IN INTEGER DEFAULT 1,
calign      IN VARCHAR2 DEFAULT NULL,
cnowrap     IN VARCHAR2 DEFAULT NULL,
cclear      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
set serveroutput on

DECLARE
 x VARCHAR2(250) := 'Hide script from non-supporting browsers
function showDate(thisDay){document.Calendar.dateInfo.value = daySchedule[thisDay]} // end hiding script';
BEGIN
  htp.htmlOpen;
  htp.headOpen;
  htp.meta('Content-Language', NULL, 'en');
  htp.meta(NULL, 'GENERATOR', 'Morgan');
  htp.title('Head Tags Demo');
  htp.headClose;
  htp.bodyOpen;
-- htp.base;
  htp.script(x, 'JavaScript');
  htp.htitle('Our Title', 2, 'Center');
  htp.bodyClose;
  htp.htmlClose;
END;
/

exec owa_util.showpage;
ISINDEX
Creates a single entry field with a prompting text, such as "enter value," then sends that value to the URL of the page or program
htp.isindex (
cprompt IN VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL,
curl    IN VARCHAR2 DEFAULT NULL);
<ISINDEX PROMPT="cprompt" HREF="curl">
LINKREL
generates the <LINK> tag with the REL attribute which delineates the relationship described by the hypertext link from the anchor to the target
htp.linkRel (
crel   IN VARCHAR2,
curl   IN VARCHAR2, 
ctitle IN VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL);
<LINK REL="crel" HREF="curl" TITLE="ctitle">
LINKREV
generates the <LINK> tag with the REV attribute which delineates the relationship described by the hypertext link from the target to the anchor.
htp.linkRev (
crev   IN VARCHAR2, 
curl   IN VARCHAR2, 
ctitle IN VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL);
<LINK REV="crev" HREF="curl" TITLE="ctitle">
META
generates the tag, that embeds  meta-information about the document
htp.meta (
chttp_equiv IN VARCHAR2,
cname       IN VARCHAR2,
ccontent    IN VARCHAR2);
See HTITLE Demo
NEXTID
Undocumented
htp.nextid(cidentifier IN VARCHAR2);
TBD
SCRIPT
generates the <SCRIPT> and </SCRIPT> tags which contain a script written in languages such as JavaScript and VBscript
htp.script (
cscript   IN VARCHAR2,
clanguage IN VARCHAR2 DEFAULT NULL);
See HTITLE Demo
STYLE
generates the <STYLE> and </STYLE> tags which include a style sheet in a Web page
htp.style(cstyle IN VARCHAR2 CHARACTER SET ANY_CS);
<STYLE>cstyle</STYLE>
TITLE htp.title(ctitle IN VARCHAR2 CHARACTER SET ANY_CS);
See HTITLE Demo
Body Element Tags
ADDRESS
generates the <ADDRESS> and </ADDRESS> tags which specify the address, author and signature of a document
htp.address (
cvalue      IN VARCHAR2
cnowrap     IN VARCHAR2 DEFAULT NULL
cclear      IN VARCHAR2 DEFAULT NULL
cattributes IN VARCHAR2 DEFAULT NULL);
set serveroutput on

BEGIN
  htp.htmlOpen;
  htp.headOpen;
  htp.title('Body Elements Demo');
  htp.headClose;
  htp.bodyOpen;

  htp.address ('If you have any questions, please email the '||
  htp.anchor('mailto:webmaster@psoug.org','WebMaster'));

  htp.bodyClose;
  htp.htmlClose;
END;
/

exec owa_util.showpage;
ANCHOR
generate the <A> and </A> HTML tags which specify the source or destination of a hypertext link
htp.anchor (
curl         IN VARCHAR2,
ctext        IN VARCHAR2,
cname        IN VARCHAR2 DEFAULT NULL,
cattributes  IN VARCHAR2 DEFAULT NULL);
See ADDRESS Demo
ANCHOR2
same as ANCHOR except ANCHOR2 provides a target and therefore can be use for frames
htp.anchor2 (
curl         IN VARCHAR2,
ctext        IN VARCHAR2,
cname        IN VARCHAR2 DEFAULT NULL,
ctarget      IN VARCHAR2 DEFAULT NULL,
cattributes  IN VARCHAR2 DEFAULT NULL);
See ADDRESS Demo
AREA
generates the <AREA> tag, which defines a client-side image map. The <AREA> tag defines areas within the image and destinations for the areas
htp.area (
ccoords      IN VARCHAR2
cshape       IN VARCHAR2   DEFAULT NULL,
chref        IN VARCHAR2   DEFAULT NULL,
cnohref      IN VARCHAR2   DEFAULT NULL,
ctarget      IN VARCHAR2   DEFAULT NULL,
cattributes  IN VARCHAR2   DEFAULT NULL);
<AREA>

set serveroutput on

BEGIN
  htp.htmlOpen;
  htp.headOpen;
  htp.title('Area Demo');
  htp.headClose;
  htp.bodyOpen;
  htp.area('0,0,82,126', 'rect', 'www.psoug.org', NULL, '_blank');
  htp.bodyClose;
  htp.htmlClose;
END;
/

exec owa_util.showpage;
BGSOUND
generates the <BGSOUND> tag which includes audio for a Web page
htp.bgsound (
csrc         IN VARCHAR2,
cloop        IN VARCHAR2 DEFAULT NULL,
cattributes  IN VARCHAR2 DEFAULT NULL);
<BGSOUND SRC="csrc" LOOP="cloop" cattributes>
BLOCKQUOTECLOSE 
mark the beginning of a section of quoted text
htp.blockquoteClose;
set serveroutput on

BEGIN
  htp.htmlOpen;
  htp.headOpen;
  htp.title('Blockquote Demo');
  htp.headClose;
  htp.comment('Comment HTML');
  htp.bodyOpen;
  htp.header(2, 'This is the page header');
  htp.blockquoteopen;
  htp.print('This is some text');
  htp.blockquoteclose;
  htp.centeropen;
  htp.line;
  htp.hr;
  htp.print('Line 1');
  htp.centerClose;
  htp.br;
  htp.center('Line 2');
  htp.bodyClose;
  htp.htmlClose;
END;
/

exec owa_util.showpage;
BLOCKQUOTEOPEN
mark the beginning of a section of quoted text
htp.blockquoteOpen (
cnowrap     IN VARCHAR2 DEFAULT NULL,
cclear      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
See BLOCKQUOTECLOSE Demo
BR
Line Break: generates the <BR> tag that starts a new line of text
htp.br (
cclear      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
See BLOCKQUOTECLOSE Demo
CENTER
centers text between <CENTER> and </CENTER>
htp.center(ctext IN VARCHAR2 CHARACTER SET ANY_CS);
See BLOCKQUOTECLOSE Demo
CENTERCLOSE
generateds </CENTER> to close after a  CENTEROPEN
htp.centerClose;
See BLOCKQUOTECLOSE Demo
CENTEROPEN
generates <CENTER> to begin centering text and objects.
htp.centerOpen;
See BLOCKQUOTECLOSE Demo
COMMENT
generates the comment tag <!-- ctext -->
htp.comment(ctext IN VARCHAR2 CHARACTER SET ANY_CS);
See BLOCKQUOTECLOSE Demo
DIV
generates the <DIV> tag which creates document divisions
htp.div (
calign      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
set serveroutput on

BEGIN
  htp.htmlOpen;
  htp.headOpen;
  htp.title('Div Demo');
  htp.headClose;
  htp.bodyOpen;
  htp.div('left', 'color:#FF0000;');
  htp.p('Left Justified Text');
  htp.div('center', 'color:#FFFF00;');
  htp.p('Center Justified Text');
  htp.div('right',
' color:#FF00FF;');
  htp.p('Right Justified Text');
  htp.bodyClose;
  htp.htmlClose;
END;
/

exec owa_util.showpage;
HEADER
generates opening heading tags (<H1> to <H6>) and their corresponding closing tags (</H1> to </H6>)
htp.header (
nsize       IN INTEGER,
cheader     IN VARCHAR2 CHARACTER SET ANY_CS,
calign      IN VARCHAR2 DEFAULT NULL,
cnowrap     IN VARCHAR2 DEFAULT NULL,
cclear      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
htp.header(1, 'Hello World');
<H1>Hello world</H1>
HR
Horizontal Rule: generates <HR> tag
htp.hr (
cclear      IN VARCHAR2 DEFAULT NULL,
csrc        IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
See BLOCKQUOTECLOSE Demo
IMG
generates the <IMG> tag, which directs the browser to load an image onto the HTML page.
htp.img (
curl        IN VARCHAR2,
calign      IN VARCHAR2 DEFAULT NULL,
calt        IN VARCHAR2 DEFAULT NULL,
cismap      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
set serveroutput on

BEGIN
  htp.htmlOpen;
  htp.headOpen;
  htp.title('IMG Tag Demo');
  htp.headClose;
  htp.bodyOpen;
  htp.img('http://www.psoug.org/source/horizlogo.gif', 'Center');
  htp.bodyClose;
  htp.htmlClose;
END;
/

exec owa_util.showpage;
IMG2
generates the <IMG> tag, which directs the browser to load an image onto the HTML page. The IMG Function performs the same operation but does not use the cusemap parameter.
htp.img2 (
curl        IN VARCHAR2,
calign      IN VARCHAR2 DEFAULT NULL,
calt        IN VARCHAR2 DEFAULT NULL,
cismap      IN VARCHAR2 DEFAULT NULL,
cusemap     IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
See IMG Tag Demo
LINE
generates <HR> tag
htp.line (
cclear      IN VARCHAR2 DEFAULT NULL,
csrc        IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
See BLOCKQUOTECLOSE Demo
LISTINGCLOSE htp.listingClose;
set serveroutput on

BEGIN
  htp.htmlOpen;
  htp.headOpen;
  htp.title('Listing Tags Demo');
  htp.headClose;
  htp.bodyOpen;
  htp.listingopen;
  htp.p('fixed');
  htp.p('width');
  htp.p('font');
  htp.p('tag');
  htp.listingclose;
  htp.bodyClose;
  htp.htmlClose;
END;
/

exec owa_util.showpage;
LISTINGOPEN
generates the <LISTING> tag which marks the beginning of a section of fixed-width text in the body of an HTML page.
htp.listingOpen;
See LISTINGCLOSE Demo
MAILTO htp.mailto (
caddress    IN VARCHAR2,
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cname       IN VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
htp.mailto('damorgan@psoug.org','Email to Morgan')

<A HREF="mailto:damorgan@psoug.org">Email to Morgan</A>
MAPCLOSE htp.mapClose;
TBD
MAPOPEN htp.mapOpen (
cname       IN VARCHAR2,
cattributes IN VARCHAR2 DEFAULT NULL);
TBD
NL htp.nl (
cclear      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
 
NOBR htp.nobr(ctext IN VARCHAR2 CHARACTER SET ANY_CS);
<NOBR>
PARA htp.para;
set serveroutput on

BEGIN
  htp.htmlOpen;
  htp.headOpen;
  htp.title('Paragraph Demo');
  htp.headClose;
  htp.bodyOpen;
  htp.para;
  htp.bodyClose;
  htp.htmlClose;
END;
/

exec owa_util.showpage;
PARAGRAPH htp.paragraph ( 
calign      IN VARCHAR2 DEFAULT NULL,
cnowrap     IN VARCHAR2 DEFAULT NULL,
cclear      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
<P>
PRECLOSE htp.preClose;
</PRE>
PREOPEN htp.preOpen (
cclear      IN VARCHAR2 DEFAULT NULL,
cwidth      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
<PRE>
WBR htp.wbr;
<WBR>
List Tags
DIRLISTCLOSE htp.dirlistClose;
</DIR>
DIRLISTOPEN htp.dirlistOpen;
<DIR>
DLISTCLOSE htp.dlistClose;
</DL>
DLISTDEF htp.dlistDef (
ctext       IN VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL,
cclear      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
<DD>
DLISTOPEN htp.dlistOpen (
cclear      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
<DL>
DLISTTERM htp.dlistTerm (
ctext       IN VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL,
cclear      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
<DT>
LISTHEADER htp.listHeader (
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
 
LISTITEM htp.listItem (
ctext       IN VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL,
cclear      IN VARCHAR2 DEFAULT NULL,
cdingbat    IN VARCHAR2 DEFAULT NULL,
csrc        IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
 
MENULISTCLOSE htp.menulistClose;
 
MENULISTOPEN htp.menulistOpen;
 
OLISTCLOSE htp.olistClose;
 
OLISTOPEN htp.olistOpen (
cclear      IN VARCHAR2 DEFAULT NULL,
cwrap       IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
 
ULISTCLOSE htp.ulistClose;
</UL>
ULISTOPEN htp.ulistOpen (
cclear      IN VARCHAR2 DEFAULT NULL,
cwrap       IN VARCHAR2 DEFAULT NULL,
cdingbat    IN VARCHAR2 DEFAULT NULL,
csrc        IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
<UL>
Semantic Format Elements
BIG (increase font size) htp.big (
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
<B>
CITE htp.cite (
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
 
CODE htp.code (
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
 
DFN htp.dfn(
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
 
EM htp.em (
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL) ;
 
EMPHASIS htp.emphasis (
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
 
KBD htp.kbd (
ctext       IN VARCHAR2,
cattributes IN VARCHAR2 DEFAULT NULL);
 
KEYBOARD htp.keyboard (
ctext       IN VARCHAR2,
cattributes IN VARCHAR2 DEFAULT NULL);
 
SAMPLE htp.sample (
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
 
SMALL htp.small (
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
 
STRONG htp.strong (
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
<B>
SUB htp.sub (
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
calign      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
 
SUP htp.sup (
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
calign      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
 
VARIABLE htp.variable (
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL) ;
 
Physical Format Elements
BASEFONT htp.basefont(nsize IN INTEGER);
 
BOLD htp.bold (
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
<B>Oracle Database Administrator</B>
FONTCLOSE htp.fontClose;
</FONT>
FONTOPEN htp.fontOpen (
ccolor      IN VARCHAR2 DEFAULT NULL,
cface       IN VARCHAR2 DEFAULT NULL,
csize       IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
<FONT>
ITALIC htp.italic (
ctext        IN VARCHAR2,
cattributes  IN VARCHAR2  DEFAULT NULL);
<I>ctext</I>
PLAINTEXT htp.plaintext (
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL) ;
<PLAINTEXT>
S htp.s (
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL) ;
 
STRIKE htp.strike (
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL) ;
 
TELETYPE htp.teletype (
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
 
UNDERLINE htp.underline (
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL) ;
<U><text></U>
HTML Forms Elements
FORMCHECKBOX htp.formCheckbox (
cname       IN VARCHAR2,
cvalue      IN VARCHAR2 CHARACTER SET ANY_CS DEFAULT 'on',
cchecked    IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
<INPUT TYPE="CHECKBOX">
FORMCLOSE htp.formClose;
</FORM>
FORMFILE htp.formFile (
cname       IN VARCHAR2,
caccept     IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
 
FORMHIDDEN htp.formHidden (
cname       IN VARCHAR2,
cvalue      IN VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
<INPUT TYPE="HIDDEN">
FORMIMAGE htp.formImage (
cname       IN VARCHAR2,
csrc        IN VARCHAR2,
calign      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
<INPUT TYPE="IMAGE">
FORMOPEN htp.formOpen (
curl        IN VARCHAR2,
cmethod     IN VARCHAR2 DEFAULT 'POST',
ctarget     IN VARCHAR2 DEFAULT NULL,
cenctype    IN VARCHAR2 DEFAULT NULL, 
cattributes IN VARCHAR2 DEFAULT NULL);
BEGIN
  -- Open the HTML page, head and title
  htp.htmlOpen;
  htp.headOpen;
  htp.title('Employee Query Form');
  htp.headClose;
  htp.bodyOpen;
  htp.header(1, 'Employee Query Form');
  htp.para;
  htp.print('Fill in your last name and click on the ');
  htp.print('Submit Query button');
  htp.para;
  -- Start the HTML form. 
  -- The ACTION should be /nashdcd/owa/query_results

  htp.formOpen('/nashdcd/owa/query_results', 'POST', NULL, NULL);
  htp.print('Please supply the last name of the Employee:');
  htp.para;
  -- Create a text field named 'lastname'. 30 characters long
  htp.formText('lastname', 30, 30, NULL, NULL);
  -- Make the Submit and Reset buttons
  htp.para;
  htp.formSubmit(NULL, 'Submit Query', NULL);
  htp.formReset('Clear Form', NULL);
  -- Close the HTML form
  htp.formClose;
  -- Close the HTML body and page
  htp.bodyClose;
  htp.htmlClose;
END;
/

exec owa_util.showpage;
FORMPASSWORD htp.formPassword (
cname       IN VARCHAR2,
csize       IN VARCHAR2 DEFAULT NULL,
cmaxlength  IN VARCHAR2 DEFAULT NULL,
cvalue      IN VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
<INPUT TYPE="PASSWORD">
FORMRADIO htp.formRadio (
cname       IN VARCHAR2,
cvalue      IN VARCHAR2 CHARACTER SET ANY_CS,
cchecked    IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
<INPUT TYPE="RADIO">
FORMRESET htp.formReset (
cvalue      IN VARCHAR2 CHARACTER SET ANY_CS DEFAULT 'Reset',
cattributes IN VARCHAR2 DEFAULT NULL);
<INPUT TYPE="RESET">
FORMSELECTCLOSE htp.formSelectClose;
</SELECT>
FORMSELECTOPEN htp.formSelectOpen (
cname       IN VARCHAR2,
cprompt     IN VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL,
nsize       IN INTEGER DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
<SELECT>

htp.formSelectOpen('greatest_player';
'Pick the greatest player:');
htp.formSelectOption('Messier');
htp.formSelectOption('Howe');
htp.formSelectOption('Hull');.
htp.formSelectOption('Gretzky');.
htp.formSelectClose; generates: Pick the greatest player:
<SELECT NAME="great player">
<OPTION>Messier
<OPTION>Howe
<OPTION>Hull
<OPTION>Gretzky
</SELECT>
FORMSELECTOPTION htp.formSelectOption (
cvalue      IN VARCHAR2 CHARACTER SET ANY_CS,
cselected   IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
<OPTION>
FORMSUBMIT htp.formSubmit (
cname       IN VARCHAR2 DEFAULT NULL,
cvalue      IN VARCHAR2 CHARACTER SET ANY_CS DEFAULT 'Submit',
cattributes IN VARCHAR2 DEFAULT NULL);
<INPUT TYPE="SUBMIT">
FORMTEXT htp.formText (
cname       IN VARCHAR2,
csize       IN VARCHAR2 DEFAULT NULL,
cmaxlength  IN VARCHAR2 DEFAULT NULL,
cvalue      IN VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
 
FORMTEXTAREA htp.formTextarea (
cname       IN VARCHAR2,
nrows       IN INTEGER,
ncolumns    IN INTEGER,
calign      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
<TEXTAREA>
FORMTEXTAREA2 htp.formTextarea2 (
cname       IN VARCHAR2,
nrows       IN INTEGER,
ncolumns    IN INTEGER,
calign      IN VARCHAR2 DEFAULT NULL,
cwrap       IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
 
FORMTEXTAREACLOSE htp.formTextareaClose;
</TEXTAREA>
FORMTEXTAREAOPEN htp.formTextareaOpen (
cname       IN VARCHAR2,
nrows       IN INTEGER,
ncolumns    IN INTEGER,
calign      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
<TEXTAREA>
FORMTEXTAREAOPEN2 htp.formTextareaOpen2 (
cname       IN VARCHAR2,
nrows       IN INTEGER,
ncolumns    IN INTEGER,
calign      IN VARCHAR2 DEFAULT NULL,
cwrap       IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
 
HTML Table Tags
TABLECAPTION htp.tableCaption (
ccaption    IN VARCHAR2 CHARACTER SET ANY_CS,
calign      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
<CAPTION>
TABLECLOSE htp.tableClose;
</TABLE>
TABLEDATA htp.tableData(
cvalue      IN VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL,
calign      IN VARCHAR2 DEFAULT NULL,
cdp         IN VARCHAR2 DEFAULT NULL,
cnowrap     IN VARCHAR2 DEFAULT NULL,
crowspan    IN VARCHAR2 DEFAULT NULL,
ccolspan    IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
 
TABLEHEADER htp.tableHeader (
cvalue      IN VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL,
calign      IN VARCHAR2 DEFAULT NULL,
cdp         IN VARCHAR2 DEFAULT NULL,
cnowrap     IN VARCHAR2 DEFAULT NULL,
crowspan    IN VARCHAR2 DEFAULT NULL,
ccolspan    IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
 
TABLEOPEN htp.tableOpen (
cborder     IN VARCHAR2 DEFAULT NULL,
calign      IN VARCHAR2 DEFAULT NULL,
cnowrap     IN VARCHAR2 DEFAULT NULL,
cclear      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
<TABLE>
TABLEROWCLOSE htp.tableRowClose;
</TR>
TABLEROWOPEN htp.tableRowOpen (
calign      IN VARCHAR2 DEFAULT NULL,
cvalign     IN VARCHAR2 DEFAULT NULL,
cdp         IN VARCHAR2 DEFAULT NULL,
cnowrap     IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
<TR>
Frames Tags
FRAME htp.frame (
csrc          IN VARCHAR2,                -- URL
cname         IN VARCHAR2 DEFAULT NULL,   -- Window Name
cmarginwidth  IN VARCHAR2 DEFAULT NULL,   -- Value in pixels
cmarginheight IN VARCHAR2 DEFAULT NULL,   -- Value in pixels
cscrolling    IN VARCHAR2 DEFAULT NULL,   -- yes | no | auto
cnoresize     IN VARCHAR2 DEFAULT NULL,
cattributes   IN VARCHAR2 DEFAULT NULL);  -- Not resizable by user
 
FRAMESETCLOSE htp.framesetClose;
 
FRAMESETOPEN htp.framesetOpen (
crows       IN VARCHAR2 DEFAULT NULL,   -- row height value list
ccols       IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);  -- column width list
 
NOFRAMESCLOSE htp.noframesClose;
 
NOFRAMESOPEN htp.noframesOpen;
 
Special Tags
APPLETCLOSE htp.appletclose;
 
APPLETOPEN htp.appletopen (
ccode        IN VARCHAR2,
cheight      IN INTEGER,
cwidth       IN INTEGER,
cattributes  IN VARCHAR2 DEFAULT NULL);

<APPLET CODE=ccode HEIGHT=cheight WIDTH=cwidth cattributes>
htp.appletopen ('testclass.class',100,200,'CODEBASE="/ows-applets"')

<APPLET CODE=ccode HEIGHT=cheight WIDTH=cwidth cattributes>
PARAM htp.param (
cname  IN VARCHAR2,
cvalue IN VARCHAR2 CHARACTER SET ANY_CS);
<PARAM>
Special Procedures
ADDDEFAULTHTMLHDR

call addDefaultHTMLHdr(FALSE) before your first call to prn or print to suppress HTML header generation if not present
htp.addDefaultHTMLHdr(bAddHTMLHdr IN BOOLEAN);
 
FLUSH htp.flush;
 
INIT htp.init;
 
OAS Specific Helper Procedures
FLUSH_CHARSET_CONVERT htp.flush_charset_convert (charset IN VARCHAR2);
 
GET_PAGE_CHARSET_CONVERT htp.get_page_charset_convert (
thepage     OUT NOCOPY htbuf_arr,
irows    IN OUT INTEGER,
charset  IN     VARCHAR2);
 
Add RAW transfer API
GET_PAGE_RAW htp.get_page_raw (
thepage    OUT NOCOPY htraw_arr,
irows   IN OUT INTEGER);
 
SHOWPAGE htp.showpage;
 
File Download Feature
DOWNLOAD_FILE htp.download_file (
sFileName IN VARCHAR2,
bCompress IN BOOLEAN DEFAULT FALSE);
 
GET_DOWNLOAD_FILES_LIST htp.get_download_files_list (
sFilesList OUT VARCHAR2,
nCompress  OUT BINARY_INTEGER);
Output Procedures
P (Abbrev call to print)
Overload 1
htp.p(cbuf IN VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL);
P (Abbrev call to print)
Overload 2
htp.p(dbuf IN DATE);
P (Abbrev call to print)
Overload 3
htp.p (nbuf IN NUMBER);
PRINT
Overload 1
htp.print(cbuf IN VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL);
set serveroutput on

BEGIN
  htp.htmlOpen;
  htp.headOpen;
  htp.title('Print Demo');
  htp.headClose;
  htp.bodyOpen;
  htp.print('Print Proc Demo');        -- string
  htp.print(TO_DATE('01-JAN-2006'));   -- date
  htp.print(42);                       -- number
  htp.bodyClose;
  htp.htmlClose;
END;
/

exec owa_util.showpage;
PRINT
Overload 2
htp.print(dbuf IN DATE);
See Print Demo above
PRINT
Overload 3
htp.print(nbuf IN NUMBER);
See Print Demo above
PRN (without newline)
Overload 1
htp.prn (cbuf IN VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL);
PRN (without newline)
Overload 2
htp.prn(dbuf IN DATE);
PRN (without newline)
Overload 3
htp.prn(nbuf IN NUMBER);
 
Raw Output
ESCAPE_SC htp.escape_sc(ctext IN VARCHAR2 CHARACTER SET ANY_CS);
 
PRINT_HEADER htp.print_header(cbuf IN VARCHAR2, nline IN NUMBER);
 
PRINTS htp.prints(ctext IN VARCHAR2 CHARACTER SET ANY_CS);
 
PS htp.ps(ctext IN VARCHAR2 CHARACTER SET ANY_CS);
 
PUTRAW htp.putraw(bbuf IN raw, buflen PLS_INTEGER DEFAULT NULL);
 
SETHTTPCHARSET htp.setHTTPCharset (
iana_charset IN VARCHAR2, 
ora_charset  IN VARCHAR2 DEFAULT NULL);
 
SET_TRANSFER_MODE htp.set_transfer_mode(tmode IN VARCHAR2);
 
Miscellaneous
GET_LINE htp.get_line(irows OUT INTEGER) return VARCHAR2;
 
GET_PAGE htp.get_page(thepage OUT NOCOPY htbuf_arr, irows IN OUT INTEGER);
 
 
Demos

HTP Package Demo
CREATE TABLE feds_data (
tid        NUMBER(9),
serial_no  VARCHAR2(30),
mfg_abbr   VARCHAR2(8),
type_code  VARCHAR2(5),
mod_dt     DATE,
mod_by     VARCHAR2(30));

INSERT INTO feds_data 
(tid, serial_no, mfg_abbr, type_code, mod_dt, mod_by)
VALUES
(1, '42', 'BCAG', 'ABC', SYSDATE, USER);

INSERT INTO feds_data
(tid, serial_no, mfg_abbr, type_code, mod_dt, mod_by)
VALUES
(1, '666', 'MSC', 'XXX', SYSDATE, USER);

CREATE OR REPLACE PACKAGE feds_pkg IS

PROCEDURE get_data;

END feds_pkg;
/

CREATE OR REPLACE PACKAGE BODY feds_pkg IS

PROCEDURE get_data IS
CURSOR gmi_cur IS
SELECT tid, serial_no, mfg_abbr,
type_code, mod_dt, mod_by
FROM feds_data
ORDER BY tid;

ProcName VARCHAR2(61) := 'feds_pkg.get_data';
HeadText VARCHAR2(2000) := 'Demo Page Header';
FootText VARCHAR2(500) := 'Demo Page Footer';

BEGIN
  htp.p(HeadText);
  htp.p('<form method="POST"><center>');
  htp.p('<table border="1" width="30%">');
  FOR i IN gmi_cur LOOP
    htp.p('<tr>');
    --
    htp.p('<td align="center">');
    htp.p('<font face="Arial" color=#000000">');
    htp.p('<input type=text size=3 maxlength=3 name="tid"');
    htp.p('value = ' || i.tid || '></font>');
    htp.p('</td>');
    --
    htp.p('<td align="center">');
    htp.p('<font face="Arial" color=#000000">');
    htp.p('<input type=text size=8 maxlength=8 name="serial_no"');
    htp.p('value = ' || i.serial_no || '></font>');
    htp.p('</td>');
    --
    htp.p('<td align="center">');
    htp.p('<font face="Arial" color=#000000">');
    htp.p('<input type=text size=6 maxlength=6 name="serial_no"');
    htp.p('value = ' || i.mfg_abbr || '></font>');
    htp.p('</td>');
    --
    htp.p('<td align="center">');
    htp.p('<font face="Arial" color=#000000">');
    htp.p('<input type=text size=1 maxlength=1 name="serial_no"');
    htp.p('value = ' || i.type_code || '></font>');
    htp.p('</td>');
    --
    htp.p('<td align="center">');
    htp.p('<font face="Arial" color=#000000">');
    htp.p('<input type=text size=7 maxlength=7 name="serial_no"');
    htp.p('value = ' || TO_CHAR(i.mod_dt, 'MM-DD-YYYY') ||'></font>');
    htp.p('</td>');
    --
    htp.p('<td align="center">');
    htp.p('<font face="Arial" color=#000000">');
    htp.p('<input type=text size=6 maxlength=6 name="serial_no"');
    htp.p('value = ' || i.mod_by || '></font>');
    htp.p('</td>');
    --
    htp.p('</tr>');
  END LOOP;
  htp.p('<p align=center>');
  htp.p('<input type=submit name="Submit" value="Save"></p>');
  htp.p('</form></center>');
  htp.p('</table>');
  htp.p(FootText);
END get_data;

END feds_pkg;
/

set serveroutput on
spool c: emp\demopage.html
exec feds_pkg.get_data;
exec owa_util.showpage;
spool off
  CREATE OR REPLACE PROCEDURE lltopics(proj_id NUMBER) IS

CURSOR c1discussionview IS
SELECT SUBSTR(name, 1, 60) dname, lastname, createdate, dtext,
FROM discussionview, kuafuser
WHERE kuafuser.userid = discussionview.userid
ANDownerid = PROJ_ID
ORDER BY dparentid desc, parentid, createdate desc;

lparent        INT;
ltextcontainer VARCHAR2(10000);

BEGIN
  htp.htmlOpen;
  htp.bodyOpen('//awsdocs.nwest.mccaw.com/livelinksupport/pattern.gif');
  htp.dlistOpen;

  FOR c1rec IN c1discussionview
  LOOP
    lparent := c1rec.parentid;
    IF lparent = 0 THEN
      htp.line;
    END IF;

    htp.fontOpen('0000bb');
    htp.dlistDef(htf.bold(c1rec.dname||' - '|| c1rec.lastname||' - '||c1rec.createdate));
    htp.fontClose;
    htp.dlistTerm(c1rec.dtext);
  END LOOP;
  htp.dlistClose;
  htp.bodyClose;
  htp.htmlClose;
END lltopics;
/

set serveroutput on
spool c: emp\demopage.html
exec feds_pkg.get_data;
exec owa_util.showpage;
spool off
  CREATE OR REPLACE PACKAGE web_pkg IS
PROCEDURE test;
END web_pkg;
/


CREATE OR REPLACE PACKAGE BODY web_pkg IS
--===============
PROCEDURE test IS

CURSOR c IS
SELECT table_name, tablespace_name
FROM user_tables;

BEGIN
  htp.p('<font SIZE=6><p>Field Applications</br></br></font>');
  htp.p('<b>Another Line Of Text</b></br>');
  FOR rec IN c LOOP
    htp.p('<a href="' || rec.table_name || '">' || 
    rec.tablespace_name || '</a></br>');
  END LOOP;
END test;
--===============
END web_pkg;
/

set serveroutput on
spool c: emp\demopage.html
exec web_pkg.test;
exec owa_util.showpage;
spool off
 
Related Topics
HTF
OWA_UTIL
UTL_HTTP
UTL_URL
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us [249 users online]    © 2010 psoug.org