473,395 Members | 1,418 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.

db2 sql stored procedure

I am having problems getting this sql update statement to work in a
db2 sql stored procedure or if I try to execute it as an input script
to db2 command line. It works fine if I execute it using a SQL editor
on another product we use (dbartisan). What happens is that the first
SET occurs successfully (GAP.STATUS = 'P'), but the 2nd set
GAP.DT_TM_PBLSHD does not work. Any ideas on this would be
appreciated.

Thanks,
Julie

UPDATE GWA.GWA_ACCTNG_PRD as GAP
SET GAP.STATUS = 'P',
GAP.DT_TM_PBLSHD = (SELECT TIMESTAMP(QFB.RUN_DATE,
QFB.RUN_TIME)
FROM STAR.VSTR_QFB as QFB, STAR.TSTR_PPADJ_CTL_165
as PPC,
GWA.GWA_ACCTNG_PRD as GAP1
WHERE CHAR(QFB.RUN_DATE) =
CHAR(SUBSTR(PPC.PUBL_MTS_DATE,1,4) || '-' ||
SUBSTR(PPC.PUBL_MTS_DATE,5,2) || '-' ||
SUBSTR(PPC.PUBL_MTS_DATE,7,2)) AND
QFB.REPORT_ID = 'STM0SMTS' AND
PPC.ACCTNG_DATE = GAP1.ACCTNG_PRD
and GAP1.STATUS = 'O'
AND (LTRIM(RTRIM(COALESCE(CHAR(GAP1.DT_TM_PBLSHD),'')) ) = '')
AND ((LTRIM(RTRIM(COALESCE((SELECT PPC.PUBL_MTS_DATE
FROM STAR.TSTR_PPADJ_CTL_165 as PPC
WHERE PPC.ACCTNG_DATE = GAP1.ACCTNG_PRD),'')))) <>
''))

WHERE GAP.STATUS = 'O' AND
(LTRIM(RTRIM(COALESCE(CHAR(GAP.DT_TM_PBLSHD),''))) = '') AND
((LTRIM(RTRIM(COALESCE((SELECT PPC.PUBL_MTS_DATE
FROM STAR.TSTR_PPADJ_CTL_165 as PPC
WHERE PPC.ACCTNG_DATE = GAP.ACCTNG_PRD),'')))) <> '')

;
Nov 12 '05 #1
4 5123
Julie,

Please, please please, post at least the error message DB2 is raising.
"Does not work" will not give a whole lot of answers in this group....
Best of course is if yoy also post the underlying DDL statements so
interested parties can simply reproduce your problem.

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #2
Julie,

Please, please please, post at least the error message DB2 is raising.
"Does not work" will not give a whole lot of answers in this group....
Best of course is if yoy also post the underlying DDL statements so
interested parties can simply reproduce your problem.

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #3
slaterjas wrote:
WHERE CHAR(QFB.RUN_DATE) =
CHAR(SUBSTR(PPC.PUBL_MTS_DATE,1,4) || '-' ||
SUBSTR(PPC.PUBL_MTS_DATE,5,2) || '-' ||
SUBSTR(PPC.PUBL_MTS_DATE,7,2)) AND


I'm curious about the data types for the columns QFB.RUN_DATE and
PPC.PUBL_MTS_DATE. Are both columns of type DATE? Or is PUBL_MTS_DATE a
varchar that contains a valid date string? If yes, then you might want to
compare the dates like this:

WHERE QFB.RUN_DATE = DATE(PPC.PUBL_MTS_DATE)

Or if PUBL_MTS_DATE is a TIMESTAMP, you can also use the DATE function as
shown above to just extract the DATE portion.
--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #4
slaterjas wrote:
WHERE CHAR(QFB.RUN_DATE) =
CHAR(SUBSTR(PPC.PUBL_MTS_DATE,1,4) || '-' ||
SUBSTR(PPC.PUBL_MTS_DATE,5,2) || '-' ||
SUBSTR(PPC.PUBL_MTS_DATE,7,2)) AND


I'm curious about the data types for the columns QFB.RUN_DATE and
PPC.PUBL_MTS_DATE. Are both columns of type DATE? Or is PUBL_MTS_DATE a
varchar that contains a valid date string? If yes, then you might want to
compare the dates like this:

WHERE QFB.RUN_DATE = DATE(PPC.PUBL_MTS_DATE)

Or if PUBL_MTS_DATE is a TIMESTAMP, you can also use the DATE function as
shown above to just extract the DATE portion.
--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #5

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

Similar topics

3
by: dinesh prasad | last post by:
I'm trying to use a servlet to process a form, then send that data to an SQL server stored procedure. I'm using the WebLogic 8 App. server. I am able to retrieve database information, so I know my...
0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
3
by: Rhino | last post by:
I've spent the last couple of hours trying to figure out how to debug a Java stored procedure and am just going in circles. The last straw came when I got "Cannot open input stream for default"...
4
by: Rhino | last post by:
Is it possible for a Java Stored Procedure in DB2 V7.2 (Windows) to pass a Throwable back to the calling program as an OUT parameter? If yes, what datatype should I use when registering the...
8
by: Thomasb | last post by:
With a background in MS SQL Server programming I'm used to temporary tables. Have just started to work with DB2 ver 7 on z/OS and stumbled into the concept of GLOBAL TEMPORARY TABLE. I have...
2
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
0
by: Amber | last post by:
Stored procedures are faster and more efficient than in-line SQL statements. In this article we will look at two SQL Server stored procedures; one using an input parameter and one not, and see how...
3
by: kd | last post by:
Hi All, How to debug a stored procedure? Thanks, kd
7
by: Dabbler | last post by:
I'm using an ObjectDataSource with a stored procedure and am getting the following error when trying to update (ExecuteNonQuery): System.Data.SqlClient.SqlException: Procedure or Function...
2
by: jed | last post by:
I have created this example in sqlexpress ALTER PROCEDURE . @annualtax FLOAT AS BEGIN SELECT begin1,end1,deductedamount,pecentageextra FROM tax
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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...
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...

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.