I have a table with products in and each products has 13 a digit barcode
as its primary key. There
are two basic types of barcodes - those that start with 25 and those that
start with 60. For barcodes that start with 25 only the first six digits
matter, the rest are just check digits. Unfortunately, the full barcode
has been parsed into the database, resulting in duplicate product
information. eg. 2543210000222 and 2543210000123 are the same product.
However, the real problem is that the barcode 2543210000000 may also
I need some way to get rid of all these duplicates and I also need a way
to change all the 25 barcodes such that the barcode consists of the first
6 digits and 7 zeros e.g. 2543210000123 becomes 2543210000000 (I need the
barcode to be 13 digits)
I'm really stuck. Any suggestions would be welcome. What would really be
useful is an example on how to move through a result set one record at a
time, check if that changing the barcode on that current record does not
result in an alreadly existing barcode. If it doesn't, then then record
is updated through an update, if it does, the record is deleted.
He who dies with the most toys ...
... still dies
pgsql-novice by date
|Next:||From: Rob||Date: 2002-04-12 16:11:24|
|Subject: Re: Matching a large number of user chosen|
|Previous:||From: Helge Bahmann||Date: 2002-04-12 11:38:33|
|Subject: Re: Update function|