× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



update file a set optcod=
 (select MIN(B.noptcod)
  from xlfile b
  where a.optcod=b.ioptcod)
where exists
 (select 1
  from xlfile b
  where a.optcod=b.ioptcod)

Great! Thanks for the response.
As per your advise I have done the above sql, it has updated 252 rows when actually it has to update 297 rows.. In order to update correctly in all rows do you have any further advise without getting the problmes (as discussed in below posts)..

I appreciate your help!




Warm Regards,
JoeP





From: "Elvis Budimlic" <ebudimlic@xxxxxxxxxxxxxxxxxxxxxxxxx>
Reply-To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
To: "'Midrange Systems Technical Discussion'" <midrange-l@xxxxxxxxxxxx>
Subject: RE: NOT allowing null value into PF fields(big puzzle)
Date: Wed, 4 Oct 2006 16:30:52 -0500

Try:

update file a set optcod=
  (select MIN(a.noptcod)
   from xlfile b
   where a.optcod=b.ioptcod)
where exists
  (select 1
   from xlfile b
   where a.optcod=b.ioptcod)

Notice I used MIN to select lowest value for 'noptcod'.  You can use MAX if
you prefer. Bottom line is, you need to ensure your SELECT only selects one record per 'optcod'. With your initial statement, you were getting multiple
matches on the primary dial (optcod).

Elvis

-----Original Message-----
Subject: Re: NOT allowing null value into PF fields(big puzzle)

CREATE TABLE XFILE
(IFUTCOD CHAR (4 ),
  NOPTCOD CHAR (6 ) NOT NULL,
  IOPTCOD CHAR (6 ) NOT NULL WITH DEFAULT)
RCDFMT XFILER

Hi Rob As you said I created the table as above  and
1)I have done CPYFRMIMPF
===> CPYFRMIMPF FROMSTMF('/etc/dalc/apps/testfile1.csv') TOFILE(JPASCO/
XFILE) MBROPT(*REPLACE) RCDDLM(*CRLF)

and tried to execute the simple SQL:

update file a set optcod=(select
noptcod from xlfile b
where a.optcod=b.ioptcod)

The sql displays line "      Null values not allowed in column or variable
optcod"

---as per Birgitta's advise I tried to execute the below sql, but i get same

problem
update FILE a
       set OPTCOD = (select b.nOPTCOD from XLFILE b where
a.OPTCOD=b.iOPTCOD)
       where exists (select c.iOPTCOD from XLFILE C where
a.OPTCOD=c.iOPTCOD)

I end up with an error which as below:
"Result of SELECT more than one row."

I have introduced distinct in select statement above , but still same
problem...
Do you think any solution for this?


Warm Regards,
JoeP



--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.