14-10. Generating JavaScript via PL/SQL

Problem

Your procedure requires JavaScript but you do not have access to the Oracle application server to store the script file to make it accessible from Apache.

Solution

Use the Oracle PL/SQLWeb Toolkit to output JavaScript within your PL/SQL procedure. There are two steps to define and enable a JavaScript within your PL/SQL procedure.

First, define the JavaScript source on the web page that requires access to your JavaScript routine using the HTML tag <SCRIPT>.

Define a PL/SQL procedure to match the name of the <SCRIPT> tag's source (SRC) property.

In the following example the html procedure defines the <SCRIPT> tag with the source set to empID.js and the js procedure generates the JavaScript code. ...

Get Oracle and PL/SQL Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.