473,785 Members | 2,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create Function

japuentem
31 New Member
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 7401
Hevan
17 New Member
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
japuentem
31 New Member
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
gast2007
2 New Member
Looks like you have 1 more "(" than ")"
Jun 19 '07 #4
Hevan
17 New Member
This function works fine. did you drop and rebuild the function and run it?
Jun 19 '07 #5
japuentem
31 New Member
Looks like you have 1 more "(" than ")"
I counted and i have the same number of "(" and ")"
Jun 22 '07 #6
japuentem
31 New Member
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
8103
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
4462
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 function created to do this task. The function I am trying to create is as follows: CREATE FUNCTION customer_bak_proc(integer) RETURNS boolean as 'INSERT INTO customer_bak (SELECT * from customer where id = $1 )' LANGUAGE 'SQL';
4
2758
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 IMMUTABLE AS 'DECLARE invalue ALIAS FOR $1; BEGIN IF invalue=''Male'' OR invalue=''0'' THEN RETURN 0; END IF; IF invalue=''Female'' OR invalue=''1'' THEN RETURN 1; END IF; RAISE EXCEPTION ''Incorrect input value: %'', invalue; END;'
7
8869
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 want my users to be able to select a report, click on a command button on a form, which will then automatically create the report as a pdf file and save it to the user's machine. I am using Adobe Acrobat (5.0 I think) and have Adobe Distiller as a
18
2723
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 http://ucsu.colorado.edu/~bethard/py/pep_create_statement.html In this post, I'm especially soliciting review of Carl Banks's point (now discussed under Open Issues) which asks if it would be better to have the create statement translated into:
14
6141
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 places in that hosting.
4
12442
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 this: can Access create the document and place it as an OLE object to the relevant table? Any help is greatly appreciated. Ricky
10
3993
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 in the list A i want to associate an undetermined number of items. The complication for me is the fact that the items to associate in list A are undetermined.
4
6916
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 function creates the file as expected. When I loop through my array I get the error - "ArgumentException was unhandled - Illegal characters in path" The value "C:\Temp.txt" is the first value in the array - as it works
0
3738
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 had to explore the internet in order to discover various tutorials and examples that have led me on a positive path. Right now I am working on a Google Mash-Up that will incorporate over 14,000 records, which will appear as separate markers that...
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10330
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10153
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10093
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8976
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6740
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4053
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 we have to send another system
3
2880
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.