Path: utzoo!attcan!uunet!mcvax!unido!altger!progsoft From: progsoft@altger.UUCP (progsoft) Newsgroups: comp.databases Subject: Re: Ingres question.... Message-ID: <722@altger.UUCP> Date: 27 May 88 16:08:32 GMT References: <1251@its63b.ed.ac.uk> <22714@bu-cs.BU.EDU> Reply-To: tourist@althh.UUCP (Uli Zug) Organization: A + S Computerhaus GmbH ; Dortmund Lines: 51 Posted: Fri May 27 17:08:32 1988 In article <22714@bu-cs.BU.EDU> berlin@buita.bu.edu (David Fickes Einstein Project) writes: >Just a quick question for you Ingres hackers (RTI that is..) > >I'm attempting to port a VERY old dataset that has no delimiters on >the fields... Most of the 50,000 or so records are in good order now >and I'd like to run a few replace statements as follows: > >replace p(pages=int1(right(squeeze(p.note6),2))) where p.note6="PP ?" > >Unfortunately.. a handful of these records can't convert to integers >either because the last two characters aren't numbers or the field is >longer than it should be.. ect.. (we took the usual cases >when breaking the file into fields and didn't include a few >exceptions..) > >I'd love for the program to do as many as possible and then give >me a count of all the records that cannot be converted.. Is this >possible? For this database, I'll be doing quite a few of thes >conversions and it seems to come up periodically with the type of work >I do... > No, in the current Ingres version Ver 5.0 it's not possible to do a conversion on a whole table if some rows fail. In this case Ingres will abort with an error and back out the whole transaction. But your problem will be solved by RTI with the next Ingres Version (6.0) , than there will be a possibilty to say "convert all rows that match and report the one's that doesn't " But u can write a program in esqlc or osl that makes the conversion in the way u want it , but it will have a real poor performance, because u must then select all rows that u want to convert , (in a table field or into a cursor) , and explicit convert them this requires in osl another select (pseudo-select) and than if the conversion not failed do the update on the effected row. I know that isn't nice , but in my opinion the only way to do such a conversion. Good luck, Uli >-- Uli Zug Bang : ..!unido!altger!althh!tourist A+S Computerhaus GmbH D-4600 Dortmund 1 Voice: + 231/551409 ----------------------------------------------------------------------------