473,412 Members | 5,385 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

DB2V9.1 UDFScalar error during build. Any tool to convert T-SQL to DB2 SQL?

25
Hi all,

I have a T-SQL FUNCTION that I am trying to convert to DB2 SQL function. I ran the code through IBM migration Tool but was unable to get a clean conversion.

So okay, I ran the code through another product SwisSQL by AdventNet which appeared to have converted cleanly.

However, when I tried to build and register the UDF in my development center, I am getting this error which has frustrated me all day: The code snippet and error message is as follows:

CODE:
CREATE FUNCTION fnIsVowel
(
c CHAR(1)
)
RETURNS SMALLINT
SPECIFIC fnIsVowel
BEGIN ATOMIC
IF ( c = 'A' ) OR ( c = 'E' ) OR ( c = 'I' ) OR ( c = 'O' ) OR ( c = 'U' ) OR ( c = 'Y' ) THEN
RETURN 1;
END IF;
RETURN 0;
END

CREATE FUNCTION fnSlavoGermanic
(
Word CHAR(50)
)
RETURNS SMALLINT
SPECIFIC fnSlavoGermanic
BEGIN ATOMIC

--Catch NULL also...
IF ( LOCATE('W', Word) > 0 ) OR ( LOCATE('K', Word) > 0 ) OR ( LOCATE('CZ', Word) > 0 ) THEN
RETURN 1;
END IF;

RETURN 0;
END
ERROR MESSAGE
:
DB2ADMIN.fnIsVowel - Build started.
Create user-defined function returns -104.
DB2ADMIN.fnIsVowel: 20: IBMCLI DriverDB2/LINUX SQL0104N An unexpected token "CHAR" was found following "Word ". Expected tokens may include: ".". LINE NUMBER=20. SQLSTATE=42601

DB2ADMIN.fnIsVowel - Build failed.
DB2ADMIN.fnIsVowel - Roll back completed successfully.

As you can see, it seems to approve the first create function but not the second. Can someone point out what is wrong with this statements? So, I added a end of statement delimiter to the first create function to seperte the two functions but then, the parser now don't like the first create function, returning the same message as shown above but this time "IBMCLI DriverDB2/LINUX SQL0104N An unexpected token "CHAR" was found following "c". Expected tokens may include: ".". LINE NUMBER=20. SQLSTATE=42601".

Can someone point out what it is that I am doing wron with this statements? Is there a reliable IBM tool that really can do T-SQL conversion to DB2 SQL"

Thanks
Feb 4 '08 #1
1 2145
sakumar9
127 Expert 100+
The problem is missing delimiter. I tried executing these commands, and I was able to repro the problem.


Expand|Select|Wrap|Line Numbers
  1. Working Code:
  2.  
  3. CREATE FUNCTION fnIsVowel
  4. (
  5. c CHAR(1)
  6. )
  7. RETURNS SMALLINT
  8. SPECIFIC fnIsVowel
  9. BEGIN ATOMIC
  10. IF ( c = 'A' ) OR ( c = 'E' ) OR ( c = 'I' ) OR ( c = 'O' ) OR ( c = 'U' ) OR ( c = 'Y' ) THEN
  11. RETURN 1;
  12. END IF;
  13. RETURN 0;
  14. END @
  15.  
  16. CREATE FUNCTION fnSlavoGermanic
  17. (
  18. Word CHAR(50)
  19. )
  20. RETURNS SMALLINT
  21. SPECIFIC fnSlavoGermanic
  22. BEGIN ATOMIC
  23.  
  24. --Catch NULL also...
  25. IF ( LOCATE('W', Word) > 0 ) OR ( LOCATE('K', Word) > 0 ) OR ( LOCATE('CZ', Word) > 0 ) THEN
  26. RETURN 1;
  27. END IF;
  28.  
  29. RETURN 0;
  30. END @
  31.  
Feb 27 '08 #2

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

Similar topics

5
by: Tony Wright | last post by:
Hi, I am having a problem installing an msi for a web site. The error message I am getting is: "The specified path 'http://mipdev05/features/Fas2' is unavailable. The Internet Information...
3
by: Eric Chong | last post by:
I have been trying to automate our builds using BuildIt tool available from Microsoft. This tool only log whether build is success or fail. Since all developers would like to see what the build...
7
by: Dave L | last post by:
I have a VB.NET 2003 solution with several Windows forms projects and a deployment project. All of that works ok. I need to run an external script or program during the build process. It could...
1
by: sarge | last post by:
error PRJ0019: A tool returned an error code from "Copying assemblies to target directory..." I got this when I added a reference to a project. The reference was to a dll created in another...
1
by: Omundu | last post by:
I'm learning ASP.NET and have developed a project and build it without any build error but when i browse the startup page i receive the error below, i have configure IIS accordingly and have...
2
by: sean | last post by:
Hi there, I am trying to call a C# web service from an aspx page, I have the asmx file, a user control file ascx and the aspx file. I have verified that the web service is returning correct...
9
by: JTrigger | last post by:
When I compile my project using the IDE on a development machine it works just fine. When I compile it on the server using csc.exe, I get the following error when I try to bring it up in the web...
3
by: db2udbgirl | last post by:
Env: DB2 UDB 8.2, AIX 5.3 While trying to load data (73 Million rows, Medium size table uses 4K tablespace) into a table using cursor it fails with "SQL0964C The transaction log for the database...
2
by: f0zzyNUE | last post by:
hi everyone, currently we are testing the performance our application (asp.net based CMS) ... for that reason we wrote a "spider" that starts webrequests for all relevant pages which results in...
1
by: rkcons | last post by:
Any ideals what would cause this ? Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.