Convert a HTML file into a PL/SQL stored procedure. The stored procedure will in turn output the HTML code via the Oracle Web Toolkit.
Actions | Description |
---|---|
Enable the web server | Select Session | Capture Web Output. |
Open the Code Editor. | Click View | Code Editor. |
New Stored Object | Create a new stored object in the Code Editor. Enter the name and the parent schema of the new procedure. |
Import HTML file as PL/SQL |
Click Tools | Import HTML as PL/SQL The import process wraps each line of the imported HTML file inside the htp.print ( … ); markers. PL/SQL statements can be embedded in HTML code inside comments; for example: <!--PLSQL a_random_plsql_statement; --> These comments must start with the string <!--PLSQL and end with --> You can put things in the declaration section of the procedure (to declare a cursor, for example) by ensuring they come first in the file, before the first <HTML> tag. For example: <!—PLSQL CURSOR emp_cur IS SELECT ename FROM emp; |
Save the program to the database. | When the HTML is imported into the stored program, you can save the program to the database. |
See also HTML Viewer for Stored Procedure > HTML.
The following example code will display details from a query in a web browser.
First, create a table named emp with a column ename. Add some data to the ename column, and then run the following procedure with the SQL Navigator Web Development Module enabled.
PROCEDURE PLH_EXAM1 is—this procedure generated from "\\phanevski1\c$\docs\EXEone.HTM".—warning: any changes made to this procedure will not be—reflected in the original HTML file.
CURSOR emp_cur IS
SELECT ename
FROM emp;
begin
htp.print(‘ ‘);
htp.print(‘<HTML>’);
htp.print(‘<HEAD>’);
htp.print(‘<TITLE>Embedded PL/SQL Example</TITLE>’);
htp.print(‘</HEAD>’);
htp.print(‘<BODY>’);
htp.print(‘<H1>Employee Names</H1>’);
htp.print(‘<TABLE>’);
htp.print(‘ ‘);
FOR emp_rec IN emp_cur LOOP
htp.print(‘ <TR>’);
htp.print(‘ <TD>’);
htp.print(emp_rec.ename);
htp.print(‘</TD>’);
htp.print(‘ </TR>’);
htp.print(‘ ‘);
END LOOP;
htp.print(‘</TABLE>’);
htp.print(‘</BODY>’);
htp.print(‘</HTML>’);
end;
© ALL RIGHTS RESERVED. 使用条款 隐私 Cookie Preference Center