RSS
 

Posts Tagged ‘plsql’

Oracle Database Tips #2: How to replace the occurrence of two or more spaces with a single space using REGEXP_REPLACE

17 Dec

The REGEXP_REPLACE is an Oracle PLSQL function that works almost in the same way of the REPLACE function but extends its functionalities by using regular expression pattern.

In the following example I show you how to replace in a given string each occurrence of two or more spaces with a single space.

SQL> SELECT REGEXP_REPLACE('Too        Many       Spaces','( ){2,}', ' ') REPLACED_STRING FROM DUAL;

REPLACED_STRING
----------------
Too Many Spaces
 

Natively compiled Java stored procedures using NCOMP

24 Oct

1 – Introduction

Few years ago I had the chance to make an integration between the Oracle Database and a rating engine (“WARP4“) developed by ERIS4 company.
The goal was to rate telephone traffic records stored in the database, by sending them to the rating engine.

WARP4 provided some API to allow external application to send records and rate them; this comunication was made via socket layer. In order to increase the performances I had to make several trials and one of my test cases was about the native compilation.

I personally think that Java stored procedure native compilation it’s not worthy, especially when your Java classes need to open frequently a socket connection.
Because the native compilation is a really rare activity, I thought that this post could be useful for those who want to test the ncomp benefits.

Read the rest of this entry »