"This page was produced by the Oracle PL/SQL Agent on 6/14/95 09:30"
Note that this procedure uses dbms_output and thus is limited to 255 characters per line and an overall buffer size of 1,000,000 bytes.
SQL>set serveroutput on
SQL>spool gretzky.html
SQL>execute hockey.pass('Gretzky")
SQL>execute owa_util.showpage
SQL>exit
This would generate an HTML page which could be accessed from Web clients.
Note that param_name is case-insensitive.
Content-type: <ccontent_type>\n\n
Location: <curl>\n\n
Status: <nstatus> <creason>\n\n
create or replace procedure showemps is
ignore_more boolean;
begin
ignore_more := owa_util.tablePrint('emp', 'BORDER', OWA_UTIL.PRE_TABLE);
end;
and requesting a URL like this example: http://myhost:8080/ows-bin/hr/owa/showemps
returns to the client:
<PRE>
------------------------------------------------------------------------
| EMPNO | ENAME | JOB | MGR | HIREDATE | SAL | COMM | DEPTNO |
------------------------------------------------------------------------
| 7369 | SMITH | CLERK | 7902 | 17-DEC-80 | 800 | | 20 |
| 7499 | ALLEN | SALESMAN | 7698 | 20-FEB-81 | 1600 | 300 | 30 |
| 7521 | WARD | SALESMAN | 7698 | 22-FEB-81 | 1250 | 500 | 30 |
| 7566 | JONES | MANAGER | 7839 | 02-APR-81 | 2975 | | 20 |
| 7654 | MARTIN | SALESMAN | 7698 | 28-SEP-81 | 1250 | 1400 | 30 |
| 7698 | BLAKE | MANAGER | 7839 | 01-MAY-81 | 2850 | | 30 |
| 7782 | CLARK | MANAGER | 7839 | 09-JUN-81 | 2450 | | 10 |
| 7788 | SCOTT | ANALYST | 7566 | 09-DEC-82 | 3000 | | 20 |
| 7839 | KING | PRESIDENT | | 17-NOV-81 | 5000 | | 10 |
| 7844 | TURNER | SALESMAN | 7698 | 08-SEP-81 | 1500 | 0 | 30 |
| 7876 | ADAMS | CLERK | 7788 | 12-JAN-83 | 1100 | | 20 |
| 7900 | JAMES | CLERK | 7698 | 03-DEC-81 | 950 | | 30 |
| 7902 | FORD | ANALYST | 7566 | 03-DEC-81 | 3000 | | 20 |
| 7934 | MILLER | CLERK | 7782 | 23-JAN-82 | 1300 | | 10 |
------------------------------------------------------------------------
</PRE>
To view just the employees in department 10, and only their employee ids, names, and salaries, create the following procedure:
create or replace procedure showemps_10 is
ignore_more boolean;
begin
ignore_more := owa_util.tablePrint
('EMP', 'BORDER', OWA_UTIL.PRE_TABLE,
'empno, ename, sal',
'where deptno=10 order by empno',
'Employee Number, Name, Salary');
end;
A request for a URL like http://myhost:8080/ows-bin/hr/owa/showemps_10 would return the following to the client:
<PRE>
-------------------------------------
| Employee Number | Name | Salary |
-------------------------------------
| 7782 | CLARK | 2450 |
| 7839 | KING | 5000 |
| 7934 | MILLER | 1300 |
-------------------------------------
</PRE>
For browsers that do support HTML tables, to view the department table in an HTML table, create the following procedure:
create or replace procedure showdept is
ignore_more boolean;
begin
ignore_more := owa_util.tablePrint('dept', 'BORDER');
end;
A request for a URL like http://myhost:8080/ows-bin/hr/owa/showdept would return the following to the client:
<TABLE BORDER>
<TR>
<TH>DEPTNO</TH>
<TH>DNAME</TH>
<TH>LOC</TH>
</TR>
<TR>
<TD ALIGN="LEFT">10</TD>
<TD ALIGN="LEFT">ACCOUNTING</TD>
<TD ALIGN="LEFT">NEW YORK</TD>
</TR>
<TR>
<TD ALIGN="LEFT">20</TD>
<TD ALIGN="LEFT">RESEARCH</TD>
<TD ALIGN="LEFT">DALLAS</TD>
</TR>
<TR>
<TD ALIGN="LEFT">30</TD>
<TD ALIGN="LEFT">SALES</TD>
<TD ALIGN="LEFT">CHICAGO</TD>
</TR>
<TR>
<TD ALIGN="LEFT">40</TD>
<TD ALIGN="LEFT">OPERATIONS</TD>
<TD ALIGN="LEFT">BOSTON</TD>
</TR>
</TABLE>
which a Web browser can format to look like this:
|
DEPTNO
|
DNAME
|
LOC
|
|
10
|
ACCOUNTING
|
NEW YORK
|
|
20
|
RESEARCH
|
DALLAS
|
|
30
|
SALES
|
CHICAGO
|
Here is an example of customized packages using non-standard <BLINK> and imaginary <SHOUT>tags:
create package nsf as
function blink(cbuf in varchar2) return varchar2;
function shout(cbuf in varchar2) return varchar2;
end;
create package body nsf as
function blink(cbuf in varchar2) return varchar2 is
begin return ('<BLINK>' || cbuf || '</BLINK>');
end;
function shout(cbuf in varchar2) return varchar2 is
begin return ('<SHOUT>' || cbuf || '</SHOUT>');
end;
end;
create package nsp as
procedure blink(cbuf in varchar2);
procedure shout(cbuf in varchar2);
end;
create package body nsp as
procedure blink(cbuf in varchar2) is
begin htp.print(nsf.blink(cbuf)); end;
procedure shout(cbuf in varchar2) is
begin htp.print(nsf.shout(cbuf)); end;
end;
Now you can begin to use these procedures and functions in your own procedure.
create procedure nonstandard as
begin
nsp.blink('Gee this hurts my eyes!');
htp.print('And I might ' || nsf.shout('get mad!'));
end;
For more examples of using the Pl/SQL Web Toolkit, see Passing Parameters to PL/SQL.
Go to the top of the section.
To report any problems or comments, e-mail Oracle WebServer Documentation.