⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oracle webserver

📁 介绍了数据库方面的基础知识
💻
字号:
作者:孤独求败
日期:00-1-14 4:11:16
4.2 过程和函数参考
本节描述htp,htf和owa_util包中的每个过程和函数。注意:每个生成的HTML标记的 
htp过程,存在与之相应的带标志参数的htf函数。注意:定为缺省的参数不需要传递。 

 每个过程和函数的描述分为以下几部分: 

名称  过程或函数的名称 
语法   过程或函数的实际语法  
目的   过程或函数做什么 
参数   传入的参数 
结果  过程或函数生成什么  

穿给过程和函数的参数
所有传给超文本过程或函数的参数都是varchar2(可变长字符串), 整数或日期类型的。数据类型用参数名的第一个字母表示,"c"表示字符(varchar2), "n" 表示整数,"d" 表示日期。例如: 

cname in varchar2 
其中 cname 是字符型

nsize in integer 
其中 nsize 是整数型 

dbuf in date 
其中dbuf 是日期字段

 注意: 很多HTML 3.0标记有大量的可选属性, 如果超文本过程和函数的的参数都作成独立的回使得调用相当繁琐。另外,很多浏览器支持非标准属性。因此,每个生成HTML标记的超文本过程和函数都在最后有个参数cattributes, 一个可选参数. 这个参数使你把想要的HTML属性作为额外的文本传给PL/SQL过程。

 例如, htp.em 的语法为: 

htp.em (ctext, cattributes);
一个使用HTML 3.0属性的调用可能象下面的样子: 

htp.em('This is an example','ID="SGML_ID" LANG="en"');
此行将残生下面的内容: 

<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
语法  htp.print (cbuf | dbuf | nbuf); 
作用  generates a line in an HTML document. 
参数  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
语法  htp.prn (cbuf | dbuf | nbuf); 
作用  Just like htp.print, but doesn't put a new line at the end of the value submitted. 

