Like the C API, there is only nominal support in JDAPI for PL/SQL modules.
It is possible to load them and inspect the contents, but not to save or modify
them. It is also not possible to compile them programmatically. The PlsqlModule.compile()
method exists only to implement the abstract method on JdapiModule
,
and will throw an exception if called. However, PL/SQL libraries have a text-format
alternative (with a .pld
extension) so it is feasible to generate
a text file containing PL/SQL code, save it with a .pld
extension
and then compile it using the Forms command-line compiler.
It is possible to create and modify library attachments on Form and
Menu modules, however - this is done so like for any other Forms object. The
attached library has properties accessed with getLibraryLocation()
and getLibrarySource()
accessors (or the generic accessors). Calling detach()
will remove
and destroy the library attachment (calling destroy()
will do the
same thing).
The following code sample illustrates how to attach and detach PL/SQL libraries.
import oracle.forms.jdapi.*; /** * Example of attaching a PL/SQL library to a Form module */
public class AttachedLibExample { public static void main(String[] args) { FormModule fmb = FormModule.open("myform.fmb");// get rid of any existing library attachments
JdapiIterator libs = fmb.getAttachedLibraries(); while(libs.hasNext() { AttachedLibrary lib = (AttachedLibrary)libs.next(); lib.detach(); }// attach a new library to the form // the name will be used to find the library on the Forms path
AttachedLibrary lib = new AttachedLibrary(FMB, "LIB1.PLL"); fmb.save("myform.fmb");// finally, clean up
Jdapi.shutdown(); } }