Oracle WebServer User's Guide

Contents Index Home Previous Next

Procedure and Function Reference

This section describes each procedure and function in the htp, htf, and owa_util packages. Please note that for every htp procedure that generates HTML tags, a corresponding htf function exists with identical parameters. Note that defaulted parameters do not need to be passed.

The description of each procedure or function is broken down into the following parts:

Name Name of procedure or function
Syntax Actual syntax of procedure or function
Purpose What the procedure or function does
Parameters Parameters passed in
Generates What the procedure or function generates

Parameters Passed into Procedures and Functions

All parameters passed into a hypertext procedure or function are of data type varchar2 (varying-length character string), integer, or date. The data type is indicated by a "c" for character, (varchar2) "n" for integer, or "d" for date as the first character of the parameter name. For example:

where cname is of data type character

where nsize is of data type integer

where dbuf is a date field

Note: Many HTML 3.0 tags have a large number of optional attributes that, if made as individual parameters to the hypertext procedures or functions would make the calls quite cumbersome. In addition, some browsers support non-standard attributes. Therefore, each hypertext procedure or function that generates an HTML tag has as its last parameter cattributes, an optional parameter. This parameter enables you to pass the exact text of the desired HTML attributes to the PL/SQL procedure.

For example, the syntax for htp.em is:

htp.em (ctext, cattributes);

A call that uses HTML 3.0 attributes might look like the following:

htp.em('This is an example','ID="SGML_ID" LANG="en"');

This line would generate the following:

<EM ID="SGML_ID" LANG="en">This is an example</EM>

Print Procedures

The following print procedures are used in conjunction with htf functions to generate a line in the HTML document being constructed. They can also be passed hard-coded text that will appear in the HTML document as-is. The generated line is passed to the Web Agent which sends it to standard output. As documented in the CGI 1.1 specification, the Oracle Web Listener takes the contents of standard output and returns it to the Web browser that requested the dynamic HTML document.

htp.print

Syntax htp.print (cbuf | dbuf | nbuf);
Purpose generates a line in an HTML document.
Parameters cbuf in varchar2 or
dbuf in date or
nbuf in number
Generates Generates a line in an HTML document based on the value passed to it.

htp.p

Alias for htp.print

htp.prn

Syntax htp.prn (cbuf | dbuf | nbuf);
Purpose Just like htp.print, but doesn't put a new line at the end of the value submitted.

htp.prints

Syntax htp.prints (ctext);
Purpose Generates a line in an HTML document and replaces all occurrences of the following special characters with escape characters. If not replaced, the special characters would be interpreted as HTML control characters, and would produce garbled output.
`<` with '&lt;`
`>' with &gt;`
`"` with `&quot;`
`&` with `&amp;`
Parameters ctext in varchar2
Generates Generates a line in an HTML document based on the value passed to it. This procedure is the same as htp.print or htp.p but first replaces the special characters listed above with escape characters.

htp.ps

Alias for htp.prints

Structure Tags

The following tags are used to identify the major parts of an HTML document.

Note: Although this section shows hypertext procedures (HTP), all of them are also available as hypertext functions (HTF).

htp.htmlOpen

Syntax htp.htmlOpen;
Purpose Prints a tag that indicates the beginning of an HTML document
Parameters none
Generates <HTML>

htp.htmlClose

Syntax htp.htmlClose;
Purpose Prints a tag that indicates the end of an HTML document
Parameters none
Generates </HTML>

htp.headOpen

Syntax htp.headOpen;
Purpose Prints a tag that indicates the beginning of the HTML document head
Parameters none
Generates <HEAD>

htp.headClose

Syntax htp.headClose;
Purpose Prints a tag that indicates the end of the HTML document head
Parameters none
Generates </HEAD>

htp.bodyOpen

Syntax htp.bodyOpen (cbackground, cattributes);
Purpose Prints the tag that identifies the beginning of the body of an HTML document, and allows you to specify an image as the background of the document
Parameters cbackground in varchar2 DEFAULT NULL
cattributes in varchar2 DEFAULT NULL
Generates <BODY background="cbackground" cattributes>
Note: If cbackground and cattributes are NULL, this tag generates <BODY>.

Example htp.bodyOpen ('/img/background.gif'); This line produces: <BODY background="background.gif">

htp.bodyClose

Syntax htp.bodyClose;
Purpose Defines the end of the HTML document body
Parameters none
Generates </BODY>

Contents Index Home Previous Next