DB2 Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDB2 Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old January 17th, 2005, 05:44 PM
abhijitwalvekar abhijitwalvekar is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 1 abhijitwalvekar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Getting Error "String index out of range: -1" on simple insert statement

Hello,

I'm executing a simple insert statement (please see query below) using DB2 8. On AS400. Statement runs successfully if it doesn't find any rows to insert, it returns error "String index out of range: -1". I'm using iSeries navigator to connect to AS400.

If anyone came across such issue and/or has any suggestion I'd appreciate it.


Thanks in advance.
Abhijit

-- Query --

INSERT INTO CO_BAL_TYPE (
Company_ID,
Balance_Type_ID,
Orig_Bal_Type_ID,
Description,
created_time,
created_by_user_ID,
modify_by_user_ID,
modify_time,
deactivation_date,
bal_subtype
)

SELECT
Company_ID,
( SELECT max(balance_type_iD)+1
FROM co_bal_type
WHERE company_ID = t1.Company_ID
),
Balance_Type_ID,
'DPA - ' || Description,
timestamp(current date, current time),
created_by_user_ID,
modify_by_user_ID,
timestamp(current date, current time),
deactivation_date,
'DPA'
FROM
CO_BAL_TYPE t1
WHERE
bal_subtype is null
AND balance_type_ID > 0
AND NOT EXISTS (
SELECT 1
FROM
CO_BAL_TYPE
WHERE
Company_ID=t1.Company_ID
AND orig_bal_type_ID=t1.balance_type_ID
AND bal_subtype = 'DPA'
);
--
-- End of script

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDB2 Development > Getting Error "String index out of range: -1" on simple insert statement


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

IBM developerWorks




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway