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

z/OS UDB 8.1 and Functions vs Stored Procedures

Hi I'm having problems creating a function in DB2 8 for z/OS that
contains basic procedural language such as "declares"

The only function I have been able to successfuly compile is a code
snippet I found for emulating the SQL Server ISNUMERIC function (Code
at end of post). The defining rule seems to be that only a block of
code that returns a single value can proceed the 'RETURN" function, the
example below has a case statement that returns either a 1 or 0. If I
try to place any code before the return such as declaring a variable
and then using the variable in the return statement, the code fails to
compile.

Does anyone have any insight.

Thanks

Mark.

CREATE FUNCTION MARK.ISNUMERIC2 ( SOURCE VARCHAR(40) FOR SBCS
DATA CCSID EBCDIC )
RETURNS INTEGER
SPECIFIC ISNUMERIC2
LANGUAGE SQL
NOT DETERMINISTIC
EXTERNAL ACTION
READS SQL DATA
CALLED ON NULL INPUT
RETURN CASE WHEN translate(
source,'','0123456789.-+') <'' THEN 0 WHEN
posstr(ltrim(
source),'-') 1 OR posstr(ltrim(
source),'+') 1 THEN 0 WHEN
length(rtrim(ltrim(translate(
source,'','0123456789.')))) 1 OR length(rtrim(ltrim(translate(
source,'','0123456789-+')))) 1 THEN 0 WHEN
posstr(ltrim(rtrim(translate(
source,'','-+'))),' ') 0 THEN 0 WHEN
translate(
source,'','.-+') = '' THEN 0 ELSE 1 END;

Sep 11 '06 #1
0 1127

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: BlueDragon | last post by:
The place where I work is moving to MS SQL Server from Lotus Notes. I have done a lot of coding in Lotus Notes, and have, I suppose, intermediate skills in basic SQL -- queries, insert, updates,...
14
by: Tony | last post by:
Can someone a little more clever than I (which means just about anyone on this list) tell me what the implications/benefits are of this are please? ...
2
by: tomtailor | last post by:
Hello! I'm new to DB2 as you can see at the Posting-Count. I'm not sure but I think that I read about that the Source of stored Procedures and Functions get stored in SYS-Tables. Is this...
5
by: Zlatko Matić | last post by:
Hello. How can I call some functions on MSDE when working in .mdb ? Especially in-line functions which are similar to stored procedures. How can I use MSDE in-line functions as recordsource for...
5
by: Jurgen Defurne | last post by:
I am currently designing an application which should be accessible from different interfaces. For this I like to be using stored procedures to process the contents of form submissions and dialog...
0
by: Zlatko Matić | last post by:
Hello. While I was working with Access Projects (Access front-end with MSDE) I was able to call stored procedures by using ADO command and parameters object. Now I am trying to migrate my...
1
by: mcnewsxp | last post by:
what is the difference between a Stored Procedure and a Function? tia, mcnewsxp
0
by: ddddd | last post by:
AM using the JDBC interface metho getProcedures() to get the stored procedures from the Database... Since this is common interface method am trying out with two different set of databases namely...
1
by: svkreddy | last post by:
Dear All, Please provide the simple information about stored procedures and stored functions in microsoft sql server2005. Please give the information about Nested procedures and nested funtions....
1
by: mansi sharma | last post by:
Functions ia a block of code that performs some task & returns value. Can somebody tell me What are Stored Procedures? I found abt Stored procedues from the Net-->Stored Procedures is a group of...
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
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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,...

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.