htp.prints
语法  htp.prints (ctext); 
作用  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;` 
参数  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
语法  htp.htmlOpen; 
作用  Prints a tag that indicates the beginning of an HTML document 
参数  none 
Generates  <HTML> 

htp.htmlClose
语法  htp.htmlClose; 
作用  Prints a tag that indicates the end of an HTML document 
参数  none 
Generates  </HTML> 

htp.headOpen
语法  htp.headOpen; 
作用  Prints a tag that indicates the beginning of the HTML document head 
参数  none 
Generates  <HEAD> 

htp.headClose
语法  htp.headClose; 
作用  Prints a tag that indicates the end of the HTML document head 
参数  none 
Generates  </HEAD> 

htp.bodyOpen
语法  htp.bodyOpen (cbackground, cattributes); 
作用  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 
参数  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
语法  htp.bodyClose; 
作用  Defines the end of the HTML document body 
参数  none 
Generates  </BODY> 

--------------------------------------------------------------------------------

Head Related Tags 头相关标记
The following procedure tags should be placed between the htp.headOpen and htp.headClose procedure tags. 

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

  

htp.title
语法  htp.title (ctitle); 
作用  Prints an HTML tag with the text you pass in as the value of TITLE. Most Web Browsers display the text value enclosed between <TITLE> and </TITLE> at the top of the document viewing window. 
参数  ctitle in varchar2 
Generates  <TITLE>ctitle</TITLE> 

htp.htitle
语法  htp.htitle (ctitle, nsize, calign, cnowrap, cclear, cattributes); 
作用  Prints the HTML tags for both the title and a top heading using the title you specify. 
参数  ctitle in varchar2 
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 
Generates  <TITLE>ctitle</TITLE><Hnsize ALIGN="calign" NOWRAP CLEAR="cclear" cattributes>ctitle</Hnsize> 
Note that htp.htitle produces non-standard HTML. However, most Web Browsers accept it. To produce standard HTML, the <TITLE> tag must be in the HEAD section of the page, and the level heading tag (<H n>) must be in the BODY section. For example: htp.headOpen; htp.title(...); htp.headClose; htp.bodyOpen; htp.header (1,...)); ... 

htp.base
语法  htp.base; 
作用  Prints an HTML tag that records the URL of the document 
参数  none 
Generates  Inserts absolute pathname of current document. 

htp.isindex
语法  htp.isindex (cprompt, curl); 
作用  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. 
参数  cprompt in varchar2 DEFAULT NULL 
curl in varchar2 DEFAULT NULL 
Generates  <ISINDEX PROMPT="cprompt" HREF="curl"> 

htp.linkRel
语法  htp.linkRel (crel, curl, ctitle); 
作用  Prints the HTML tag that gives the relationship described by the hypertext link from the anchor to the target. This is only used when the HREF attribute is present. This tag indicates a relationship between documents, but does not create a link. To do that, use htp.anchor. 
参数  crel in varchar2 
curl in varchar2 
ctitle in varchar2 DEFAULT NULL 
Generates  <LINK REL="crel" HREF="curl" TITLE="ctitle"> 

htp.linkRev
语法  htp.linkRev (crev, curl, ctitle); 
作用  Gives the relationship described by the hypertext link from the target to the anchor. This is the opposite of htp.linkRel. This tag indicates a relationship between documents, but does not create a link. To do that, use htp.anchor. 
参数  crev in varchar2 
curl in varchar2 
ctitle in varchar DEFAULT NULL 
Generates  <LINK REV="crev" HREF="curl" TITLE="ctitle"> 

htp.meta
作用  htp.meta (chttp_equiv, cname, ccontent); 
  Prints an HTML tag that identifies and embeds document meta-information that supplies the Web browser with information about the objects returned in HTTP. 
参数  chttp_equiv in varchar2 
cname in varchar2 
ccontent in varchar2 
Generates  <META HTTP-EQUIV="chttp_equiv" NAM ="cname" 
CONTENT="ccontent"> 
Example  htp.meta ('Refresh', NULL, 120); This line produces: <META HTTP-EQUIV="Refresh" CONTENT=120> 
  which on some Web browsers will cause the current URL to be reloaded automatically every 120 seconds. 

  


--------------------------------------------------------------------------------

Body Tags 体标记
Body tags are used in the main text of your HTML page. They can format a paragraph, allow you to add hidden comments to your text, and add images within the body of your HTML text. 

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

  

htp.line
语法  htp.line (cclear, csrc, cattributes); 
作用  Prints the HTML tag that generates a line in the HTML document. csrc enables you to specify a custom image as the source of the line. 
参数  cclear in varchar2 DEFAULT NULL 
csrc in varchar2 DEFAULT NULL 
cattributes in varchar2 DEFAULT NULL 
Generates  <HR CLEAR="cclear" CSRC="csrc" cattributes> 

htp.hr
Alias for htp.line 

  

htp.nl
语法  htp.nl (cclear, cattributes); 
作用  Prints the HTML tag that inserts a new line 
参数  cclear in varchar2 DEFAULT NULL, 
cattributes in varchar2 DEFAULT NULL, 
Generates  <BR CLEAR="cclear" cattributes> 

htp.br
Alias for htp.nl 

  

htp.header
语法  htp.header (nsize, cheader, calign, cclear, cattributes); 
作用  Prints the HTML tag for a heading level, with the value of the heading level assigned in the nsize parameter. Valid levels are 1 through 6. 
参数  nsize in integer 
cheader in varchar2 
calign in varchar2 DEFAULT NULL 
cnowrap in varchar2 DEFAULT NULL 
cclear in varchar2 DEFAULT NULL 
cattributes in varchar2 DEFAULT NULL 
Generates  <Hnsize ALIGN="calign" NOWRAP CLEAR="cclear" cattributes>cheader</Hnsize> 
Example  htp.header (1,'Overview'); produces <H1>Overview</H1>  

htp.anchor
语法  htp.anchor (curl, ctext, cname, cattributes); 
作用  Prints the HTML tag for an anchor to be the start or end destination of a hypertext link. This anchor can accept several attributes, but either HREF or NAME is required. HREF specifies where to link to. NAME allows this tag to be a target of a hypertext link. 
参数  curl in varchar2 
ctext in varchar2 
cname in varchar2 DEFAULT NULL 
cattributes in varchar2 DEFAULT NULL 
Generates  <A HREF="curl" NAME="cname" cattributes>ctext</A> 

htp.mailto
语法  htp.mailto (caddress, ctext, cname, cattributes); 
作用  Prints the HTML tag for an anchor with 'mailto' concatenated ahead of the mail address argument. 
参数  caddresss in varchar2 
ctext in varchar2 DEFAULT NULL 
cattributes in varchar2 DEFAULT NULL 
Generates  <A HREF="mailto:caddress" cattributes>ctext</A> 
Example  htp.mailto('pres@white_house.gov','Send Email to the President'); prints <A HREF="mailto:pres@white_house.gov">Send Email to the President</A> 

htp.img
语法  htp.img (curl, calign, calt, cismap, cattributes); 
作用  Prints an HTML tag that signals the browser to load an image to be placed into the HTML page. ALT allows you to specify alternate text to be shown while the image is being loaded, or instead of the image if the browser does not support images. The ISMAP attribute indicates that the image is an image map. 
参数  curl in varchar2 DEFAULT NULL 
calign in varchar2 DEFAULT NULL 
calt in varchar2 DEFAULT NULL 
cismap in varchar2 DEFAULT NULL 
cattributes in varchar2 DEFAULT NULL 
Generates  <IMG SRC="curl" ALIGN="calign" ALT="calt" ISMAP cattributes> 

htp.para
语法  htp.para; 
作用  Prints an HTML tag that indicates that the text previous to it should be formatted as a paragraph. 
参数  none 
Generates  <P> 

htp.paragraph
语法  htp.paragraph (calign, cnowrap, cclear, cattributes); 
作用  Prints the same HTML tag as htp.para except that 参数 pass in exact alignment, leading, wrapping , and attributes. 
参数  calign in varchar2 DEFAULT NULL 
cnowrap in varchar2 DEFAULT NULL 
cclear in varchar2 DEFAULT NULL 
cattributes in varchar2 DEFAULT NULL 
Generates  <P ALIGN="calign" NOWRAP CLEAR="cclear" cattributes> 

htp.address
语法  htp.address (cvalue, cnowrap, cclear, cattributes); 
作用  Prints an HTML tag that enables you to specify address, author and signature of document 
参数  cvalue in varchar2 
cnowrap in varchar2 DEFAULT NULL 
cclear in varchar2 DEFAULT NULL 
cattributes in varchar2 DEFAULT NULL 
Generates  <ADDRESS CLEAR="cclear" NOWRAP cattributes>cvalue</ADDRESS> 

htp.comment
语法  htp.comment (ctext); 
作用  Prints an HTML tag that allows you to store comments or lines in HTML pages. These comments are not visible to the end user. 
参数  ctext in varchar2 
Generates  <!-- ctext --> 

htp.preOpen
语法  htp.preOpen (cclear, cwidth, cattributes); 
作用  Prints an HTML tag that indicates the beginning of preformatted text in the body of the HTML page. 
参数  cclear in varchar2 DEFAULT NULL 
cwidth in varchar2 DEFAULT NULL 
cattributes in varchar2 DEFAULT NULL 
  <PRE CLEAR="cclear" WIDTH="cwidth" cattributes> 

htp.preClose
语法  htp.preClose; 
作用  Prints an HTML tag that ends the preformatted section of text. 
参数  none 
Generates  </PRE> 

htp.blockquoteOpen
语法  htp.blockquoteOpen (cnowrap, cclear, cattributes); 
作用  Prints an HTML tag that precedes a paragraph of quoted text. 
参数  cnowrap in varchar2 DEFAULT NULL 
cclear in varchar2 DEFAULT NULL 
cattributes in varchar2 DEFAULT NULL; 
Generates  <BLOCKQUOTE CLEAR="cclear" NOWRAP cattributes> 

htp.blockquoteClose
语法  htp.blockquoteClose; 
作用  Ends the <BLOCKQUOTE> section of quoted text. 
参数  none 
Generates  </BLOCKQUOTE> 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -