Skip to Main Content

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Munzer.

Asked: March 14, 2002 - 11:23 am UTC

Last updated: August 11, 2006 - 1:19 pm UTC

Version: 8.1.7

Viewed 1000+ times

You Asked

Tom:

I want to ask about the advantages of PL/SQL server pages (PSP).

I have an application that uses stored procedures (htp) to create html pages. Is there any advantage of converting this to PSP or not.

Can you convert stored procedure to PSP automatically and is it worth doing. Would it make things easier to edit, faster etc..

Thank you,



and Tom said...

I'm not a fan (personally) of mixing procedural code with HTML. I prefer (opinion) to generate HTML from procedural code. I don't find it intuitive to mix them together -- i can read procedural code, I cannot read a mixture of HTML and plsql or java or VB.

other people love the asp/jsp/psp concept. It is a matter of taste I support. I see no advantage or disadvantage here since both end up being a stored procedure at the end of the day.

Rating

  (8 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

pl/sql server pages

munz, March 14, 2002 - 11:29 pm UTC

TOm:

Thanks. But is it true that if you develop with PSP you can control development effort bette by checking in files into version control software and checking it out before anone can edit it.

By using stored procedures is there any way to track changes for the code if 3 developers are editing the same procedure.

Thanks,



Tom Kyte
March 15, 2002 - 1:24 pm UTC

Umm -- the same way you would with a PSP (a psp after all just generates a stored procedure, nothing stopping developer X from reading out the source code of a PSP in the database and modifying it).


You would store your code in some version control system. (just like a psp)

Your developers would check out the code from this system (just like a psp)

You would "outlaw" the editing of code directly in the database (just like you would with a psp)

They could not change the same piece of code since its until version control.



PSP

mo, October 14, 2003 - 11:46 am UTC

Tom:

I want to create an pl/sql application. Since some screens are hard to do in HTML manually we purchased Dreamweaver. If I am correct this makes it more appropriate to use PSP.

But I am trying to envision how the PSP process will work differently than the PL/SQL WEB TOOLKIT which I am used to.
Is this the correct flow/actions involved?

1. I create the HTML file using dreamweaver on windows PC and name it with a "filename.psp" extension.

2. Now I add the plsql code I need to the file and save it. Here I will not be able to tell if my code is valid or not since I have not compiled it to a pl/sql stored procedure.

3. I ftp the "filename.psp" to a unix server where the database resides. I run "Loadpsp filename.psp" which creates a stored procedure.

4. I find errors in my procedure. I run "SQL navigator" on windows to debug the pl/sql code and fix it?

5. Now I have a stored procedure that is different than my original PSP file. Do I have to manually update my psp file everytime I change a line of code? DO I do that using Dreamweaver? It seems to me the synchronization between the psp file and stored procedure is tedious process.

6. Is it possible to do "Load psp" from windows prompt or SQL*PLUS or do I always have to ftp the file to unix?

7. Is it correct to say that with WEB pl/sql toolkit (htp) I can build many variants of one HTML form by using IF condition to wite HTML tags or not. So I can hide/display a field based on a value of a parameter.

Using PSP it seems all html code is startic at the top and all plsql code is at the bottom assigning values for
variables. But I can't hide an html line based on the value of input parameters?




Tom Kyte
October 14, 2003 - 12:45 pm UTC

you should iterate over 3/4 to avoid 5.

you can loadpsp from windows if you have loadpsp installed -- it is doable over the network.

7) sure, you procedurally decide what tags to print or not.

yes you can -- psp's have plsql anywhere you want - top, bottom, middle, whatever.

PSP

mo, October 14, 2003 - 2:42 pm UTC

Tom:

1. DO you know where I can get loadpsp to install on windows. is it part of oracle client software?

2. It seems to me (if I am correct) it is pretty tedious to keep editing the pls/sql code in the PSP and compile again everytime you have any kind of error. So I would not be using any PL/sql debugger in this case as SQL navigator.

Is there any tools that are special for debugging pl/sql in the psp file.

3. Do you personally favor using web toolkit (htp) over psp? or creating/editing the html in dreamweaver and then converting it using webalchemy to htp statements.

Thank you,


Tom Kyte
October 14, 2003 - 5:12 pm UTC

1) if it is, it'll be in $oracle_home/bin. if you have a client install (you must) and it is not there, it must not be part of the client install.

2) up to you. you should be putting teeny tiny snippets of plsql in mostly html with psp's. You can call packaged procedures and such -- which can be debugged standalone. Just use proper (modular) implementation techniques and you'll be just dandy.

3) I use HTML DB. Look around -- this site, it is as pretty as it gets. I go no fancier. If only you could see my browser -- you might laugh. I've blocked all popups (i won't use sites that use them). I've disabled animated gifs (makes me dizzy). My /etc/hosts file has a couple of hundred entries like this:

127.0.0.1 us.a1.yimg.com
127.0.0.1 us.a1.yimg.com
127.0.0.1 207-87-18-203.wsmg.digex.net
127.0.0.1 Garden.ngadcenter.net
127.0.0.1 Ogilvy.ngadcenter.net
127.0.0.1 ad.ca.doubleclick.net
127.0.0.1 ad.de.doubleclick.net
127.0.0.1 ad.doubleclick.net
127.0.0.1 ad.fr.doubleclick.net
127.0.0.1 ad.jp.doubleclick.net
.......

