Oracle HTP
Version 21c

General Information
Library Note Morgan's Library Page Header
ACE Director Alum Daniel Morgan, founder of Morgan's Library, is scheduling complimentary technical Workshops on Database Security for the first 30 Oracle Database customers located anywhere in North America, EMEA, LATAM, or APAC that send an email to asra_us@oracle.com. Request a Workshop for your organization today.
Purpose The HTP (hypertext procedures) and HTF (hypertext functions) packages generate HTML tags.
AUTHID DEFINER
Constants
Name Data Type Value
PL/SQL table used for output buffering
HTBUF_LEN NUMBER 255
Data Types 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
ADD_AGENT_CERTIFICATE OWA_COOKIE SUBMIT_FILEWATCH_RESULTS
CHECK_AGENT_VERSION OWA_CX SUBMIT_JOB_RESULTS
DBMS_OUTPUT OWA_OPT_LOCK SUBMIT_JOB_RESULTS2
FILEWATCH_REQUEST_RESEND OWA_TEXT UNREGISTER_AGENT
HTF OWA_UTIL UTL_RAW
ORDPLSGWYUTIL PLITBLM V$NLS_PARAMETERS
OWA REGISTER_AGENT3 WPG_DOCLOAD
OWA_CACHE REG_START  
Documented Yes
First Available 8.1.7
Security Model Owned by SYS with EXECUTE granted to PUBLIC
Source {ORACLE_HOME}/rdbms/admin/pubht.sql
 
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(' source/binary.gif','text="#000000" vlink="#800080" alink="#00FFFF" bgcolor="#FFFFFF"');
  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@mlib.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);
set serveroutput on

BEGIN
  htp.htmlOpen;
  htp.headOpen;
  htp.title('Area Demo');
  htp.headClose;
  htp.bodyOpen;
  htp.area('0,0,82,126', 'rect', 'www.mlib.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');
