PSP

From Oracle FAQ
Jump to: navigation, search

PL/SQL Server Pages (PSP) is a technology similar to ASP (Active Server Pages) and JSP (Java Server Pages).

The basic design (HTML page) is created in a visual tool, for instance an HTML designer and the PL/SQL code (also called scriptlets) is embedded within special tags. Only the absolute minimum of PL/SQL will have to be written and the HTML designer and PL/SQL programmer can share the same file. A PSP file is compiled into a PL/SQL stored procedure, which means that the PSP compile is used during the development phase only.

Contents

[edit] History

PSP was first introduced with Oracle 8i (8.1.6).

[edit] Sample PSP pages

<%@ page language="PL/SQL" %>
<%@ plsql procedure="hello" %>
<%@ plsql parameter="username" default="NULL"%>
<HTML>
<HEAD><TITLE>Hello User</TITLE></HEAD>
<BODY>
<% BEGIN 
     IF username IS NOT NULL THEN
%>
        Hello <%= username %>
<%
     ELSE
%>
        No username provided!
<%
     END IF;
   END;
%>
</BODY>
</HTML>

A more complicated example:

 <%@ page language="PL/SQL" %> 
 <%@ plsql procedure="Parameters" %> 
 <HTML> 
 <HEAD><TITLE>This is a Test PSP Page</TITLE></HEAD> 
 <BODY> 

 <h1>List of database parameters:</H1>
 
 <TABLE>
 <% FOR parm IN (select name, value from sys.v_$parameter
 order by name) 
 LOOP 
   IF parm.value IS NULL THEN 
      parm.value := 'no value'; 
   END IF;
 %>
 <TR>
   <TD><%= parm.name %></TD>
   <TD><%= parm.value %></TD>
 </TR>
 <% END LOOP; %>

 </TABLE>
 </BODY> 
 </HTML>

[edit] Deploying PSP pages

To compile a psp file, say hellp.psp:

loadpsp -replace -user name/pass hellp.psp

[edit] Also see

  • Mod_plsql - Apache PL/SQL module
  • APEX - Oracle Application Express
Glossary of Terms
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #