Overblog Tous les blogs Top blogs Technologie & Science Tous les blogs Technologie & Science
Editer l'article Suivre ce blog Administration + Créer mon blog
MENU

This is a bunch of tips and techniques related to Oracle PL/SQL and Forms.

Publicité

Regular expressions

Purpose

Here is a Java Bean that allows to use regular expressions with the Sun Java Plug-in.

Regular expressions have been introduced in the Oracle database with the version 10g.
For those who still use a previous version, this Java Bean allows to use regular expressions to achieve complex validations in the Forms text items.
Because the java.util.regex package is available since the 1.4 version of the JDK, we cannot use it with JInitiator that use the 1.3 instruction set. This is the reason why this Bean works only with the Sun Java Plug-in.


regular expression with the Java Plugin


The Java code

     RegularExp.java  



The implementation class of the Bean Item

     oracle.forms.fd.RegularExp


The methods you can call

Set the pattern

Set_Custom_Property('BLOCK.ITEM', 1, 'SET_PATTERN', 'pattern');

e.g. :
Set_Custom_Property( 'BL.BEAN', 1, '
SET_PATTERN', '
[A-Z][a-z][a-z][a-z]' );   


Set the string to check


Set_Custom_Property('BLOCK.ITEM', 1, 'SET_STRING', 'string');




The properties you can get from the JavaBean


Get the boolean result

Varchar2 :=
Get_Custom_Property( 'BL.BEAN', 1, 'GET_RESULT' ) ;

returns either true or false


Get the corresponding group sub-string

Varchar2 :=
Get_Custom_Property( 'BL.BEAN', 1, 'GET_GROUP' ) ;



Get the start and end position of the substring

Varchar2 :=
Get_Custom_Property( 'BL.BEAN', 1, 'GET_POS' ) ;

returns a value like : start_position,end_position




The sample dialog


     . Download the regularexp.zip file
     . Unzip the file
     . copy the regularexp.jar file in the <ORACLE_HOME>/forms/java directory
     . Edit your /forms/server/formsweb.cfg file
     . Open the REGULAREXP.fmb module (Oracle Forms 10.1.2 and Java Plug-in 1.5.0_06)
     . Compile all and run the module

Publicité
Retour à l'accueil
Partager cet article
Repost0
Pour être informé des derniers articles, inscrivez vous :
Commenter cet article