|
You could consider using the COALESCE function to substitute another value for the null. The COALESCE function can also handle a subset of the functions provided by CASE expressions. The result of using COALESCE(e1,e2) is the same as using the expression: CASE WHEN e1 IS NOT NULL THEN e1 ELSE e2 END VALUE can be specified as a synonym for COALESCE. Example 1: Assume that SCORE1 and SCORE2 are SMALLINT columns in table GRADES, and that nulls are allowed in SCORE1 but not in SCORE2. Select all the rows in GRADES for which SCORE1 + SCORE2 > 100, assuming a value of 0 for SCORE1 when SCORE1 is null. SELECT * FROM GRADES WHERE COALESCE(SCORE1,0) + SCORE2 > 100; ---------------------- Scott A. Schollenberger Director, Research & Development Harris Computer Systems Schools division 2011 Renaissance Blvd., Suite 100 King of Prussia, PA 19406 Phone: 610-239-9988 Ext. 305 Fax: 610-239-9995 E-mail: saschollenberger@xxxxxxxxxxxx sschollenberger@xxxxxxxxxxxxxxxxxx Web: www.tenexsys.com IBM Certified Specialist - eServer i5 iSeries Technical Solutions Implementer V5R3 CONFIDENTIALITY NOTICE: This email message, including any attachments, is for the sole use of the intended recipient(s) and contains confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. "Joseph Pascoguin" <joe.pascoguin@ho To tmail.com> rpg400-l@xxxxxxxxxxxx Sent by: cc rpg400-l-bounces@ midrange.com Subject Re: Null values not allowed in column or variable 10/04/2006 11:48 AM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@midrang e.com> Your assumption is correct. I donot want to allow null values into file FILE for OPTCOD.. where as BSCFILE allows null for NOPTCOD.. I tried execute but Iam not correct as per SQL. How do I modify my sql further... update file a set optcod=(select noptcod from bscfile b where a.optcod=b.ioptcod and b.noptcod is not null Warm Regards, JoeP
From: Peter Levy <plevy@xxxxxxxxxxxx> Reply-To: RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To: RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> Subject: Re: Null values not allowed in column or variable Date: Wed, 04 Oct 2006 11:41:16 -0400 I'm going to assume that file BSCFILE allows NOPTCOD to be null, while
file
OPTCOD in file FILE isn't allowed that feature, and that in the former
file
one or more of the NOPTCOD fields are null. You can either change the file to allow null on OPTCOD or add "and b.noptcod is not null" to your WHERE clause. Joseph Pascoguin wrote:Hi when I run below qry I get "Null values not allowed in column or variable
optcod"..how do I solve this? update file a set optcod=(select noptcod from bscfile b where a.optcod=b.ioptcod) The sql displays line " Null values not allowed in column or
variable
optcod" Kindly respond asap. Warm Regards, JoePFrom: rob@xxxxxxxxx Reply-To: RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To: RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> Subject: Re: sql question Date: Tue, 3 Oct 2006 11:51:36 -0400 Go to the FAQ at http://faq.midrange.com and file how to process xls spreadsheets in RPG. Maybe search for hssf. Then read those bad boys and UPDATE them out using traditional RPG, or change your update statement to: UPDATE file SET optcod=:NewOptcod WHERE futcod=:ifsFutcod AND Client=:ifsClient and optcod=:oldOptcod Rob Berendt -- Group Dekko Services, LLC Dept 01.073 PO Box 2000 Dock 108 6928N 400E Kendallville, IN 46755 http://www.dekko.com "Joseph Pascoguin" <joe.pascoguin@xxxxxxxxxxx> Sent by: rpg400-l-bounces@xxxxxxxxxxxx 10/02/2006 02:24 PM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To rpg400-l@xxxxxxxxxxxx cc Subject sql question Hi, I ve a file in which futcod, descr, client & optcod are few of the fields. I 've an xl sheet from the client to replace optcod values with new optcod values. xl sheet contains 5 columns futcod, descr, client &optcod I did simple sql UPDATE file SET optcod='OPTWS' WHERE futcod='FUT01' AND Client='GOLDMAN' and optcod='INXMO' Since the number of entries(around 50) in the xl sheet are less, I opted for this simple manual SQL. How to handle this differently by using a program when the list is big or some times we get 3 to 4 xl sheets from the client(optcod values changes from time to time!)?Warm Regards, JoeP _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l._________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/-- Peter Levy Alliance Shippers, IT Dept Englewood Cliffs, NJ Voice: 201-227-0400 Fax: 201-227-0925 Email: plevy@xxxxxxxxxxxx AIM: pklevyalliance2 --------------- There are 10 kinds of people in the world; Those who understand binary and those who don't.
-- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
_________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.