-- produces
<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('https://www.morganslibrary.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
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@mlib.org', 'Email to Morgan')
--produces
<A HREF="mailto:damorgan@mlib.org">Email to Morgan</A>
MAPCLOSE htp.mapClose;
exec htp.mapClose;
MAPOPEN htp.mapOpen(
cname       IN VARCHAR2,
cattributes IN VARCHAR2 DEFAULT NULL);
exec htp.mapOpen('ACED_MAP');

<MAP name="aced_map">
NL htp.nl(
cclear      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
TBD
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);
TBD
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);
TBD
MENULISTCLOSE htp.menulistClose;
exec menulistClose;
MENULISTOPEN htp.menulistOpen;
TBD
OLISTCLOSE htp.olistClose;
exec htp.olistClose;
OLISTOPEN htp.olistOpen(
cclear      IN VARCHAR2 DEFAULT NULL,
cwrap       IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
TBD
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
B htp.b(
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
<B>
BIG (increase font size) htp.big(
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
<BIG>
CITE htp.cite(
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
TBD
CODE htp.code(
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
TBD
DFN htp.dfn(
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
TBD
EM htp.em(
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
TBD
EMPHASIS htp.emphasis(
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
TBD
KBD htp.kbd(
ctext       IN VARCHAR2,
cattributes IN VARCHAR2 DEFAULT NULL);
TBD
KEYBOARD htp.keyboard(
ctext       IN VARCHAR2,
cattributes IN VARCHAR2 DEFAULT NULL);
TBD
SAMPLE htp.sample(
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
TBD
SMALL htp.small(
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
TBD
SUB htp.sub(
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
calign      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
TBD
SUP htp.sup(
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
calign      IN VARCHAR2 DEFAULT NULL,
cattributes IN VARCHAR2 DEFAULT NULL);
TBD
VARIABLE htp.variable(
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
TBD
 
Physical Format Elements
BASEFONT htp.basefont(nsize IN INTEGER);
TBD
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);
TBD
STRIKE htp.strike(
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
TBD
TELETYPE htp.teletype(
ctext       IN VARCHAR2 CHARACTER SET ANY_CS,
cattributes IN VARCHAR2 DEFAULT NULL);
TBD
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);
TBD
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);
TBD
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);
TBD
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);
TBD
 
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);
TBD
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);
TBD
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
TBD
FRAMESETCLOSE htp.framesetClose;
exec 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
exec htp.framesetOpen(25, '', 30);

<FRAMESET cols="25%,*,30%">
NOFRAMESCLOSE htp.noframesClose;
</NOFRAMES>
NOFRAMESOPEN htp.noframesOpen;
<NOFRAMES>
 
Special Tags
APPLETCLOSE htp.appletclose;
exec 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>
exec htp.appletopen('testclass.class', 100, 200, 'CODEBASE="/ows-applets"')
-- produces
<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);
TBD
FLUSH htp.flush;
exec htp.flush;
INIT htp.init;
exec htp.init;
 
OAS Specific Helper Procedures
FLUSH_CHARSET_CONVERT htp.flush_charset_convert(charset IN VARCHAR2);
TBD
GET_PAGE_CHARSET_CONVERT htp.get_page_charset_convert(
thepage     OUT NOCOPY htbuf_arr,
irows    IN OUT        INTEGER,
charset  IN            VARCHAR2);
TBD
 
Add RAW transfer API
GET_PAGE_RAW htp.get_page_raw(
thepage    OUT NOCOPY htraw_arr,
irows   IN OUT        INTEGER);
TBD
RESET_GET_PAGE htp.reset_get_page;
exec htp.reset_get_page;
SHOWPAGE htp.showpage;
TBD
 
File Download Feature
DOWNLOAD_FILE htp.download_file(
sFileName IN VARCHAR2,
bCompress IN BOOLEAN DEFAULT FALSE);
TBD
GET_DOWNLOAD_FILES_LIST htp.get_download_files_list(
sFilesList OUT VARCHAR2,
nCompress  OUT BINARY_INTEGER);
TBD
 
Output Procedures
P (Abbrev call to print)
Overload 1
htp.p(cbuf IN VARCHAR2 CHARACTER SET ANY_CS DEFAULT NULL);
TBD
P (Abbrev call to print)
Overload 2
htp.p(dbuf IN DATE);
TBD
P (Abbrev call to print)
Overload 3
htp.p(nbuf IN NUMBER);
TBD
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-2014'));   -- 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);
TBD
PRN (without newline)
Overload 2
htp.prn(dbuf IN DATE);
TBD
PRN (without newline)
Overload 3
htp.prn(nbuf IN NUMBER);
TBD
 
Raw Output
ESCAPE_SC htp.escape_sc(ctext IN VARCHAR2 CHARACTER SET ANY_CS);
TBD
PRINT_HEADER htp.print_header(
cbuf  IN VARCHAR2,
nline IN NUMBER);
TBD
PRINTS htp.prints(ctext IN VARCHAR2 CHARACTER SET ANY_CS);
TBD
PS htp.ps(ctext IN VARCHAR2 CHARACTER SET ANY_CS);
TBD
PUTRAW htp.putraw(
bbuf   IN RAW,
buflen IN PLS_INTEGER DEFAULT NULL);
TBD
SETHTTPCHARSET htp.setHTTPCharset(
iana_charset IN VARCHAR2,
ora_charset  IN VARCHAR2 DEFAULT NULL);
TBD
SET_TRANSFER_MODE htp.set_transfer_mode(tmode IN VARCHAR2);
TBD
 
Miscellaneous
GET_LINE htp.get_line(irows OUT INTEGER)
RETURN VARCHAR2;
TBD
GET_PAGE htp.get_page(
thepage    OUT NOCOPY htbuf_arr,
irows   IN OUT        INTEGER);
TBD
 
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:\temp\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:\temp\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_all_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:\temp\demopage.html
exec web_pkg.test;
exec owa_util.showpage;
spool off

Related Topics
Built-in Functions
Built-in Packages
HTF
OWA_UTIL
UTL_HTTP
UTL_URL
What's New In 21c
What's New In 23c

Morgan's Library Page Footer
This site is maintained by Dan Morgan. Last Updated: This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2023 Daniel A. Morgan All Rights Reserved
  DBSecWorx