sql009._formirovanie_shtrix-koda_ean13_po_kodu_zapisi_v_tablice
Содержание
SQL009. Формирование штрих-кода EAN13 по коду записи в таблице
Версии сервера
0.9 | 1.0 | 1.5.3 | 1.5.4 | 1.5.5 | 2.0 | 2.0.3 | 2.0.4 | 2.1 | 2.5 | 3.0 |
---|---|---|---|---|---|---|---|---|---|---|
- | - | - | - | - | - | - | - | Да | Да | Да |
Доступно в
Описание
Пример
CREATE PROCEDURE ID2EAN13 ( PREFIX VARCHAR(10) ,ID INTEGER ) RETURNS ( BARCODE VARCHAR(13) )AS DECLARE VARIABLE N INTEGER; BEGIN BARCODE = PREFIX || LPAD(ID, 12 - CHAR_LENGTH(PREFIX), '0'); N = (CAST (SUBSTRING (BARCODE FROM 2 FOR 1) AS INTEGER)+ CAST (SUBSTRING (BARCODE FROM 4 FOR 1) AS INTEGER)+ CAST (SUBSTRING (BARCODE FROM 6 FOR 1) AS INTEGER)+ CAST (SUBSTRING (BARCODE FROM 8 FOR 1) AS INTEGER)+ CAST (SUBSTRING (BARCODE FROM 10 FOR 1) AS INTEGER)+ CAST (SUBSTRING (BARCODE FROM 12 FOR 1) AS INTEGER) ) * 3+ CAST (SUBSTRING (BARCODE FROM 1 FOR 1) AS INTEGER)+ CAST (SUBSTRING (BARCODE FROM 3 FOR 1) AS INTEGER)+ CAST (SUBSTRING (BARCODE FROM 5 FOR 1) AS INTEGER)+ CAST (SUBSTRING (BARCODE FROM 7 FOR 1) AS INTEGER)+ CAST (SUBSTRING (BARCODE FROM 9 FOR 1) AS INTEGER)+ CAST (SUBSTRING (BARCODE FROM 11 FOR 1) AS INTEGER); N = MOD(N, 10); IF(N > 0)THEN N = 10 - N; BARCODE = BARCODE || CAST(N AS VARCHAR(20)); SUSPEND; END
См. также
Автор
sql009._formirovanie_shtrix-koda_ean13_po_kodu_zapisi_v_tablice.txt · Последнее изменение: 2011/04/02 14:06 (внешнее изменение)
Обсуждение