Re: Sample code for PLSQL Web

From: Mark C. Stock <mcstockX_at_Xenquery>
Date: Wed, 15 Sep 2004 06:42:23 -0400
Message-ID: <>

"Scott Johnson" <> wrote in message news:41479b73$0$26108$
| I'm having a difficult time tryng to get some web code working for pl/sql.
| I have a html procedure that accepts a parameter and looks up data based
| that parameter. If the parameter doesn't exist, then display text entry
| field and recall the procedure with the value entered.
| It looks like htp.isindex might work but I'm not sure how to implement.
| Does anyone have or know of some example code to help me out.
| Thanks,
| Scott

here's the issues you have to deal with, some standard pl/sql, and some toolkit-specific, some HTML-specific

htp.isindex generates, not surprisingly, an HTML <isindex> tag, which has been deprecated as of HTML 4.0. this points out one of the problems of relying on the htp calls -- better to get a good HTML reference (like Danny Goodman's O'Reilly Book 'Dynamic HTML - The Complete Reference) and write code to generate your own DHTML than rely on htp's half-baked and often obsolete wrappers for HTML

<ISINDEX> belongs in the <HEAD> element -- you won't learn that from the toolkit documentation, hence the need to dig into DHTML directly

better to design a page that uses <FORM> and <INPUT> elements

it sounds like you simply want the procedure to call itself again if the database lookup fails, perhaps with an error message, but you don't specify what should happen if it succeeds -- should it allow the user to execute another search? i'll assume yes

so, first thing you need to do, is map out the logic and structure of your procedure(s), as you would with any programming language. to handle it all in one procedure, you need something like this:

[_] generate HTML page and body header tags [_] if a parameter is passed (ie, first call would be with a null parameter) attempt database lookup

    if database lookup succeeds, display results (generate HTML to display results)

    if database lookup fails, display error message [_] always generate HTML <FORM> and <INPUT> elements to prompt for another search

    the action of the <FORM> element is the name of this procedure     the name of the <INPUT> text element is the name of the procedure's parameter
[_] generate HTML body and page end tags

[Quoted] refer to the sample code zipped with my paper (I think you already downloaded it from (, specifically the packages EMPS_PKG, EMPS_PKG02 and EMPS_PKG03 for examples on performing queries based on a parameter.

later on today i'll post another set of sample procedures that illustrates using an HTML form as i've described above

++ mcs Received on Wed Sep 15 2004 - 12:42:23 CEST

Original text of this message