473,499 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

converting Oracle PL/SQL function to DB2 v9

2 New Member
I am a newbie and really needs some assistance. I have struggled with this code. Any assistantance will be very appreciated. The code is below....

CREATE FUNCTION increment_serial_1 (p_serial_num VARCHAR(4000) )
RETURNS VARCHAR(4000)
LANGUAGE SQL

BEGIN ATOMIC

DECLARE l_pattern VARCHAR(30) DEFAULT '[A-Z]';

--| l_components OWA_TEXT.VC_ARR;

--* [200042]"C:\MTK\projects\Unknown1\incrementnm.src"(29: 16)-(29:30)Unrecognized data type: OWA_TEXT.VC_ARR

DECLARE l_components UNKNOWN;

DECLARE l_serial_num_identif VARCHAR(7);

SET l_serial_num_identif = p_serial_num;

IF l_serial_num_identif = '8999999' THEN
SET l_serial_num_identif = 'A000001';

ELSEIF l_serial_num_identif = 'A999999' THEN
SET l_serial_num_identif = 'D000001';

ELSEIF l_serial_num_identif = 'D999999' THEN
SET l_serial_num_identif = 'G000000';

ELSEIF l_serial_num_identif = 'G999999' THEN
SET l_serial_num_identif = 'J000000';

ELSEIF l_serial_num_identif = 'J999999' THEN
SET l_serial_num_identif = 'M000000';

ELSEIF l_serial_num_identif = 'M999999' THEN
SET l_serial_num_identif = 'P000001';

ELSEIF l_serial_num_identif = 'P999999' THEN
SET l_serial_num_identif = 'T000000';

--| ELSIF OWA_PATTERN.MATCH(l_serial_num_identif, l_pattern, l_components)
--| THEN

--* [200011]"C:\MTK\projects\Unknown1\incrementnm.src"(57: 9)-(57:25)Reference to unknown object: OWA_PATTERN.MATCH
--* [200011]"C:\MTK\projects\Unknown1\incrementnm.src"(57: 60)-(57:71)Reference to unknown object: l_components

ELSEIF untranslated predicate. THEN

SET l_serial_num_identif = ORA.EMPTY_TO_NULL(COALESCE(SUBSTR(l_serial_num_ide ntif, 1, 1), '') || COALESCE(ORA.LPAD(ORA.TO_CHAR(ORA.TO_NUMBER(SUBSTR (l_serial_num_identif, 2)) + 1), 6, '0'), ''));

ELSE
SET l_serial_num_identif = ORA.LPAD(ORA.TO_CHAR(ORA.TO_NUMBER(l_serial_num_id entif) + 1), 7, '0');

END IF;

RETURN l_serial_num_identif;

END!
Aug 17 '07 #1
0 1765

Sign in to post your reply or Sign up for a free account.

Similar topics

4
9315
by: Mark Wilson CPU | last post by:
A colleague has written a prototype program in PHP, using a MySQL database. It's a relatively simple app, with a restricted set of mysql commands used (see below). The MySQL DB is being replaced...
3
5198
by: Jan Bols | last post by:
I've been trying to install Oracle 8.1.7 on a fresh Mandrake 9.1 O.S for days, but I'm still not able to get it running. I've tried several install instructions that I found on the internet but no...
3
4033
by: Jevon | last post by:
I am trying to conert a SQL Server (2000) database to Oracle to see if it is a supportable back end for my product. I am running into a stone wall with Stored Procedures though. I was wondering...
3
273
by: Jan Bols | last post by:
I've been trying to install Oracle 8.1.7 on a fresh Mandrake 9.1 O.S for days, but I'm still not able to get it running. I've tried several install instructions that I found on the internet but no...
4
5690
by: --CELKO-- | last post by:
I need to convert a bunch of DB2 triggers to Oracle. Is there any kind of tools for this?
0
7134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7180
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7229
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
3108
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
311
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.