(those are all ad servers -- i don't get ANYTHING from them). I make liberal use of the Mozilla "block images from this server" to kill ads dead as I run into them. I have scripts "flashon" and "flashoff" (sort of like the guy in the fantastic 4 -- johnny storm aka the human torch -- "flameon" and "flameoff"). My default is flashoff to avoid stupid moving flash screens (which are 99.99% ads) and to "flashon" to put the plugins back when I want to see something.


Guess what I'm saying is -- I don't see the purpose of a HTML page sooooo complex and fancy dancy that you need the likes of Dreamweaver to build it. Sort of means to me that "the content on that page is so fluffy and non-relevant that we must dress it up pretty to make it look important"


Just my 2cents, but then again, you see my favorite font is apparently 12 point Courier :)

PSP

mo, October 14, 2003 - 6:30 pm UTC

Tom:

Thanks a lot for the answers but:

1. Loadpsp is not in oracle_home/bin on my pc. Database is on unix but I hardly use unix. I run sql*plus for windows and sql*navigator for windows. In this case, do I have to get this file from an oracle database installation on windows server or oracle provides these utilities somewhere for download?

2. What is HTML DB you mentioned? is this oracle portal? is it something I buy from oracle or free? Does it create the HTML tags for you automatically?

Thank you,

Tom Kyte
October 14, 2003 - 7:02 pm UTC

1) they would be on install cds. probably only come with "server".

2) html db is a cool new feature of 10g, it'll be available for 9iR2 as well. see htmldb.oracle.com

PSP Vs. HTP

A reader, May 07, 2004 - 2:01 pm UTC

Tom,

This is a follow-up to your old response back in October 2003:

<quote>
other people love the asp/jsp/psp concept. It is a matter of taste I support. I see no advantage or disadvantage here since both end up being a stored procedure at the end of the day.
</quote>

I don't know if you still feel this way. If you are, let's me hightlight a few big benefits of using PSP.

1) Decoupling of view and business logic.
The web designers can use their HTML tools, like Dreamweaver, to design all their fancy UI. They have different skills than developers. Developers can focus on writing the PLSQL logic.

2) Parallelism can be achieved in development.
The web developers and the developers can both work at the same time. The Web developers do not have to wait for the developer to design the UI. The developers does not have to worry about UI before writing logics.

3) Learning Curve of HTP/HTF APIs for UI.
Web developers know more about HTML/JS than HTP/HTF APIs. They can be quicker writing HTML/JS than HTP/HTF because they have full control of the UI and can use HTML editor.

4) Flexibility
Web UI can uses many advance web features, such as CSS, DHTML, JS, etc. HTP/HTF APIs may not have these features in the current release.

PSP also has its disadvantages. One biggest drawback that I see is that it CANNOT create packages.

PSP can only create stored procedure. Therefore, there may be issue with the procedures in the libarary cache aging out if the shared pool is not probably configured.

I hope you can help me with the following questions:
1) How committed does Oracle have on PSP?

2) Are there any plan to add more feature in the "loadpsp.exe" program, such as creating/appending packages?

3) Do you know if there is any plan for JDeveloper to have a PSP editor?

Besides PSP, I am also evaluating HTMLDB.

Thanks for all you helps.

Peace,
Jon

Tom Kyte
May 07, 2004 - 2:44 pm UTC

1) i use htmldb to accomplish the same. Me, I hate busy "pretty" sites. I like google, slashdot, asktom, amazon. I want consistency and ease of use. Htmldb gives me a functional, consistent look and feel -- the amount of html i generate is tiny.

psp makes the html web designer part programmer.
I'd rather make programmer a tiny bit of html web designer -- not too much at all.

2) htmldb too...

3) database developers pick up htp/htf in a millisecond.

4) htmldb lets me do that and more. (in fact, you are seeing the results of that right now)




I'm not sure of the future of psp's, don't really follow it. I voted against it initially :)



How pass Checkbox Parameters from an HTML Form

Paul, August 11, 2006 - 1:04 pm UTC

Hi Tom,
I am doing a HTML Form with PSP, but I do not know how how pass Checkbox Parameters from an HTML Form without
OWA_UTIL.IDENT_ARR ?



Tom Kyte
August 11, 2006 - 1:19 pm UTC

you can define your own type if you like

create package p
as
type myArray is table of varchar2(4000);
....


you can use p.myArray now if you like.

How capture values of checkbox in psp parameter which type is table of varchar

Paul, August 24, 2006 - 9:15 pm UTC

Hi Tom

I have that form ... but when i want to capture value who user selected in checkbox and save in psp parameter of type table of varchar.I need to save in parameter because i will send that information to other html page.
I am not know how would you please showme how I can do it with example?


That is code of form.

-----------------------------------------------------
<%@ page language="PL/SQL" %>
<%@ page contentType="text/html" %>
<%@ plsql procedure="test" %>
<%@ plsql parameter="p_s" type="VARCHAR2" %>
<%@ plsql parameter="p_t type="myArray" %>
<%!
CURSOR cur_1 IS
SELECT dept_name FROM department WHERE city=p_s;
%>
<html>
<head>
</head>
<body>
<table width="75%" border="0" align="center" class="b1111">
<tr>
<td></td>
</tr>
<tr>
<td><p>List:</p>

<tr>
<% FOR i IN cur_1 LOOP %>
<tr>
<td><form method="POST" action="m.htm">
<p>&nbsp;</p>
<table width="75%" border="0">
<tr>
<td><input type="checkbox" name="checkbox" value= <%= i.dept_name %><%=i.dept_name%>
how capture value checkbox in my parameter of type array ???
</td>
</tr>
</table>
<% END LOOP; %>
<p>
<input type="submit">
</p>
</form>
</td>
</tr>

</td>
<td height="5"></tr>
</table>
</body>
</html>

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

Code Table
create department
dept_name varchar2(50),
city varchar2(30)
);

Thanks

Need Quick Response

Mohame Magdy, October 07, 2012 - 4:18 pm UTC

I made .psp file and compiled it success but i need to runand execute the procedure which already created please what the next step ?

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library