473,395 Members | 1,541 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,395 software developers and data experts.

Create Function

japuentem
throwing error when creating function

DB21034E DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned:

SQL0104N An unexpected token ")" was found following "SULTADO
DECIMAL(6, 3". Expected tokens may include:
"END-OF-STATEMENT". LINE NUMBER=8. SQLSTATE=42601

this is my code

CREATE FUNCTION MAYORRPK(
VALUE1 DECIMAL(6, 3),
VALUE2 DECIMAL(6, 3) )
RETURNS DECIMAL(6, 3)
LANGUAGE SQL
CONTAINS SQL
NO EXTERNAL ACTION
BEGIN ATOMIC
DECLARE RESULTADO DECIMAL(6, 3);
IF (VALUE1 >= VALUE2) THEN
SET RESULTADO = VALUE1;
ELSE
SET RESULTADO = VALUE2;
END IF;
RETURN RESULTADO;
END ;

Any suggestions
Jun 14 '07 #1
6 7374
Hevan
17
Hi,

Remove semicolumn (;) after end and try. All the best.



CREATE FUNCTION MAYORRPK(
VALUE1 DECIMAL(6, 3),
VALUE2 DECIMAL(6, 3) )
RETURNS DECIMAL(6, 3)
LANGUAGE SQL
CONTAINS SQL
NO EXTERNAL ACTION
BEGIN ATOMIC
DECLARE RESULTADO DECIMAL(6, 3);
IF (VALUE1 >= VALUE2) THEN
SET RESULTADO = VALUE1;
ELSE
SET RESULTADO = VALUE2;
END IF;
RETURN RESULTADO;
END
Jun 15 '07 #2
I have the same result

Hi,

Remove semicolumn (;) after end and try. All the best.



CREATE FUNCTION MAYORRPK(
VALUE1 DECIMAL(6, 3),
VALUE2 DECIMAL(6, 3) )
RETURNS DECIMAL(6, 3)
LANGUAGE SQL
CONTAINS SQL
NO EXTERNAL ACTION
BEGIN ATOMIC
DECLARE RESULTADO DECIMAL(6, 3);
IF (VALUE1 >= VALUE2) THEN
SET RESULTADO = VALUE1;
ELSE
SET RESULTADO = VALUE2;
END IF;
RETURN RESULTADO;
END
Jun 15 '07 #3
Looks like you have 1 more "(" than ")"
Jun 19 '07 #4
Hevan
17
This function works fine. did you drop and rebuild the function and run it?
Jun 19 '07 #5
Looks like you have 1 more "(" than ")"
I counted and i have the same number of "(" and ")"
Jun 22 '07 #6
This function works fine. did you drop and rebuild the function and run it?
I treated to run with the command editor of db2 and always send me an error.

i don't know what to do
Jun 22 '07 #7

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

Similar topics

6
by: Rajesh N Thipse | last post by:
Hi, Files can be created using _creat. Similarly, is there a function to create a directory? ~Rajesh
1
by: Barbara Lindsey | last post by:
I am a postgres newbie. I am trying to create a trigger that will put a copy of a record into a backup table before update or delete. As I understand it, in order to do this I must have a...
4
by: Alex Page | last post by:
This is probably really basic, but I can't seem to get it to work. I'm trying to create an enumerated type, using the following code: CREATE FUNCTION enum_gender_in (cstring) RETURNS enum_gender...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
18
by: Steven Bethard | last post by:
I've updated the PEP based on a number of comments on comp.lang.python. The most updated versions are still at: http://ucsu.colorado.edu/~bethard/py/pep_create_statement.txt...
14
by: mistral | last post by:
Need php script to create mySQL database programmatically; since hosting configuration may not allow create database from script, script also need eliminate/rewrite all restrictions in appropriate...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
10
by: SM | last post by:
Hello I'm trying to create a multi dimensional array in JavaScript, but after some reading i still can't figure out how to apply it to my model. Here it is: I have a list A and for each item...
4
by: Vlad | last post by:
I am having problems using the file.create method within a function that is called when looping through an array of filepaths. If I call my function with a hardcoded file path --C:\Temp.txt the...
0
by: TrevRex | last post by:
Hello, I work for a non-profit in San Diego as a GIS Specialist. I have had to teach myself about some scripting to create some dynamic maps, but I am still very limited in my skills, so I have...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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...

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.