× 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.



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




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.