1- create pkg
2- use the query :)
3- query result
SELECT XXXXMAKE_QR.qr_bin ('010TAHER') FROM DUAL;
result
pkg header
CREATE OR REPLACE PACKAGE XXXXmake_qr
AS
FUNCTION max_2 (p1 IN NUMBER DEFAULT 0, p2 IN NUMBER DEFAULT NULL)
RETURN NUMBER;
FUNCTION hex2bin (p_hex IN CLOB)
RETURN CLOB;
--xor
FUNCTION bin_xor_bin (b1 IN VARCHAR2, b2 IN VARCHAR2)
RETURN VARCHAR2;
--bin2dec
FUNCTION bin2dec (b1 IN VARCHAR2)
RETURN NUMBER;
--dec2hex
FUNCTION dec2hex (b1 IN NUMBER)
RETURN VARCHAR2;
FUNCTION galua (n1 IN NUMBER)
RETURN NUMBER;
FUNCTION galua_inv (n1 IN NUMBER)
RETURN NUMBER;
FUNCTION qr_bin (p_text IN VARCHAR2)
RETURN BLOB; -- clob;
END XXXXmake_qr;
/
---pkg Body
/* Formatted on 9/28/2021 12:28:15 AM (QP5 v5.362) */
CREATE OR REPLACE PACKAGE BODY XXXXmake_qr
AS
FUNCTION hex2bin (p_hex IN CLOB)
RETURN CLOB
AS
p_bin CLOB := NULL;
p_semibyte VARCHAR2 (4);
BEGIN
FOR i IN 1 .. DBMS_LOB.GETLENGTH (p_hex)
LOOP
WITH
t1
AS
(SELECT TO_NUMBER (DBMS_LOB.SUBSTR (p_hex, 1, i), 'X') num
FROM DUAL)
SELECT TO_CHAR (
reverse (
MAX (
REPLACE (
SYS_CONNECT_BY_PATH (
SIGN (
BITAND (t1.num,
POWER (2, LEVEL - 1))),
','),
','))),
'FM0000') bin
INTO p_semibyte
FROM t1
CONNECT BY POWER (2, LEVEL - 1) <= t1.num;
p_bin := p_bin || p_semibyte;
END LOOP;
RETURN p_bin;
END;
FUNCTION dec2bin (b1 IN NUMBER)
RETURN VARCHAR2
AS
ret VARCHAR2 (100);
nmod NUMBER;
dev NUMBER;
BEGIN
IF b1 = 1
THEN
RETURN 1;
END IF;
dev := b1;
ret := '';
WHILE dev > 1
LOOP
ret := MOD (dev, 2) || ret;
dev := TRUNC (dev / 2);
IF dev = 1
THEN
ret := 1 || ret;
END IF;
END LOOP;
RETURN ret;
END;
FUNCTION bin2dec (b1 IN VARCHAR2)
RETURN NUMBER
AS
l1 NUMBER := 0;
l2 NUMBER := 0;
t1 VARCHAR2 (1) := '';
t2 VARCHAR2 (1) := '';
t10 VARCHAR2 (100) := '';
t20 VARCHAR2 (100) := '';
r NUMBER := 0;
BEGIN
l1 := LENGTH (b1);
l2 := 0;
r := 0;
IF l1 > 1
THEN
t10 := b1; --t20:=b2;
--if l1>l2 then t20:=lpad(b2,l1,'0'); else t10:=lpad(b1,l2,'0'); end if;
FOR i IN REVERSE 1 .. l1
LOOP
t1 := SUBSTR (t10, i, 1);
r := r + POWER (2, l2) * TO_NUMBER (t1);
l2 := l2 + 1;
END LOOP;
END IF;
RETURN r;
END;
FUNCTION dec2hex (b1 IN NUMBER)
RETURN VARCHAR2
AS
BEGIN
RETURN TRIM (TO_CHAR (b1, 'XXXX'));
END;
FUNCTION bin_xor_bin (b1 IN VARCHAR2, b2 IN VARCHAR2)
RETURN VARCHAR2
AS
l1 NUMBER := 0;
l2 NUMBER := 0;
t1 VARCHAR2 (1) := '';
t2 VARCHAR2 (1) := '';
t10 VARCHAR2 (100) := '';
t20 VARCHAR2 (100) := '';
r VARCHAR2 (100) := '';
BEGIN
l1 := LENGTH (b1);
l2 := LENGTH (b2);
t10 := b1;
t20 := b2;
IF l1 > l2
THEN
t20 := LPAD (b2, l1, '0');
ELSE
t10 := LPAD (b1, l2, '0');
END IF;
FOR i IN REVERSE 1 .. max_2 (l1, l2)
LOOP
t1 := SUBSTR (t10, i, 1);
t2 := SUBSTR (t20, i, 1);
IF t1 = t2
THEN
r := '0' || r;
ELSE
r := '1' || r;
END IF;
END LOOP;
RETURN LPAD (r, 8, '0');
END;
FUNCTION max_2 (p1 IN NUMBER DEFAULT 0, p2 IN NUMBER DEFAULT NULL)
RETURN NUMBER
AS
BEGIN
IF (p1 >= p2) OR (p2 IS NULL)
THEN
RETURN p1;
ELSE
RETURN p2;
END IF;
END;
FUNCTION galua (n1 IN NUMBER)
RETURN NUMBER
AS
nn NUMBER := NULL;
BEGIN
FOR s IN (SELECT u, val
FROM (SELECT 0 u, 1 val FROM DUAL
UNION ALL
SELECT 1 u, 2 val FROM DUAL
UNION ALL
SELECT 2 u, 4 val FROM DUAL
UNION ALL
SELECT 3 u, 8 val FROM DUAL
UNION ALL
SELECT 4 u, 16 val FROM DUAL
UNION ALL
SELECT 5 u, 32 val FROM DUAL
UNION ALL
SELECT 6 u, 64 val FROM DUAL
UNION ALL
SELECT 7 u, 128 val FROM DUAL
UNION ALL
SELECT 8 u, 29 val FROM DUAL
UNION ALL
SELECT 9 u, 58 val FROM DUAL
UNION ALL
SELECT 10 u, 116 val FROM DUAL
UNION ALL
SELECT 11 u, 232 val FROM DUAL
UNION ALL
SELECT 12 u, 205 val FROM DUAL
UNION ALL
SELECT 13 u, 135 val FROM DUAL
UNION ALL
SELECT 14 u, 19 val FROM DUAL
UNION ALL
SELECT 15 u, 38 val FROM DUAL
UNION ALL
SELECT 16 u, 76 val FROM DUAL
UNION ALL
SELECT 17 u, 152 val FROM DUAL
UNION ALL
SELECT 18 u, 45 val FROM DUAL
UNION ALL
SELECT 19 u, 90 val FROM DUAL
UNION ALL
SELECT 20 u, 180 val FROM DUAL
UNION ALL
SELECT 21 u, 117 val FROM DUAL
UNION ALL
SELECT 22 u, 234 val FROM DUAL
UNION ALL
SELECT 23 u, 201 val FROM DUAL
UNION ALL
SELECT 24 u, 143 val FROM DUAL
UNION ALL
SELECT 25 u, 3 val FROM DUAL
UNION ALL
SELECT 26 u, 6 val FROM DUAL
UNION ALL
SELECT 27 u, 12 val FROM DUAL
UNION ALL
SELECT 28 u, 24 val FROM DUAL
UNION ALL
SELECT 29 u, 48 val FROM DUAL
UNION ALL
SELECT 30 u, 96 val FROM DUAL
UNION ALL
SELECT 31 u, 192 val FROM DUAL
UNION ALL
SELECT 32 u, 157 val FROM DUAL
UNION ALL
SELECT 33 u, 39 val FROM DUAL
UNION ALL
SELECT 34 u, 78 val FROM DUAL
UNION ALL
SELECT 35 u, 156 val FROM DUAL
UNION ALL
SELECT 36 u, 37 val FROM DUAL
UNION ALL
SELECT 37 u, 74 val FROM DUAL
UNION ALL
SELECT 38 u, 148 val FROM DUAL
UNION ALL
SELECT 39 u, 53 val FROM DUAL
UNION ALL
SELECT 40 u, 106 val FROM DUAL
UNION ALL
SELECT 41 u, 212 val FROM DUAL
UNION ALL
SELECT 42 u, 181 val FROM DUAL
UNION ALL
SELECT 43 u, 119 val FROM DUAL
UNION ALL
SELECT 44 u, 238 val FROM DUAL
UNION ALL
SELECT 45 u, 193 val FROM DUAL
UNION ALL
SELECT 46 u, 159 val FROM DUAL
UNION ALL
SELECT 47 u, 35 val FROM DUAL
UNION ALL
SELECT 48 u, 70 val FROM DUAL
UNION ALL
SELECT 49 u, 140 val FROM DUAL
UNION ALL
SELECT 50 u, 5 val FROM DUAL
UNION ALL
SELECT 51 u, 10 val FROM DUAL
UNION ALL
SELECT 52 u, 20 val FROM DUAL
UNION ALL
SELECT 53 u, 40 val FROM DUAL
UNION ALL
SELECT 54 u, 80 val FROM DUAL
UNION ALL
SELECT 55 u, 160 val FROM DUAL
UNION ALL
SELECT 56 u, 93 val FROM DUAL
UNION ALL
SELECT 57 u, 186 val FROM DUAL
UNION ALL
SELECT 58 u, 105 val FROM DUAL
UNION ALL
SELECT 59 u, 210 val FROM DUAL
UNION ALL
SELECT 60 u, 185 val FROM DUAL
UNION ALL
SELECT 61 u, 111 val FROM DUAL
UNION ALL
SELECT 62 u, 222 val FROM DUAL
UNION ALL
SELECT 63 u, 161 val FROM DUAL
UNION ALL
SELECT 64 u, 95 val FROM DUAL
UNION ALL
SELECT 65 u, 190 val FROM DUAL
UNION ALL
SELECT 66 u, 97 val FROM DUAL
UNION ALL
SELECT 67 u, 194 val FROM DUAL
UNION ALL
SELECT 68 u, 153 val FROM DUAL
UNION ALL
SELECT 69 u, 47 val FROM DUAL
UNION ALL
SELECT 70 u, 94 val FROM DUAL
UNION ALL
SELECT 71 u, 188 val FROM DUAL
UNION ALL
SELECT 72 u, 101 val FROM DUAL
UNION ALL
SELECT 73 u, 202 val FROM DUAL
UNION ALL
SELECT 74 u, 137 val FROM DUAL
UNION ALL
SELECT 75 u, 15 val FROM DUAL
UNION ALL
SELECT 76 u, 30 val FROM DUAL
UNION ALL
SELECT 77 u, 60 val FROM DUAL
UNION ALL
SELECT 78 u, 120 val FROM DUAL
UNION ALL
SELECT 79 u, 240 val FROM DUAL
UNION ALL
SELECT 80 u, 253 val FROM DUAL
UNION ALL
SELECT 81 u, 231 val FROM DUAL
UNION ALL
SELECT 82 u, 211 val FROM DUAL
UNION ALL
SELECT 83 u, 187 val FROM DUAL
UNION ALL
SELECT 84 u, 107 val FROM DUAL
UNION ALL
SELECT 85 u, 214 val FROM DUAL
UNION ALL
SELECT 86 u, 177 val FROM DUAL
UNION ALL
SELECT 87 u, 127 val FROM DUAL
UNION ALL
SELECT 88 u, 254 val FROM DUAL
UNION ALL
SELECT 89 u, 225 val FROM DUAL
UNION ALL
SELECT 90 u, 223 val FROM DUAL
UNION ALL
SELECT 91 u, 163 val FROM DUAL
UNION ALL
SELECT 92 u, 91 val FROM DUAL
UNION ALL
SELECT 93 u, 182 val FROM DUAL
UNION ALL
SELECT 94 u, 113 val FROM DUAL
UNION ALL
SELECT 95 u, 226 val FROM DUAL
UNION ALL
SELECT 96 u, 217 val FROM DUAL
UNION ALL
SELECT 97 u, 175 val FROM DUAL
UNION ALL
SELECT 98 u, 67 val FROM DUAL
UNION ALL
SELECT 99 u, 134 val FROM DUAL
UNION ALL
SELECT 100 u, 17 val FROM DUAL
UNION ALL
SELECT 101 u, 34 val FROM DUAL
UNION ALL
SELECT 102 u, 68 val FROM DUAL
UNION ALL
SELECT 103 u, 136 val FROM DUAL
UNION ALL
SELECT 104 u, 13 val FROM DUAL
UNION ALL
SELECT 105 u, 26 val FROM DUAL
UNION ALL
SELECT 106 u, 52 val FROM DUAL
UNION ALL
SELECT 107 u, 104 val FROM DUAL
UNION ALL
SELECT 108 u, 208 val FROM DUAL
UNION ALL
SELECT 109 u, 189 val FROM DUAL
UNION ALL
SELECT 110 u, 103 val FROM DUAL
UNION ALL
SELECT 111 u, 206 val FROM DUAL
UNION ALL
SELECT 112 u, 129 val FROM DUAL
UNION ALL
SELECT 113 u, 31 val FROM DUAL
UNION ALL
SELECT 114 u, 62 val FROM DUAL
UNION ALL
SELECT 115 u, 124 val FROM DUAL
UNION ALL
SELECT 116 u, 248 val FROM DUAL
UNION ALL
SELECT 117 u, 237 val FROM DUAL
UNION ALL
SELECT 118 u, 199 val FROM DUAL
UNION ALL
SELECT 119 u, 147 val FROM DUAL
UNION ALL
SELECT 120 u, 59 val FROM DUAL
UNION ALL
SELECT 121 u, 118 val FROM DUAL
UNION ALL
SELECT 122 u, 236 val FROM DUAL
UNION ALL
SELECT 123 u, 197 val FROM DUAL
UNION ALL
SELECT 124 u, 151 val FROM DUAL
UNION ALL
SELECT 125 u, 51 val FROM DUAL
UNION ALL
SELECT 126 u, 102 val FROM DUAL
UNION ALL
SELECT 127 u, 204 val FROM DUAL
UNION ALL
SELECT 128 u, 133 val FROM DUAL
UNION ALL
SELECT 129 u, 23 val FROM DUAL
UNION ALL
SELECT 130 u, 46 val FROM DUAL
UNION ALL
SELECT 131 u, 92 val FROM DUAL
UNION ALL
SELECT 132 u, 184 val FROM DUAL
UNION ALL
SELECT 133 u, 109 val FROM DUAL
UNION ALL
SELECT 134 u, 218 val FROM DUAL
UNION ALL
SELECT 135 u, 169 val FROM DUAL
UNION ALL
SELECT 136 u, 79 val FROM DUAL
UNION ALL
SELECT 137 u, 158 val FROM DUAL
UNION ALL
SELECT 138 u, 33 val FROM DUAL
UNION ALL
SELECT 139 u, 66 val FROM DUAL
UNION ALL
SELECT 140 u, 132 val FROM DUAL
UNION ALL
SELECT 141 u, 21 val FROM DUAL
UNION ALL
SELECT 142 u, 42 val FROM DUAL
UNION ALL
SELECT 143 u, 84 val FROM DUAL
UNION ALL
SELECT 144 u, 168 val FROM DUAL
UNION ALL
SELECT 145 u, 77 val FROM DUAL
UNION ALL
SELECT 146 u, 154 val FROM DUAL
UNION ALL
SELECT 147 u, 41 val FROM DUAL
UNION ALL
SELECT 148 u, 82 val FROM DUAL
UNION ALL
SELECT 149 u, 164 val FROM DUAL
UNION ALL
SELECT 150 u, 85 val FROM DUAL
UNION ALL
SELECT 151 u, 170 val FROM DUAL
UNION ALL
SELECT 152 u, 73 val FROM DUAL
UNION ALL
SELECT 153 u, 146 val FROM DUAL
UNION ALL
SELECT 154 u, 57 val FROM DUAL
UNION ALL
SELECT 155 u, 114 val FROM DUAL
UNION ALL
SELECT 156 u, 228 val FROM DUAL
UNION ALL
SELECT 157 u, 213 val FROM DUAL
UNION ALL
SELECT 158 u, 183 val FROM DUAL
UNION ALL
SELECT 159 u, 115 val FROM DUAL
UNION ALL
SELECT 160 u, 230 val FROM DUAL
UNION ALL
SELECT 161 u, 209 val FROM DUAL
UNION ALL
SELECT 162 u, 191 val FROM DUAL
UNION ALL
SELECT 163 u, 99 val FROM DUAL
UNION ALL
SELECT 164 u, 198 val FROM DUAL
UNION ALL
SELECT 165 u, 145 val FROM DUAL
UNION ALL
SELECT 166 u, 63 val FROM DUAL
UNION ALL
SELECT 167 u, 126 val FROM DUAL
UNION ALL
SELECT 168 u, 252 val FROM DUAL
UNION ALL
SELECT 169 u, 229 val FROM DUAL
UNION ALL
SELECT 170 u, 215 val FROM DUAL
UNION ALL
SELECT 171 u, 179 val FROM DUAL
UNION ALL
SELECT 172 u, 123 val FROM DUAL
UNION ALL
SELECT 173 u, 246 val FROM DUAL
UNION ALL
SELECT 174 u, 241 val FROM DUAL
UNION ALL
SELECT 175 u, 255 val FROM DUAL
UNION ALL
SELECT 176 u, 227 val FROM DUAL
UNION ALL
SELECT 177 u, 219 val FROM DUAL
UNION ALL
SELECT 178 u, 171 val FROM DUAL
UNION ALL
SELECT 179 u, 75 val FROM DUAL
UNION ALL
SELECT 180 u, 150 val FROM DUAL
UNION ALL
SELECT 181 u, 49 val FROM DUAL
UNION ALL
SELECT 182 u, 98 val FROM DUAL
UNION ALL
SELECT 183 u, 196 val FROM DUAL
UNION ALL
SELECT 184 u, 149 val FROM DUAL
UNION ALL
SELECT 185 u, 55 val FROM DUAL
UNION ALL
SELECT 186 u, 110 val FROM DUAL
UNION ALL
SELECT 187 u, 220 val FROM DUAL
UNION ALL
SELECT 188 u, 165 val FROM DUAL
UNION ALL
SELECT 189 u, 87 val FROM DUAL
UNION ALL
SELECT 190 u, 174 val FROM DUAL
UNION ALL
SELECT 191 u, 65 val FROM DUAL
UNION ALL
SELECT 192 u, 130 val FROM DUAL
UNION ALL
SELECT 193 u, 25 val FROM DUAL
UNION ALL
SELECT 194 u, 50 val FROM DUAL
UNION ALL
SELECT 195 u, 100 val FROM DUAL
UNION ALL
SELECT 196 u, 200 val FROM DUAL
UNION ALL
SELECT 197 u, 141 val FROM DUAL
UNION ALL
SELECT 198 u, 7 val FROM DUAL
UNION ALL
SELECT 199 u, 14 val FROM DUAL
UNION ALL
SELECT 200 u, 28 val FROM DUAL
UNION ALL
SELECT 201 u, 56 val FROM DUAL
UNION ALL
SELECT 202 u, 112 val FROM DUAL
UNION ALL
SELECT 203 u, 224 val FROM DUAL
UNION ALL
SELECT 204 u, 221 val FROM DUAL
UNION ALL
SELECT 205 u, 167 val FROM DUAL
UNION ALL
SELECT 206 u, 83 val FROM DUAL
UNION ALL
SELECT 207 u, 166 val FROM DUAL
UNION ALL
SELECT 208 u, 81 val FROM DUAL
UNION ALL
SELECT 209 u, 162 val FROM DUAL
UNION ALL
SELECT 210 u, 89 val FROM DUAL
UNION ALL
SELECT 211 u, 178 val FROM DUAL
UNION ALL
SELECT 212 u, 121 val FROM DUAL
UNION ALL
SELECT 213 u, 242 val FROM DUAL
UNION ALL
SELECT 214 u, 249 val FROM DUAL
UNION ALL
SELECT 215 u, 239 val FROM DUAL
UNION ALL
SELECT 216 u, 195 val FROM DUAL
UNION ALL
SELECT 217 u, 155 val FROM DUAL
UNION ALL
SELECT 218 u, 43 val FROM DUAL
UNION ALL
SELECT 219 u, 86 val FROM DUAL
UNION ALL
SELECT 220 u, 172 val FROM DUAL
UNION ALL
SELECT 221 u, 69 val FROM DUAL
UNION ALL
SELECT 222 u, 138 val FROM DUAL
UNION ALL
SELECT 223 u, 9 val FROM DUAL
UNION ALL
SELECT 224 u, 18 val FROM DUAL
UNION ALL
SELECT 225 u, 36 val FROM DUAL
UNION ALL
SELECT 226 u, 72 val FROM DUAL
UNION ALL
SELECT 227 u, 144 val FROM DUAL
UNION ALL
SELECT 228 u, 61 val FROM DUAL
UNION ALL
SELECT 229 u, 122 val FROM DUAL
UNION ALL
SELECT 230 u, 244 val FROM DUAL
UNION ALL
SELECT 231 u, 245 val FROM DUAL
UNION ALL
SELECT 232 u, 247 val FROM DUAL
UNION ALL
SELECT 233 u, 243 val FROM DUAL
UNION ALL
SELECT 234 u, 251 val FROM DUAL
UNION ALL
SELECT 235 u, 235 val FROM DUAL
UNION ALL
SELECT 236 u, 203 val FROM DUAL
UNION ALL
SELECT 237 u, 139 val FROM DUAL
UNION ALL
SELECT 238 u, 11 val FROM DUAL
UNION ALL
SELECT 239 u, 22 val FROM DUAL
UNION ALL
SELECT 240 u, 44 val FROM DUAL
UNION ALL
SELECT 241 u, 88 val FROM DUAL
UNION ALL
SELECT 242 u, 176 val FROM DUAL
UNION ALL
SELECT 243 u, 125 val FROM DUAL
UNION ALL
SELECT 244 u, 250 val FROM DUAL
UNION ALL
SELECT 245 u, 233 val FROM DUAL
UNION ALL
SELECT 246 u, 207 val FROM DUAL
UNION ALL
SELECT 247 u, 131 val FROM DUAL
UNION ALL
SELECT 248 u, 27 val FROM DUAL
UNION ALL
SELECT 249 u, 54 val FROM DUAL
UNION ALL
SELECT 250 u, 108 val FROM DUAL
UNION ALL
SELECT 251 u, 216 val FROM DUAL
UNION ALL
SELECT 252 u, 173 val FROM DUAL
UNION ALL
SELECT 253 u, 71 val FROM DUAL
UNION ALL
SELECT 254 u, 142 val FROM DUAL
UNION ALL
SELECT 255 u, 1 val FROM DUAL)
WHERE u = n1)
LOOP
nn := s.val;
END LOOP;
RETURN nn;
END;
FUNCTION galua_inv (n1 IN NUMBER)
RETURN NUMBER
AS
nn NUMBER := NULL;
BEGIN
FOR s IN (SELECT u, val
FROM (SELECT 0 u, NULL val FROM DUAL
UNION ALL
SELECT 1 u, 0 val FROM DUAL
UNION ALL
SELECT 2 u, 1 val FROM DUAL
UNION ALL
SELECT 3 u, 25 val FROM DUAL
UNION ALL
SELECT 4 u, 2 val FROM DUAL
UNION ALL
SELECT 5 u, 50 val FROM DUAL
UNION ALL
SELECT 6 u, 26 val FROM DUAL
UNION ALL
SELECT 7 u, 198 val FROM DUAL
UNION ALL
SELECT 8 u, 3 val FROM DUAL
UNION ALL
SELECT 9 u, 223 val FROM DUAL
UNION ALL
SELECT 10 u, 51 val FROM DUAL
UNION ALL
SELECT 11 u, 238 val FROM DUAL
UNION ALL
SELECT 12 u, 27 val FROM DUAL
UNION ALL
SELECT 13 u, 104 val FROM DUAL
UNION ALL
SELECT 14 u, 199 val FROM DUAL
UNION ALL
SELECT 15 u, 75 val FROM DUAL
UNION ALL
SELECT 16 u, 4 val FROM DUAL
UNION ALL
SELECT 17 u, 100 val FROM DUAL
UNION ALL
SELECT 18 u, 224 val FROM DUAL
UNION ALL
SELECT 19 u, 14 val FROM DUAL
UNION ALL
SELECT 20 u, 52 val FROM DUAL
UNION ALL
SELECT 21 u, 141 val FROM DUAL
UNION ALL
SELECT 22 u, 239 val FROM DUAL
UNION ALL
SELECT 23 u, 129 val FROM DUAL
UNION ALL
SELECT 24 u, 28 val FROM DUAL
UNION ALL
SELECT 25 u, 193 val FROM DUAL
UNION ALL
SELECT 26 u, 105 val FROM DUAL
UNION ALL
SELECT 27 u, 248 val FROM DUAL
UNION ALL
SELECT 28 u, 200 val FROM DUAL
UNION ALL
SELECT 29 u, 8 val FROM DUAL
UNION ALL
SELECT 30 u, 76 val FROM DUAL
UNION ALL
SELECT 31 u, 113 val FROM DUAL
UNION ALL
SELECT 32 u, 5 val FROM DUAL
UNION ALL
SELECT 33 u, 138 val FROM DUAL
UNION ALL
SELECT 34 u, 101 val FROM DUAL
UNION ALL
SELECT 35 u, 47 val FROM DUAL
UNION ALL
SELECT 36 u, 225 val FROM DUAL
UNION ALL
SELECT 37 u, 36 val FROM DUAL
UNION ALL
SELECT 38 u, 15 val FROM DUAL
UNION ALL
SELECT 39 u, 33 val FROM DUAL
UNION ALL
SELECT 40 u, 53 val FROM DUAL
UNION ALL
SELECT 41 u, 147 val FROM DUAL
UNION ALL
SELECT 42 u, 142 val FROM DUAL
UNION ALL
SELECT 43 u, 218 val FROM DUAL
UNION ALL
SELECT 44 u, 240 val FROM DUAL
UNION ALL
SELECT 45 u, 18 val FROM DUAL
UNION ALL
SELECT 46 u, 130 val FROM DUAL
UNION ALL
SELECT 47 u, 69 val FROM DUAL
UNION ALL
SELECT 48 u, 29 val FROM DUAL
UNION ALL
SELECT 49 u, 181 val FROM DUAL
UNION ALL
SELECT 50 u, 194 val FROM DUAL
UNION ALL
SELECT 51 u, 125 val FROM DUAL
UNION ALL
SELECT 52 u, 106 val FROM DUAL
UNION ALL
SELECT 53 u, 39 val FROM DUAL
UNION ALL
SELECT 54 u, 249 val FROM DUAL
UNION ALL
SELECT 55 u, 185 val FROM DUAL
UNION ALL
SELECT 56 u, 201 val FROM DUAL
UNION ALL
SELECT 57 u, 154 val FROM DUAL
UNION ALL
SELECT 58 u, 9 val FROM DUAL
UNION ALL
SELECT 59 u, 120 val FROM DUAL
UNION ALL
SELECT 60 u, 77 val FROM DUAL
UNION ALL
SELECT 61 u, 228 val FROM DUAL
UNION ALL
SELECT 62 u, 114 val FROM DUAL
UNION ALL
SELECT 63 u, 166 val FROM DUAL
UNION ALL
SELECT 64 u, 6 val FROM DUAL
UNION ALL
SELECT 65 u, 191 val FROM DUAL
UNION ALL
SELECT 66 u, 139 val FROM DUAL
UNION ALL
SELECT 67 u, 98 val FROM DUAL
UNION ALL
SELECT 68 u, 102 val FROM DUAL
UNION ALL
SELECT 69 u, 221 val FROM DUAL
UNION ALL
SELECT 70 u, 48 val FROM DUAL
UNION ALL
SELECT 71 u, 253 val FROM DUAL
UNION ALL
SELECT 72 u, 226 val FROM DUAL
UNION ALL
SELECT 73 u, 152 val FROM DUAL
UNION ALL
SELECT 74 u, 37 val FROM DUAL
UNION ALL
SELECT 75 u, 179 val FROM DUAL
UNION ALL
SELECT 76 u, 16 val FROM DUAL
UNION ALL
SELECT 77 u, 145 val FROM DUAL
UNION ALL
SELECT 78 u, 34 val FROM DUAL
UNION ALL
SELECT 79 u, 136 val FROM DUAL
UNION ALL
SELECT 80 u, 54 val FROM DUAL
UNION ALL
SELECT 81 u, 208 val FROM DUAL
UNION ALL
SELECT 82 u, 148 val FROM DUAL
UNION ALL
SELECT 83 u, 206 val FROM DUAL
UNION ALL
SELECT 84 u, 143 val FROM DUAL
UNION ALL
SELECT 85 u, 150 val FROM DUAL
UNION ALL
SELECT 86 u, 219 val FROM DUAL
UNION ALL
SELECT 87 u, 189 val FROM DUAL
UNION ALL
SELECT 88 u, 241 val FROM DUAL
UNION ALL
SELECT 89 u, 210 val FROM DUAL
UNION ALL
SELECT 90 u, 19 val FROM DUAL
UNION ALL
SELECT 91 u, 92 val FROM DUAL
UNION ALL
SELECT 92 u, 131 val FROM DUAL
UNION ALL
SELECT 93 u, 56 val FROM DUAL
UNION ALL
SELECT 94 u, 70 val FROM DUAL
UNION ALL
SELECT 95 u, 64 val FROM DUAL
UNION ALL
SELECT 96 u, 30 val FROM DUAL
UNION ALL
SELECT 97 u, 66 val FROM DUAL
UNION ALL
SELECT 98 u, 182 val FROM DUAL
UNION ALL
SELECT 99 u, 163 val FROM DUAL
UNION ALL
SELECT 100 u, 195 val FROM DUAL
UNION ALL
SELECT 101 u, 72 val FROM DUAL
UNION ALL
SELECT 102 u, 126 val FROM DUAL
UNION ALL
SELECT 103 u, 110 val FROM DUAL
UNION ALL
SELECT 104 u, 107 val FROM DUAL
UNION ALL
SELECT 105 u, 58 val FROM DUAL
UNION ALL
SELECT 106 u, 40 val FROM DUAL
UNION ALL
SELECT 107 u, 84 val FROM DUAL
UNION ALL
SELECT 108 u, 250 val FROM DUAL
UNION ALL
SELECT 109 u, 133 val FROM DUAL
UNION ALL
SELECT 110 u, 186 val FROM DUAL
UNION ALL
SELECT 111 u, 61 val FROM DUAL
UNION ALL
SELECT 112 u, 202 val FROM DUAL
UNION ALL
SELECT 113 u, 94 val FROM DUAL
UNION ALL
SELECT 114 u, 155 val FROM DUAL
UNION ALL
SELECT 115 u, 159 val FROM DUAL
UNION ALL
SELECT 116 u, 10 val FROM DUAL
UNION ALL
SELECT 117 u, 21 val FROM DUAL
UNION ALL
SELECT 118 u, 121 val FROM DUAL
UNION ALL
SELECT 119 u, 43 val FROM DUAL
UNION ALL
SELECT 120 u, 78 val FROM DUAL
UNION ALL
SELECT 121 u, 212 val FROM DUAL
UNION ALL
SELECT 122 u, 229 val FROM DUAL
UNION ALL
SELECT 123 u, 172 val FROM DUAL
UNION ALL
SELECT 124 u, 115 val FROM DUAL
UNION ALL
SELECT 125 u, 243 val FROM DUAL
UNION ALL
SELECT 126 u, 167 val FROM DUAL
UNION ALL
SELECT 127 u, 87 val FROM DUAL
UNION ALL
SELECT 128 u, 7 val FROM DUAL
UNION ALL
SELECT 129 u, 112 val FROM DUAL
UNION ALL
SELECT 130 u, 192 val FROM DUAL
UNION ALL
SELECT 131 u, 247 val FROM DUAL
UNION ALL
SELECT 132 u, 140 val FROM DUAL
UNION ALL
SELECT 133 u, 128 val FROM DUAL
UNION ALL
SELECT 134 u, 99 val FROM DUAL
UNION ALL
SELECT 135 u, 13 val FROM DUAL
UNION ALL
SELECT 136 u, 103 val FROM DUAL
UNION ALL
SELECT 137 u, 74 val FROM DUAL
UNION ALL
SELECT 138 u, 222 val FROM DUAL
UNION ALL
SELECT 139 u, 237 val FROM DUAL
UNION ALL
SELECT 140 u, 49 val FROM DUAL
UNION ALL
SELECT 141 u, 197 val FROM DUAL
UNION ALL
SELECT 142 u, 254 val FROM DUAL
UNION ALL
SELECT 143 u, 24 val FROM DUAL
UNION ALL
SELECT 144 u, 227 val FROM DUAL
UNION ALL
SELECT 145 u, 165 val FROM DUAL
UNION ALL
SELECT 146 u, 153 val FROM DUAL
UNION ALL
SELECT 147 u, 119 val FROM DUAL
UNION ALL
SELECT 148 u, 38 val FROM DUAL
UNION ALL
SELECT 149 u, 184 val FROM DUAL
UNION ALL
SELECT 150 u, 180 val FROM DUAL
UNION ALL
SELECT 151 u, 124 val FROM DUAL
UNION ALL
SELECT 152 u, 17 val FROM DUAL
UNION ALL
SELECT 153 u, 68 val FROM DUAL
UNION ALL
SELECT 154 u, 146 val FROM DUAL
UNION ALL
SELECT 155 u, 217 val FROM DUAL
UNION ALL
SELECT 156 u, 35 val FROM DUAL
UNION ALL
SELECT 157 u, 32 val FROM DUAL
UNION ALL
SELECT 158 u, 137 val FROM DUAL
UNION ALL
SELECT 159 u, 46 val FROM DUAL
UNION ALL
SELECT 160 u, 55 val FROM DUAL
UNION ALL
SELECT 161 u, 63 val FROM DUAL
UNION ALL
SELECT 162 u, 209 val FROM DUAL
UNION ALL
SELECT 163 u, 91 val FROM DUAL
UNION ALL
SELECT 164 u, 149 val FROM DUAL
UNION ALL
SELECT 165 u, 188 val FROM DUAL
UNION ALL
SELECT 166 u, 207 val FROM DUAL
UNION ALL
SELECT 167 u, 205 val FROM DUAL
UNION ALL
SELECT 168 u, 144 val FROM DUAL
UNION ALL
SELECT 169 u, 135 val FROM DUAL
UNION ALL
SELECT 170 u, 151 val FROM DUAL
UNION ALL
SELECT 171 u, 178 val FROM DUAL
UNION ALL
SELECT 172 u, 220 val FROM DUAL
UNION ALL
SELECT 173 u, 252 val FROM DUAL
UNION ALL
SELECT 174 u, 190 val FROM DUAL
UNION ALL
SELECT 175 u, 97 val FROM DUAL
UNION ALL
SELECT 176 u, 242 val FROM DUAL
UNION ALL
SELECT 177 u, 86 val FROM DUAL
UNION ALL
SELECT 178 u, 211 val FROM DUAL
UNION ALL
SELECT 179 u, 171 val FROM DUAL
UNION ALL
SELECT 180 u, 20 val FROM DUAL
UNION ALL
SELECT 181 u, 42 val FROM DUAL
UNION ALL
SELECT 182 u, 93 val FROM DUAL
UNION ALL
SELECT 183 u, 158 val FROM DUAL
UNION ALL
SELECT 184 u, 132 val FROM DUAL
UNION ALL
SELECT 185 u, 60 val FROM DUAL
UNION ALL
SELECT 186 u, 57 val FROM DUAL
UNION ALL
SELECT 187 u, 83 val FROM DUAL
UNION ALL
SELECT 188 u, 71 val FROM DUAL
UNION ALL
SELECT 189 u, 109 val FROM DUAL
UNION ALL
SELECT 190 u, 65 val FROM DUAL
UNION ALL
SELECT 191 u, 162 val FROM DUAL
UNION ALL
SELECT 192 u, 31 val FROM DUAL
UNION ALL
SELECT 193 u, 45 val FROM DUAL
UNION ALL
SELECT 194 u, 67 val FROM DUAL
UNION ALL
SELECT 195 u, 216 val FROM DUAL
UNION ALL
SELECT 196 u, 183 val FROM DUAL
UNION ALL
SELECT 197 u, 123 val FROM DUAL
UNION ALL
SELECT 198 u, 164 val FROM DUAL
UNION ALL
SELECT 199 u, 118 val FROM DUAL
UNION ALL
SELECT 200 u, 196 val FROM DUAL
UNION ALL
SELECT 201 u, 23 val FROM DUAL
UNION ALL
SELECT 202 u, 73 val FROM DUAL
UNION ALL
SELECT 203 u, 236 val FROM DUAL
UNION ALL
SELECT 204 u, 127 val FROM DUAL
UNION ALL
SELECT 205 u, 12 val FROM DUAL
UNION ALL
SELECT 206 u, 111 val FROM DUAL
UNION ALL
SELECT 207 u, 246 val FROM DUAL
UNION ALL
SELECT 208 u, 108 val FROM DUAL
UNION ALL
SELECT 209 u, 161 val FROM DUAL
UNION ALL
SELECT 210 u, 59 val FROM DUAL
UNION ALL
SELECT 211 u, 82 val FROM DUAL
UNION ALL
SELECT 212 u, 41 val FROM DUAL
UNION ALL
SELECT 213 u, 157 val FROM DUAL
UNION ALL
SELECT 214 u, 85 val FROM DUAL
UNION ALL
SELECT 215 u, 170 val FROM DUAL
UNION ALL
SELECT 216 u, 251 val FROM DUAL
UNION ALL
SELECT 217 u, 96 val FROM DUAL
UNION ALL
SELECT 218 u, 134 val FROM DUAL
UNION ALL
SELECT 219 u, 177 val FROM DUAL
UNION ALL
SELECT 220 u, 187 val FROM DUAL
UNION ALL
SELECT 221 u, 204 val FROM DUAL
UNION ALL
SELECT 222 u, 62 val FROM DUAL
UNION ALL
SELECT 223 u, 90 val FROM DUAL
UNION ALL
SELECT 224 u, 203 val FROM DUAL
UNION ALL
SELECT 225 u, 89 val FROM DUAL
UNION ALL
SELECT 226 u, 95 val FROM DUAL
UNION ALL
SELECT 227 u, 176 val FROM DUAL
UNION ALL
SELECT 228 u, 156 val FROM DUAL
UNION ALL
SELECT 229 u, 169 val FROM DUAL
UNION ALL
SELECT 230 u, 160 val FROM DUAL
UNION ALL
SELECT 231 u, 81 val FROM DUAL
UNION ALL
SELECT 232 u, 11 val FROM DUAL
UNION ALL
SELECT 233 u, 245 val FROM DUAL
UNION ALL
SELECT 234 u, 22 val FROM DUAL
UNION ALL
SELECT 235 u, 235 val FROM DUAL
UNION ALL
SELECT 236 u, 122 val FROM DUAL
UNION ALL
SELECT 237 u, 117 val FROM DUAL
UNION ALL
SELECT 238 u, 44 val FROM DUAL
UNION ALL
SELECT 239 u, 215 val FROM DUAL
UNION ALL
SELECT 240 u, 79 val FROM DUAL
UNION ALL
SELECT 241 u, 174 val FROM DUAL
UNION ALL
SELECT 242 u, 213 val FROM DUAL
UNION ALL
SELECT 243 u, 233 val FROM DUAL
UNION ALL
SELECT 244 u, 230 val FROM DUAL
UNION ALL
SELECT 245 u, 231 val FROM DUAL
UNION ALL
SELECT 246 u, 173 val FROM DUAL
UNION ALL
SELECT 247 u, 232 val FROM DUAL
UNION ALL
SELECT 248 u, 116 val FROM DUAL
UNION ALL
SELECT 249 u, 214 val FROM DUAL
UNION ALL
SELECT 250 u, 244 val FROM DUAL
UNION ALL
SELECT 251 u, 234 val FROM DUAL
UNION ALL
SELECT 252 u, 168 val FROM DUAL
UNION ALL
SELECT 253 u, 80 val FROM DUAL
UNION ALL
SELECT 254 u, 88 val FROM DUAL
UNION ALL
SELECT 255 u, 175 val FROM DUAL)
WHERE u = n1)
LOOP
nn := s.val;
END LOOP;
RETURN nn;
END;
FUNCTION qr_bin (p_text IN VARCHAR2)
RETURN BLOB
AS
p_b CLOB := NULL;
p_b_tmp VARCHAR2 (23660);
p_l NUMBER := 0;
p_u NUMBER := 0;
p_v NUMBER := 0;
tmp NUMBER := 0;
fff VARCHAR2 (8);
d NUMBER;
dgi NUMBER;
bmp_tmp BLOB;
strhex VARCHAR2 (200)
:= '424DE62F0000000000003E0000002800000031010000310100000100010000000000A82F00000000000000000000000000000000000000000000FFFFFF00';
ostatok_mod NUMBER := 0;
count_byte NUMBER := 0;
count_byte1 NUMBER := 0;
korr_byte NUMBER := 0;
p_type VARCHAR2 (1) := '';
korr_mnogochlen VARCHAR2 (300) := '';
korr_mnogochlen_bin VARCHAR2 (250) := '';
korr_mnogochlen_bin_tmp VARCHAR2 (32000) := '';
korr_mnogochlen_tutto VARCHAR2 (20000) := '';
tutto VARCHAR2 (32000) := '';
p_tmp VARCHAR2 (8) := '11101100';
sss NUMBER := 0;
korr_mn VARCHAR2 (32000) := '';
draw VARCHAR2 (200);
aaa VARCHAR2 (32000) := '';
aaa_tmp VARCHAR2 (32000) := '';
poisk_coor VARCHAR2 (300) := '';
count_poisk NUMBER := 0;
quadro NUMBER := 21;
mincoor NUMBER := 0;
maxcoor NUMBER := 0;
m NUMBER := 0;
n NUMBER := 0;
kod_maski NUMBER := 0;
kod_versii VARCHAR2 (25) := '';
colonka NUMBER;
stroka NUMBER;
tmp1 NUMBER;
s_s VARCHAR2 (2) := '';
flag NUMBER;
flag_lr NUMBER;
TYPE t1 IS TABLE OF NUMBER
INDEX BY BINARY_INTEGER;
TYPE t2 IS TABLE OF t1
INDEX BY BINARY_INTEGER;
z t2;
cor10 t1;
cor_tmp t1;
BEGIN
SELECT LENGTH (p_text) INTO p_l FROM DUAL;
IF p_l = 0 OR p_l > 2330
THEN
DBMS_LOB.createtemporary (bmp_tmp, TRUE);
aaa := '';
aaa_tmp :=
'424D6601000000000000760000002800000014000000140000000100040000000000F0000000000000000000000000000000000000000000000000008000008000000080800080000000800080008080000080808000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFF0000FFFFFFFFBBBBFFFFFFFF0000FFFFFFBBBBBBBBFFFFFF0000FFFFBBBBBBBBBBBBFFFF0000FFFFBBBBB000BBBBFFFF0000FFFBBBBBBBB000BBBFFF0000FFBBBBBBBBBBB00BBFFF0000FFBBBBBBBBBBBBBBBBFF0000FFBBBBBBBBBBBBBBBBFF0000FFBBBBBBBBBBBBBBBBFF0000FFBBB000BBBB000BBBFF0000FFBB0B000BB0B000BFFF0000FFF0B0000BB0000B0FFF0000FFFFBBBBBBBBBBBBFFFF0000FFFFBBBBBBBBBBBBFFFF0000FFFFFFBBBBBBBBFFFFFF0000FFFFFFFBBBBBBFFFFFFF0000FFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFF0000';
FOR i IN 0 .. 357
LOOP
aaa :=
aaa
|| CHR (TO_NUMBER (SUBSTR (aaa_tmp, i * 2 + 1, 2), 'XX'));
END LOOP;
DBMS_LOB.append (bmp_tmp, UTL_RAW.cast_to_raw (TRIM (aaa)));
RETURN bmp_tmp;
DBMS_LOB.freetemporary (bmp_tmp);
END IF;
SELECT LENGTH (hex2bin (RAWTOHEX (CONVERT (p_text, 'utf8'))))
INTO p_l
FROM DUAL;
FOR s
IN (SELECT u, val, typ
FROM ( SELECT u, val, typ
FROM /*qr*/
(SELECT 1 u, 152 val, 'l' typ FROM DUAL
UNION ALL
SELECT 2 u, 272 val, 'l' typ FROM DUAL
UNION ALL
SELECT 3 u, 440 val, 'l' typ FROM DUAL
UNION ALL
SELECT 4 u, 640 val, 'l' typ FROM DUAL
UNION ALL
SELECT 5 u, 864 val, 'l' typ FROM DUAL
UNION ALL
SELECT 6 u, 1088 val, 'l' typ FROM DUAL
UNION ALL
SELECT 7 u, 1248 val, 'l' typ FROM DUAL
UNION ALL
SELECT 8 u, 1552 val, 'l' typ FROM DUAL
UNION ALL
SELECT 9 u, 1856 val, 'l' typ FROM DUAL
UNION ALL
SELECT 10 u, 2192 val, 'l' typ FROM DUAL
UNION ALL
SELECT 11 u, 2592 val, 'l' typ FROM DUAL
UNION ALL
SELECT 12 u, 2960 val, 'l' typ FROM DUAL
UNION ALL
SELECT 13 u, 3424 val, 'l' typ FROM DUAL
UNION ALL
SELECT 14 u, 3688 val, 'l' typ FROM DUAL
UNION ALL
SELECT 15 u, 4184 val, 'l' typ FROM DUAL
UNION ALL
SELECT 16 u, 4712 val, 'l' typ FROM DUAL
UNION ALL
SELECT 17 u, 5176 val, 'l' typ FROM DUAL
UNION ALL
SELECT 18 u, 5768 val, 'l' typ FROM DUAL
UNION ALL
SELECT 19 u, 6360 val, 'l' typ FROM DUAL
UNION ALL
SELECT 20 u, 6888 val, 'l' typ FROM DUAL
UNION ALL
SELECT 21 u, 7456 val, 'l' typ FROM DUAL
UNION ALL
SELECT 22 u, 8048 val, 'l' typ FROM DUAL
UNION ALL
SELECT 23 u, 8752 val, 'l' typ FROM DUAL
UNION ALL
SELECT 24 u, 9392 val, 'l' typ FROM DUAL
UNION ALL
SELECT 25 u, 10208 val, 'l' typ FROM DUAL
UNION ALL
SELECT 26 u, 10960 val, 'l' typ FROM DUAL
UNION ALL
SELECT 27 u, 11744 val, 'l' typ FROM DUAL
UNION ALL
SELECT 28 u, 12248 val, 'l' typ FROM DUAL
UNION ALL
SELECT 29 u, 13048 val, 'l' typ FROM DUAL
UNION ALL
SELECT 30 u, 13880 val, 'l' typ FROM DUAL
UNION ALL
SELECT 31 u, 14744 val, 'l' typ FROM DUAL
UNION ALL
SELECT 32 u, 15640 val, 'l' typ FROM DUAL
UNION ALL
SELECT 33 u, 16568 val, 'l' typ FROM DUAL
UNION ALL
SELECT 34 u, 17528 val, 'l' typ FROM DUAL
UNION ALL
SELECT 35 u, 18448 val, 'l' typ FROM DUAL
UNION ALL
SELECT 36 u, 19472 val, 'l' typ FROM DUAL
UNION ALL
SELECT 37 u, 20528 val, 'l' typ FROM DUAL
UNION ALL
SELECT 38 u, 21616 val, 'l' typ FROM DUAL
UNION ALL
SELECT 39 u, 22496 val, 'l' typ FROM DUAL
UNION ALL
SELECT 40 u, 23648 val, 'l' typ FROM DUAL
UNION ALL
SELECT 1 u, 128 val, 'm' typ FROM DUAL
UNION ALL
SELECT 2 u, 224 val, 'm' typ FROM DUAL
UNION ALL
SELECT 3 u, 352 val, 'm' typ FROM DUAL
UNION ALL
SELECT 4 u, 512 val, 'm' typ FROM DUAL
UNION ALL
SELECT 5 u, 688 val, 'm' typ FROM DUAL
UNION ALL
SELECT 6 u, 864 val, 'm' typ FROM DUAL
UNION ALL
SELECT 7 u, 992 val, 'm' typ FROM DUAL
UNION ALL
SELECT 8 u, 1232 val, 'm' typ FROM DUAL
UNION ALL
SELECT 9 u, 1456 val, 'm' typ FROM DUAL
UNION ALL
SELECT 10 u, 1728 val, 'm' typ FROM DUAL
UNION ALL
SELECT 11 u, 2032 val, 'm' typ FROM DUAL
UNION ALL
SELECT 12 u, 2320 val, 'm' typ FROM DUAL
UNION ALL
SELECT 13 u, 2672 val, 'm' typ FROM DUAL
UNION ALL
SELECT 14 u, 2920 val, 'm' typ FROM DUAL
UNION ALL
SELECT 15 u, 3320 val, 'm' typ FROM DUAL
UNION ALL
SELECT 16 u, 3624 val, 'm' typ FROM DUAL
UNION ALL
SELECT 17 u, 4056 val, 'm' typ FROM DUAL
UNION ALL
SELECT 18 u, 4504 val, 'm' typ FROM DUAL
UNION ALL
SELECT 19 u, 5016 val, 'm' typ FROM DUAL
UNION ALL
SELECT 20 u, 5352 val, 'm' typ FROM DUAL
UNION ALL
SELECT 21 u, 5712 val, 'm' typ FROM DUAL
UNION ALL
SELECT 22 u, 6256 val, 'm' typ FROM DUAL
UNION ALL
SELECT 23 u, 6880 val, 'm' typ FROM DUAL
UNION ALL
SELECT 24 u, 7312 val, 'm' typ FROM DUAL
UNION ALL
SELECT 25 u, 8000 val, 'm' typ FROM DUAL
UNION ALL
SELECT 26 u, 8496 val, 'm' typ FROM DUAL
UNION ALL
SELECT 27 u, 9024 val, 'm' typ FROM DUAL
UNION ALL
SELECT 28 u, 9544 val, 'm' typ FROM DUAL
UNION ALL
SELECT 29 u, 10136 val, 'm' typ FROM DUAL
UNION ALL
SELECT 30 u, 10984 val, 'm' typ FROM DUAL
UNION ALL
SELECT 31 u, 11640 val, 'm' typ FROM DUAL
UNION ALL
SELECT 32 u, 12328 val, 'm' typ FROM DUAL
UNION ALL
SELECT 33 u, 13048 val, 'm' typ FROM DUAL
UNION ALL
SELECT 34 u, 13800 val, 'm' typ FROM DUAL
UNION ALL
SELECT 35 u, 14496 val, 'm' typ FROM DUAL
UNION ALL
SELECT 36 u, 15312 val, 'm' typ FROM DUAL
UNION ALL
SELECT 37 u, 15936 val, 'm' typ FROM DUAL
UNION ALL
SELECT 38 u, 16816 val, 'm' typ FROM DUAL
UNION ALL
SELECT 39 u, 17728 val, 'm' typ FROM DUAL
UNION ALL
SELECT 40 u, 18672 val, 'm' typ FROM DUAL
UNION ALL
SELECT 1 u, 104 val, 'q' typ FROM DUAL
UNION ALL
SELECT 2 u, 176 val, 'q' typ FROM DUAL
UNION ALL
SELECT 3 u, 272 val, 'q' typ FROM DUAL
UNION ALL
SELECT 4 u, 384 val, 'q' typ FROM DUAL
UNION ALL
SELECT 5 u, 496 val, 'q' typ FROM DUAL
UNION ALL
SELECT 6 u, 608 val, 'q' typ FROM DUAL
UNION ALL
SELECT 7 u, 704 val, 'q' typ FROM DUAL
UNION ALL
SELECT 8 u, 880 val, 'q' typ FROM DUAL
UNION ALL
SELECT 9 u, 1056 val, 'q' typ FROM DUAL
UNION ALL
SELECT 10 u, 1232 val, 'q' typ FROM DUAL
UNION ALL
SELECT 11 u, 1440 val, 'q' typ FROM DUAL
UNION ALL
SELECT 12 u, 1648 val, 'q' typ FROM DUAL
UNION ALL
SELECT 13 u, 1952 val, 'q' typ FROM DUAL
UNION ALL
SELECT 14 u, 2088 val, 'q' typ FROM DUAL
UNION ALL
SELECT 15 u, 2360 val, 'q' typ FROM DUAL
UNION ALL
SELECT 16 u, 2600 val, 'q' typ FROM DUAL
UNION ALL
SELECT 17 u, 2936 val, 'q' typ FROM DUAL
UNION ALL
SELECT 18 u, 3176 val, 'q' typ FROM DUAL
UNION ALL
SELECT 19 u, 3560 val, 'q' typ FROM DUAL
UNION ALL
SELECT 20 u, 3880 val, 'q' typ FROM DUAL
UNION ALL
SELECT 21 u, 4096 val, 'q' typ FROM DUAL
UNION ALL
SELECT 22 u, 4544 val, 'q' typ FROM DUAL
UNION ALL
SELECT 23 u, 4912 val, 'q' typ FROM DUAL
UNION ALL
SELECT 24 u, 5312 val, 'q' typ FROM DUAL
UNION ALL
SELECT 25 u, 5744 val, 'q' typ FROM DUAL
UNION ALL
SELECT 26 u, 6032 val, 'q' typ FROM DUAL
UNION ALL
SELECT 27 u, 6464 val, 'q' typ FROM DUAL
UNION ALL
SELECT 28 u, 6968 val, 'q' typ FROM DUAL
UNION ALL
SELECT 29 u, 7288 val, 'q' typ FROM DUAL
UNION ALL
SELECT 30 u, 7880 val, 'q' typ FROM DUAL
UNION ALL
SELECT 31 u, 8264 val, 'q' typ FROM DUAL
UNION ALL
SELECT 32 u, 8920 val, 'q' typ FROM DUAL
UNION ALL
SELECT 33 u, 9368 val, 'q' typ FROM DUAL
UNION ALL
SELECT 34 u, 9848 val, 'q' typ FROM DUAL
UNION ALL
SELECT 35 u, 10288 val, 'q' typ FROM DUAL
UNION ALL
SELECT 36 u, 10832 val, 'q' typ FROM DUAL
UNION ALL
SELECT 37 u, 11408 val, 'q' typ FROM DUAL
UNION ALL
SELECT 38 u, 12016 val, 'q' typ FROM DUAL
UNION ALL
SELECT 39 u, 12656 val, 'q' typ FROM DUAL
UNION ALL
SELECT 40 u, 13328 val, 'q' typ FROM DUAL
UNION ALL
SELECT 1 u, 72 val, 'h' typ FROM DUAL
UNION ALL
SELECT 2 u, 128 val, 'h' typ FROM DUAL
UNION ALL
SELECT 3 u, 208 val, 'h' typ FROM DUAL
UNION ALL
SELECT 4 u, 288 val, 'h' typ FROM DUAL
UNION ALL
SELECT 5 u, 368 val, 'h' typ FROM DUAL
UNION ALL
SELECT 6 u, 480 val, 'h' typ FROM DUAL
UNION ALL
SELECT 7 u, 528 val, 'h' typ FROM DUAL
UNION ALL
SELECT 8 u, 688 val, 'h' typ FROM DUAL
UNION ALL
SELECT 9 u, 800 val, 'h' typ FROM DUAL
UNION ALL
SELECT 10 u, 976 val, 'h' typ FROM DUAL
UNION ALL
SELECT 11 u, 1120 val, 'h' typ FROM DUAL
UNION ALL
SELECT 12 u, 1264 val, 'h' typ FROM DUAL
UNION ALL
SELECT 13 u, 1440 val, 'h' typ FROM DUAL
UNION ALL
SELECT 14 u, 1576 val, 'h' typ FROM DUAL
UNION ALL
SELECT 15 u, 1784 val, 'h' typ FROM DUAL
UNION ALL
SELECT 16 u, 2024 val, 'h' typ FROM DUAL
UNION ALL
SELECT 17 u, 2264 val, 'h' typ FROM DUAL
UNION ALL
SELECT 18 u, 2504 val, 'h' typ FROM DUAL
UNION ALL
SELECT 19 u, 2728 val, 'h' typ FROM DUAL
UNION ALL
SELECT 20 u, 3080 val, 'h' typ FROM DUAL
UNION ALL
SELECT 21 u, 3248 val, 'h' typ FROM DUAL
UNION ALL
SELECT 22 u, 3536 val, 'h' typ FROM DUAL
UNION ALL
SELECT 23 u, 3712 val, 'h' typ FROM DUAL
UNION ALL
SELECT 24 u, 4112 val, 'h' typ FROM DUAL
UNION ALL
SELECT 25 u, 4304 val, 'h' typ FROM DUAL
UNION ALL
SELECT 26 u, 4768 val, 'h' typ FROM DUAL
UNION ALL
SELECT 27 u, 5024 val, 'h' typ FROM DUAL
UNION ALL
SELECT 28 u, 5288 val, 'h' typ FROM DUAL
UNION ALL
SELECT 29 u, 5608 val, 'h' typ FROM DUAL
UNION ALL
SELECT 30 u, 5960 val, 'h' typ FROM DUAL
UNION ALL
SELECT 31 u, 6344 val, 'h' typ FROM DUAL
UNION ALL
SELECT 32 u, 6760 val, 'h' typ FROM DUAL
UNION ALL
SELECT 33 u, 7208 val, 'h' typ FROM DUAL
UNION ALL
SELECT 34 u, 7688 val, 'h' typ FROM DUAL
UNION ALL
SELECT 35 u, 7888 val, 'h' typ FROM DUAL
UNION ALL
SELECT 36 u, 8432 val, 'h' typ FROM DUAL
UNION ALL
SELECT 37 u, 8768 val, 'h' typ FROM DUAL
UNION ALL
SELECT 38 u, 9136 val, 'h' typ FROM DUAL
UNION ALL
SELECT 39 u, 9776 val, 'h' typ FROM DUAL
UNION ALL
SELECT 40 u, 10208 val, 'h' typ FROM DUAL)
WHERE val >
NVL (
p_l
+ 4
+ DECODE (u,
1, 8,
2, 8,
3, 8,
4, 8,
5, 8,
6, 8,
7, 8,
8, 8,
9, 8,
16),
0) /*and typ='l' */
/*and typ='h' здеÑÑŒ можно указать конкретно, какой уровень коррекции иÑпользовать или вынеÑти в параметр*/
ORDER BY val, typ DESC)
WHERE ROWNUM = 1)
LOOP
p_type := s.typ;
p_u := s.u;
SELECT '0100'
|| LPAD (
XXXXmake_qr.hex2bin (
TRIM (
TO_CHAR (
LENGTH (
XXXXmake_qr.hex2bin (
RAWTOHEX (
CONVERT (p_text, 'utf8'))))
/ 8,
'XXXX'))) --make_qr.hex2bin(to_char(length(make_qr.hex2bin(rawtohex(convert(p_text,'utf8')) ))/8))
,
DECODE (s.u,
1, 8,
2, 8,
3, 8,
4, 8,
5, 8,
6, 8,
7, 8,
8, 8,
9, 8,
16),
'0')
|| XXXXmake_qr.hex2bin (RAWTOHEX (CONVERT (p_text, 'utf8')))
INTO p_b
FROM DUAL;
IF (MOD (LENGTH (p_b), 8) <> 0)
THEN
p_b := p_b || RPAD ('0', 8 - MOD (LENGTH (p_b), 8), '0');
END IF;
p_v := (s.val - LENGTH (p_b)) / 8;
FOR i IN 0 .. p_v - 1
LOOP
p_b := p_b || p_tmp;
IF p_tmp = '11101100'
THEN
p_tmp := '00010001';
ELSE
p_tmp := '11101100';
END IF;
END LOOP;
--кол-во блоков, на которое бить
FOR ss IN (SELECT u, val, typ
FROM /*qr*/
(SELECT 1 u, 1 val, 'l' typ FROM DUAL
UNION ALL
SELECT 2 u, 1 val, 'l' typ FROM DUAL
UNION ALL
SELECT 3 u, 1 val, 'l' typ FROM DUAL
UNION ALL
SELECT 4 u, 1 val, 'l' typ FROM DUAL
UNION ALL
SELECT 5 u, 1 val, 'l' typ FROM DUAL
UNION ALL
SELECT 6 u, 2 val, 'l' typ FROM DUAL
UNION ALL
SELECT 7 u, 2 val, 'l' typ FROM DUAL
UNION ALL
SELECT 8 u, 2 val, 'l' typ FROM DUAL
UNION ALL
SELECT 9 u, 2 val, 'l' typ FROM DUAL
UNION ALL
SELECT 10 u, 4 val, 'l' typ FROM DUAL
UNION ALL
SELECT 11 u, 4 val, 'l' typ FROM DUAL
UNION ALL
SELECT 12 u, 4 val, 'l' typ FROM DUAL
UNION ALL
SELECT 13 u, 4 val, 'l' typ FROM DUAL
UNION ALL
SELECT 14 u, 4 val, 'l' typ FROM DUAL
UNION ALL
SELECT 15 u, 6 val, 'l' typ FROM DUAL
UNION ALL
SELECT 16 u, 6 val, 'l' typ FROM DUAL
UNION ALL
SELECT 17 u, 6 val, 'l' typ FROM DUAL
UNION ALL
SELECT 18 u, 6 val, 'l' typ FROM DUAL
UNION ALL
SELECT 19 u, 7 val, 'l' typ FROM DUAL
UNION ALL
SELECT 20 u, 8 val, 'l' typ FROM DUAL
UNION ALL
SELECT 21 u, 8 val, 'l' typ FROM DUAL
UNION ALL
SELECT 22 u, 9 val, 'l' typ FROM DUAL
UNION ALL
SELECT 23 u, 9 val, 'l' typ FROM DUAL
UNION ALL
SELECT 24 u, 10 val, 'l' typ FROM DUAL
UNION ALL
SELECT 25 u, 12 val, 'l' typ FROM DUAL
UNION ALL
SELECT 26 u, 12 val, 'l' typ FROM DUAL
UNION ALL
SELECT 27 u, 12 val, 'l' typ FROM DUAL
UNION ALL
SELECT 28 u, 13 val, 'l' typ FROM DUAL
UNION ALL
SELECT 29 u, 14 val, 'l' typ FROM DUAL
UNION ALL
SELECT 30 u, 15 val, 'l' typ FROM DUAL
UNION ALL
SELECT 31 u, 16 val, 'l' typ FROM DUAL
UNION ALL
SELECT 32 u, 17 val, 'l' typ FROM DUAL
UNION ALL
SELECT 33 u, 18 val, 'l' typ FROM DUAL
UNION ALL
SELECT 34 u, 19 val, 'l' typ FROM DUAL
UNION ALL
SELECT 35 u, 19 val, 'l' typ FROM DUAL
UNION ALL
SELECT 36 u, 20 val, 'l' typ FROM DUAL
UNION ALL
SELECT 37 u, 21 val, 'l' typ FROM DUAL
UNION ALL
SELECT 38 u, 22 val, 'l' typ FROM DUAL
UNION ALL
SELECT 39 u, 24 val, 'l' typ FROM DUAL
UNION ALL
SELECT 40 u, 25 val, 'l' typ FROM DUAL
UNION ALL
SELECT 1 u, 1 val, 'm' typ FROM DUAL
UNION ALL
SELECT 2 u, 1 val, 'm' typ FROM DUAL
UNION ALL
SELECT 3 u, 1 val, 'm' typ FROM DUAL
UNION ALL
SELECT 4 u, 2 val, 'm' typ FROM DUAL
UNION ALL
SELECT 5 u, 2 val, 'm' typ FROM DUAL
UNION ALL
SELECT 6 u, 4 val, 'm' typ FROM DUAL
UNION ALL
SELECT 7 u, 4 val, 'm' typ FROM DUAL
UNION ALL
SELECT 8 u, 4 val, 'm' typ FROM DUAL
UNION ALL
SELECT 9 u, 5 val, 'm' typ FROM DUAL
UNION ALL
SELECT 10 u, 5 val, 'm' typ FROM DUAL
UNION ALL
SELECT 11 u, 5 val, 'm' typ FROM DUAL
UNION ALL
SELECT 12 u, 8 val, 'm' typ FROM DUAL
UNION ALL
SELECT 13 u, 9 val, 'm' typ FROM DUAL
UNION ALL
SELECT 14 u, 9 val, 'm' typ FROM DUAL
UNION ALL
SELECT 15 u, 10 val, 'm' typ FROM DUAL
UNION ALL
SELECT 16 u, 10 val, 'm' typ FROM DUAL
UNION ALL
SELECT 17 u, 11 val, 'm' typ FROM DUAL
UNION ALL
SELECT 18 u, 13 val, 'm' typ FROM DUAL
UNION ALL
SELECT 19 u, 14 val, 'm' typ FROM DUAL
UNION ALL
SELECT 20 u, 16 val, 'm' typ FROM DUAL
UNION ALL
SELECT 21 u, 17 val, 'm' typ FROM DUAL
UNION ALL
SELECT 22 u, 17 val, 'm' typ FROM DUAL
UNION ALL
SELECT 23 u, 18 val, 'm' typ FROM DUAL
UNION ALL
SELECT 24 u, 20 val, 'm' typ FROM DUAL
UNION ALL
SELECT 25 u, 21 val, 'm' typ FROM DUAL
UNION ALL
SELECT 26 u, 23 val, 'm' typ FROM DUAL
UNION ALL
SELECT 27 u, 25 val, 'm' typ FROM DUAL
UNION ALL
SELECT 28 u, 26 val, 'm' typ FROM DUAL
UNION ALL
SELECT 29 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 30 u, 29 val, 'm' typ FROM DUAL
UNION ALL
SELECT 31 u, 31 val, 'm' typ FROM DUAL
UNION ALL
SELECT 32 u, 33 val, 'm' typ FROM DUAL
UNION ALL
SELECT 33 u, 35 val, 'm' typ FROM DUAL
UNION ALL
SELECT 34 u, 37 val, 'm' typ FROM DUAL
UNION ALL
SELECT 35 u, 38 val, 'm' typ FROM DUAL
UNION ALL
SELECT 36 u, 40 val, 'm' typ FROM DUAL
UNION ALL
SELECT 37 u, 43 val, 'm' typ FROM DUAL
UNION ALL
SELECT 38 u, 45 val, 'm' typ FROM DUAL
UNION ALL
SELECT 39 u, 47 val, 'm' typ FROM DUAL
UNION ALL
SELECT 40 u, 49 val, 'm' typ FROM DUAL
UNION ALL
SELECT 1 u, 1 val, 'q' typ FROM DUAL
UNION ALL
SELECT 2 u, 1 val, 'q' typ FROM DUAL
UNION ALL
SELECT 3 u, 2 val, 'q' typ FROM DUAL
UNION ALL
SELECT 4 u, 2 val, 'q' typ FROM DUAL
UNION ALL
SELECT 5 u, 4 val, 'q' typ FROM DUAL
UNION ALL
SELECT 6 u, 4 val, 'q' typ FROM DUAL
UNION ALL
SELECT 7 u, 6 val, 'q' typ FROM DUAL
UNION ALL
SELECT 8 u, 6 val, 'q' typ FROM DUAL
UNION ALL
SELECT 9 u, 8 val, 'q' typ FROM DUAL
UNION ALL
SELECT 10 u, 8 val, 'q' typ FROM DUAL
UNION ALL
SELECT 11 u, 8 val, 'q' typ FROM DUAL
UNION ALL
SELECT 12 u, 10 val, 'q' typ FROM DUAL
UNION ALL
SELECT 13 u, 12 val, 'q' typ FROM DUAL
UNION ALL
SELECT 14 u, 16 val, 'q' typ FROM DUAL
UNION ALL
SELECT 15 u, 12 val, 'q' typ FROM DUAL
UNION ALL
SELECT 16 u, 17 val, 'q' typ FROM DUAL
UNION ALL
SELECT 17 u, 16 val, 'q' typ FROM DUAL
UNION ALL
SELECT 18 u, 18 val, 'q' typ FROM DUAL
UNION ALL
SELECT 19 u, 21 val, 'q' typ FROM DUAL
UNION ALL
SELECT 20 u, 20 val, 'q' typ FROM DUAL
UNION ALL
SELECT 21 u, 23 val, 'q' typ FROM DUAL
UNION ALL
SELECT 22 u, 23 val, 'q' typ FROM DUAL
UNION ALL
SELECT 23 u, 25 val, 'q' typ FROM DUAL
UNION ALL
SELECT 24 u, 27 val, 'q' typ FROM DUAL
UNION ALL
SELECT 25 u, 29 val, 'q' typ FROM DUAL
UNION ALL
SELECT 26 u, 34 val, 'q' typ FROM DUAL
UNION ALL
SELECT 27 u, 34 val, 'q' typ FROM DUAL
UNION ALL
SELECT 28 u, 35 val, 'q' typ FROM DUAL
UNION ALL
SELECT 29 u, 38 val, 'q' typ FROM DUAL
UNION ALL
SELECT 30 u, 40 val, 'q' typ FROM DUAL
UNION ALL
SELECT 31 u, 43 val, 'q' typ FROM DUAL
UNION ALL
SELECT 32 u, 45 val, 'q' typ FROM DUAL
UNION ALL
SELECT 33 u, 48 val, 'q' typ FROM DUAL
UNION ALL
SELECT 34 u, 51 val, 'q' typ FROM DUAL
UNION ALL
SELECT 35 u, 53 val, 'q' typ FROM DUAL
UNION ALL
SELECT 36 u, 56 val, 'q' typ FROM DUAL
UNION ALL
SELECT 37 u, 59 val, 'q' typ FROM DUAL
UNION ALL
SELECT 38 u, 62 val, 'q' typ FROM DUAL
UNION ALL
SELECT 39 u, 65 val, 'q' typ FROM DUAL
UNION ALL
SELECT 40 u, 68 val, 'q' typ FROM DUAL
UNION ALL
SELECT 1 u, 1 val, 'h' typ FROM DUAL
UNION ALL
SELECT 2 u, 1 val, 'h' typ FROM DUAL
UNION ALL
SELECT 3 u, 2 val, 'h' typ FROM DUAL
UNION ALL
SELECT 4 u, 4 val, 'h' typ FROM DUAL
UNION ALL
SELECT 5 u, 4 val, 'h' typ FROM DUAL
UNION ALL
SELECT 6 u, 4 val, 'h' typ FROM DUAL
UNION ALL
SELECT 7 u, 5 val, 'h' typ FROM DUAL
UNION ALL
SELECT 8 u, 6 val, 'h' typ FROM DUAL
UNION ALL
SELECT 9 u, 8 val, 'h' typ FROM DUAL
UNION ALL
SELECT 10 u, 8 val, 'h' typ FROM DUAL
UNION ALL
SELECT 11 u, 11 val, 'h' typ FROM DUAL
UNION ALL
SELECT 12 u, 11 val, 'h' typ FROM DUAL
UNION ALL
SELECT 13 u, 16 val, 'h' typ FROM DUAL
UNION ALL
SELECT 14 u, 16 val, 'h' typ FROM DUAL
UNION ALL
SELECT 15 u, 18 val, 'h' typ FROM DUAL
UNION ALL
SELECT 16 u, 16 val, 'h' typ FROM DUAL
UNION ALL
SELECT 17 u, 19 val, 'h' typ FROM DUAL
UNION ALL
SELECT 18 u, 21 val, 'h' typ FROM DUAL
UNION ALL
SELECT 19 u, 25 val, 'h' typ FROM DUAL
UNION ALL
SELECT 20 u, 25 val, 'h' typ FROM DUAL
UNION ALL
SELECT 21 u, 25 val, 'h' typ FROM DUAL
UNION ALL
SELECT 22 u, 34 val, 'h' typ FROM DUAL
UNION ALL
SELECT 23 u, 30 val, 'h' typ FROM DUAL
UNION ALL
SELECT 24 u, 32 val, 'h' typ FROM DUAL
UNION ALL
SELECT 25 u, 35 val, 'h' typ FROM DUAL
UNION ALL
SELECT 26 u, 37 val, 'h' typ FROM DUAL
UNION ALL
SELECT 27 u, 40 val, 'h' typ FROM DUAL
UNION ALL
SELECT 28 u, 42 val, 'h' typ FROM DUAL
UNION ALL
SELECT 29 u, 45 val, 'h' typ FROM DUAL
UNION ALL
SELECT 30 u, 48 val, 'h' typ FROM DUAL
UNION ALL
SELECT 31 u, 51 val, 'h' typ FROM DUAL
UNION ALL
SELECT 32 u, 54 val, 'h' typ FROM DUAL
UNION ALL
SELECT 33 u, 57 val, 'h' typ FROM DUAL
UNION ALL
SELECT 34 u, 60 val, 'h' typ FROM DUAL
UNION ALL
SELECT 35 u, 63 val, 'h' typ FROM DUAL
UNION ALL
SELECT 36 u, 66 val, 'h' typ FROM DUAL
UNION ALL
SELECT 37 u, 70 val, 'h' typ FROM DUAL
UNION ALL
SELECT 38 u, 74 val, 'h' typ FROM DUAL
UNION ALL
SELECT 39 u, 77 val, 'h' typ FROM DUAL
UNION ALL
SELECT 40 u, 81 val, 'h' typ FROM DUAL)
WHERE u = s.u AND typ = s.typ)
LOOP
p_v := ss.val; --p_v=кол-во блоков
END LOOP;
count_byte := (s.val / 8) / p_v;
ostatok_mod := p_v - MOD (s.val / 8, p_v);
IF p_v > 1
THEN
count_byte := /*round*/
TRUNC ((s.val / 8) / p_v);
ostatok_mod := p_v - MOD ((s.val / 8), p_v); -- +1 (блоки нумеруем Ñ 0);--Ñ ÐºÐ°ÐºÐ¾Ð³Ð¾ номера блока увеличивать на 1 байт
END IF;
--кол-во байтов коррекции на один блок
FOR ss IN (SELECT val
FROM /*qr*/
(SELECT 1 u, 7 val, 'l' typ FROM DUAL
UNION ALL
SELECT 2 u, 10 val, 'l' typ FROM DUAL
UNION ALL
SELECT 3 u, 15 val, 'l' typ FROM DUAL
UNION ALL
SELECT 4 u, 20 val, 'l' typ FROM DUAL
UNION ALL
SELECT 5 u, 26 val, 'l' typ FROM DUAL
UNION ALL
SELECT 6 u, 18 val, 'l' typ FROM DUAL
UNION ALL
SELECT 7 u, 20 val, 'l' typ FROM DUAL
UNION ALL
SELECT 8 u, 24 val, 'l' typ FROM DUAL
UNION ALL
SELECT 9 u, 30 val, 'l' typ FROM DUAL
UNION ALL
SELECT 10 u, 18 val, 'l' typ FROM DUAL
UNION ALL
SELECT 11 u, 20 val, 'l' typ FROM DUAL
UNION ALL
SELECT 12 u, 24 val, 'l' typ FROM DUAL
UNION ALL
SELECT 13 u, 26 val, 'l' typ FROM DUAL
UNION ALL
SELECT 14 u, 30 val, 'l' typ FROM DUAL
UNION ALL
SELECT 15 u, 22 val, 'l' typ FROM DUAL
UNION ALL
SELECT 16 u, 24 val, 'l' typ FROM DUAL
UNION ALL
SELECT 17 u, 28 val, 'l' typ FROM DUAL
UNION ALL
SELECT 18 u, 30 val, 'l' typ FROM DUAL
UNION ALL
SELECT 19 u, 28 val, 'l' typ FROM DUAL
UNION ALL
SELECT 20 u, 28 val, 'l' typ FROM DUAL
UNION ALL
SELECT 21 u, 28 val, 'l' typ FROM DUAL
UNION ALL
SELECT 22 u, 28 val, 'l' typ FROM DUAL
UNION ALL
SELECT 23 u, 30 val, 'l' typ FROM DUAL
UNION ALL
SELECT 24 u, 30 val, 'l' typ FROM DUAL
UNION ALL
SELECT 25 u, 26 val, 'l' typ FROM DUAL
UNION ALL
SELECT 26 u, 28 val, 'l' typ FROM DUAL
UNION ALL
SELECT 27 u, 30 val, 'l' typ FROM DUAL
UNION ALL
SELECT 28 u, 30 val, 'l' typ FROM DUAL
UNION ALL
SELECT 29 u, 30 val, 'l' typ FROM DUAL
UNION ALL
SELECT 30 u, 30 val, 'l' typ FROM DUAL
UNION ALL
SELECT 31 u, 30 val, 'l' typ FROM DUAL
UNION ALL
SELECT 32 u, 30 val, 'l' typ FROM DUAL
UNION ALL
SELECT 33 u, 30 val, 'l' typ FROM DUAL
UNION ALL
SELECT 34 u, 30 val, 'l' typ FROM DUAL
UNION ALL
SELECT 35 u, 30 val, 'l' typ FROM DUAL
UNION ALL
SELECT 36 u, 30 val, 'l' typ FROM DUAL
UNION ALL
SELECT 37 u, 30 val, 'l' typ FROM DUAL
UNION ALL
SELECT 38 u, 30 val, 'l' typ FROM DUAL
UNION ALL
SELECT 39 u, 30 val, 'l' typ FROM DUAL
UNION ALL
SELECT 40 u, 30 val, 'l' typ FROM DUAL
UNION ALL
SELECT 1 u, 10 val, 'm' typ FROM DUAL
UNION ALL
SELECT 2 u, 16 val, 'm' typ FROM DUAL
UNION ALL
SELECT 3 u, 26 val, 'm' typ FROM DUAL
UNION ALL
SELECT 4 u, 18 val, 'm' typ FROM DUAL
UNION ALL
SELECT 5 u, 24 val, 'm' typ FROM DUAL
UNION ALL
SELECT 6 u, 16 val, 'm' typ FROM DUAL
UNION ALL
SELECT 7 u, 18 val, 'm' typ FROM DUAL
UNION ALL
SELECT 8 u, 22 val, 'm' typ FROM DUAL
UNION ALL
SELECT 9 u, 22 val, 'm' typ FROM DUAL
UNION ALL
SELECT 10 u, 26 val, 'm' typ FROM DUAL
UNION ALL
SELECT 11 u, 30 val, 'm' typ FROM DUAL
UNION ALL
SELECT 12 u, 22 val, 'm' typ FROM DUAL
UNION ALL
SELECT 13 u, 22 val, 'm' typ FROM DUAL
UNION ALL
SELECT 14 u, 24 val, 'm' typ FROM DUAL
UNION ALL
SELECT 15 u, 24 val, 'm' typ FROM DUAL
UNION ALL
SELECT 16 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 17 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 18 u, 26 val, 'm' typ FROM DUAL
UNION ALL
SELECT 19 u, 26 val, 'm' typ FROM DUAL
UNION ALL
SELECT 20 u, 26 val, 'm' typ FROM DUAL
UNION ALL
SELECT 21 u, 26 val, 'm' typ FROM DUAL
UNION ALL
SELECT 22 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 23 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 24 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 25 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 26 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 27 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 28 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 29 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 30 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 31 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 32 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 33 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 34 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 35 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 36 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 37 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 38 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 39 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 40 u, 28 val, 'm' typ FROM DUAL
UNION ALL
SELECT 1 u, 13 val, 'q' typ FROM DUAL
UNION ALL
SELECT 2 u, 22 val, 'q' typ FROM DUAL
UNION ALL
SELECT 3 u, 18 val, 'q' typ FROM DUAL
UNION ALL
SELECT 4 u, 26 val, 'q' typ FROM DUAL
UNION ALL
SELECT 5 u, 18 val, 'q' typ FROM DUAL
UNION ALL
SELECT 6 u, 24 val, 'q' typ FROM DUAL
UNION ALL
SELECT 7 u, 18 val, 'q' typ FROM DUAL
UNION ALL
SELECT 8 u, 22 val, 'q' typ FROM DUAL
UNION ALL
SELECT 9 u, 20 val, 'q' typ FROM DUAL
UNION ALL
SELECT 10 u, 24 val, 'q' typ FROM DUAL
UNION ALL
SELECT 11 u, 28 val, 'q' typ FROM DUAL
UNION ALL
SELECT 12 u, 26 val, 'q' typ FROM DUAL
UNION ALL
SELECT 13 u, 24 val, 'q' typ FROM DUAL
UNION ALL
SELECT 14 u, 20 val, 'q' typ FROM DUAL
UNION ALL
SELECT 15 u, 30 val, 'q' typ FROM DUAL
UNION ALL
SELECT 16 u, 24 val, 'q' typ FROM DUAL
UNION ALL
SELECT 17 u, 28 val, 'q' typ FROM DUAL
UNION ALL
SELECT 18 u, 28 val, 'q' typ FROM DUAL
UNION ALL
SELECT 19 u, 26 val, 'q' typ FROM DUAL
UNION ALL
SELECT 20 u, 30 val, 'q' typ FROM DUAL
UNION ALL
SELECT 21 u, 28 val, 'q' typ FROM DUAL
UNION ALL
SELECT 22 u, 30 val, 'q' typ FROM DUAL
UNION ALL
SELECT 23 u, 30 val, 'q' typ FROM DUAL
UNION ALL
SELECT 24 u, 30 val, 'q' typ FROM DUAL
UNION ALL
SELECT 25 u, 30 val, 'q' typ FROM DUAL
UNION ALL
SELECT 26 u, 28 val, 'q' typ FROM DUAL
UNION ALL
SELECT 27 u, 30 val, 'q' typ FROM DUAL
UNION ALL
SELECT 28 u, 30 val, 'q' typ FROM DUAL
UNION ALL
SELECT 29 u, 30 val, 'q' typ FROM DUAL
UNION ALL
SELECT 30 u, 30 val, 'q' typ FROM DUAL
UNION ALL
SELECT 31 u, 30 val, 'q' typ FROM DUAL
UNION ALL
SELECT 32 u, 30 val, 'q' typ FROM DUAL
UNION ALL
SELECT 33 u, 30 val, 'q' typ FROM DUAL
UNION ALL
SELECT 34 u, 30 val, 'q' typ FROM DUAL
UNION ALL
SELECT 35 u, 30 val, 'q' typ FROM DUAL
UNION ALL
SELECT 36 u, 30 val, 'q' typ FROM DUAL
UNION ALL
SELECT 37 u, 30 val, 'q' typ FROM DUAL
UNION ALL
SELECT 38 u, 30 val, 'q' typ FROM DUAL
UNION ALL
SELECT 39 u, 30 val, 'q' typ FROM DUAL
UNION ALL
SELECT 40 u, 30 val, 'q' typ FROM DUAL
UNION ALL
SELECT 1 u, 17 val, 'h' typ FROM DUAL
UNION ALL
SELECT 2 u, 28 val, 'h' typ FROM DUAL
UNION ALL
SELECT 3 u, 22 val, 'h' typ FROM DUAL
UNION ALL
SELECT 4 u, 16 val, 'h' typ FROM DUAL
UNION ALL
SELECT 5 u, 22 val, 'h' typ FROM DUAL
UNION ALL
SELECT 6 u, 28 val, 'h' typ FROM DUAL
UNION ALL
SELECT 7 u, 26 val, 'h' typ FROM DUAL
UNION ALL
SELECT 8 u, 26 val, 'h' typ FROM DUAL
UNION ALL
SELECT 9 u, 24 val, 'h' typ FROM DUAL
UNION ALL
SELECT 10 u, 28 val, 'h' typ FROM DUAL
UNION ALL
SELECT 11 u, 24 val, 'h' typ FROM DUAL
UNION ALL
SELECT 12 u, 28 val, 'h' typ FROM DUAL
UNION ALL
SELECT 13 u, 22 val, 'h' typ FROM DUAL
UNION ALL
SELECT 14 u, 24 val, 'h' typ FROM DUAL
UNION ALL
SELECT 15 u, 24 val, 'h' typ FROM DUAL
UNION ALL
SELECT 16 u, 30 val, 'h' typ FROM DUAL
UNION ALL
SELECT 17 u, 28 val, 'h' typ FROM DUAL
UNION ALL
SELECT 18 u, 28 val, 'h' typ FROM DUAL
UNION ALL
SELECT 19 u, 26 val, 'h' typ FROM DUAL
UNION ALL
SELECT 20 u, 28 val, 'h' typ FROM DUAL
UNION ALL
SELECT 21 u, 30 val, 'h' typ FROM DUAL
UNION ALL
SELECT 22 u, 24 val, 'h' typ FROM DUAL
UNION ALL
SELECT 23 u, 30 val, 'h' typ FROM DUAL
UNION ALL
SELECT 24 u, 30 val, 'h' typ FROM DUAL
UNION ALL
SELECT 25 u, 30 val, 'h' typ FROM DUAL
UNION ALL
SELECT 26 u, 30 val, 'h' typ FROM DUAL
UNION ALL
SELECT 27 u, 30 val, 'h' typ FROM DUAL
UNION ALL
SELECT 28 u, 30 val, 'h' typ FROM DUAL
UNION ALL
SELECT 29 u, 30 val, 'h' typ FROM DUAL
UNION ALL
SELECT 30 u, 30 val, 'h' typ FROM DUAL
UNION ALL
SELECT 31 u, 30 val, 'h' typ FROM DUAL
UNION ALL
SELECT 32 u, 30 val, 'h' typ FROM DUAL
UNION ALL
SELECT 33 u, 30 val, 'h' typ FROM DUAL
UNION ALL
SELECT 34 u, 30 val, 'h' typ FROM DUAL
UNION ALL
SELECT 35 u, 30 val, 'h' typ FROM DUAL
UNION ALL
SELECT 36 u, 30 val, 'h' typ FROM DUAL
UNION ALL
SELECT 37 u, 30 val, 'h' typ FROM DUAL
UNION ALL
SELECT 38 u, 30 val, 'h' typ FROM DUAL
UNION ALL
SELECT 39 u, 30 val, 'h' typ FROM DUAL
UNION ALL
SELECT 40 u, 30 val, 'h' typ FROM DUAL)
WHERE u = s.u AND typ = s.typ)
LOOP
korr_byte := ss.val;
END LOOP;
CASE
WHEN korr_byte = 7
THEN
korr_mnogochlen := '87, 229, 146, 149, 238, 102, 21';
WHEN korr_byte = 10
THEN
korr_mnogochlen :=
'251, 67, 46, 61, 118, 70, 64, 94, 32, 45';
WHEN korr_byte = 13
THEN
korr_mnogochlen :=
'74, 152, 176, 100, 86, 100, 106, 104, 130, 218, 206, 140, 78';
WHEN korr_byte = 15
THEN
korr_mnogochlen :=
'8, 183, 61, 91, 202, 37, 51, 58, 58, 237, 140, 124, 5, 99, 105';
WHEN korr_byte = 16
THEN
korr_mnogochlen :=
'120, 104, 107, 109, 102, 161, 76, 3, 91, 191, 147, 169, 182, 194, 225, 120';
WHEN korr_byte = 17
THEN
korr_mnogochlen :=
'43, 139, 206, 78, 43, 239, 123, 206, 214, 147, 24, 99, 150, 39, 243, 163, 136';
WHEN korr_byte = 18
THEN
korr_mnogochlen :=
'215, 234, 158, 94, 184, 97, 118, 170, 79, 187, 152, 148, 252, 179, 5, 98, 96, 153';
WHEN korr_byte = 20
THEN
korr_mnogochlen :=
'17, 60, 79, 50, 61, 163, 26, 187, 202, 180, 221, 225, 83, 239, 156, 164, 212, 212, 188, 190';
WHEN korr_byte = 22
THEN
korr_mnogochlen :=
'210, 171, 247, 242, 93, 230, 14, 109, 221, 53, 200, 74, 8, 172, 98, 80, 219, 134, 160, 105, 165, 231';
WHEN korr_byte = 24
THEN
korr_mnogochlen :=
'229, 121, 135, 48, 211, 117, 251, 126, 159, 180, 169, 152, 192, 226, 228, 218, 111, 0, 117, 232, 87, 96, 227, 21';
WHEN korr_byte = 26
THEN
korr_mnogochlen :=
'173, 125, 158, 2, 103, 182, 118, 17, 145, 201, 111, 28, 165, 53, 161, 21, 245, 142, 13, 102, 48, 227, 153, 145, 218, 70';
WHEN korr_byte = 28
THEN
korr_mnogochlen :=
'168, 223, 200, 104, 224, 234, 108, 180, 110, 190, 195, 147, 205, 27, 232, 201, 21, 43, 245, 87, 42, 195, 212, 119, 242, 37, 9, 123';
WHEN korr_byte = 30
THEN
korr_mnogochlen :=
'41, 173, 145, 152, 216, 31, 179, 182, 50, 48, 110, 86, 239, 96, 222, 125, 42, 173, 226, 193, 224, 130, 156, 37, 251, 216, 238, 40, 192, 180';
END CASE;
--перевод корректирующго многочлена в двоичную ÑиÑтему (по 8 бит)
FOR i IN 1 .. korr_byte
LOOP
korr_mnogochlen_bin :=
korr_mnogochlen_bin
|| LPAD (XXXXmake_qr.hex2bin (XXXXmake_qr.dec2hex (
REGEXP_SUBSTR (
korr_mnogochlen,
'[^,]+',
1,
i))),
8,
'0'); --lpad( hex2bin(dec2hex( REGEXP_substr(korr_mnogochlen,'[^,]+',1,i)) ) ) ,8,'0');
cor10 (i) :=
REGEXP_SUBSTR (korr_mnogochlen,
'[^,]+',
1,
i);
END LOOP;
tmp := 0;
count_byte1 := count_byte;
korr_mnogochlen_tutto := '';
aaa_tmp := '';
--формирую вÑе корректирующие байты Ð´Ð»Ñ Ð²Ñех блоков
FOR i IN 0 .. p_v - 1
LOOP
IF i >= ostatok_mod
THEN
count_byte1 := count_byte + 1;
ELSE
count_byte1 := count_byte;
END IF;
korr_mnogochlen_bin_tmp := '';
korr_mn := '';
aaa_tmp := SUBSTR (p_b, tmp * 8 + 1, count_byte1 * 8);
FOR iii IN 0 .. /*max_2(count_byte1,korr_byte)*/
count_byte1 - 1
LOOP
fff := NVL (SUBSTR (aaa_tmp, 1, 8), '00000000');
IF bin2dec (fff) <> 0
THEN
d := bin2dec (fff);
dgi := galua_inv (d);
korr_mnogochlen_bin_tmp := '';
FOR j IN 0 .. korr_byte - 1
LOOP
cor_tmp (j) :=
galua (MOD (cor10 (j + 1) + dgi, 255));
END LOOP;
FOR j IN 0 .. /*korr_byte*/
max_2 (count_byte1, korr_byte) - 1
LOOP
p_tmp := SUBSTR (aaa_tmp, /*iii*8+*/
(j + 1) * 8 + 1, 8);
IF p_tmp IS NULL
THEN
p_tmp := '00000000';
END IF;
aaa := '';
IF j < korr_byte
THEN
aaa :=
LPAD (XXXXmake_qr.dec2bin (cor_tmp (j)),
8,
'0');
END IF;
IF aaa IS NULL
THEN
aaa := '00000000';
END IF;
korr_mnogochlen_bin_tmp :=
korr_mnogochlen_bin_tmp
|| bin_xor_bin (aaa, p_tmp);
END LOOP;
aaa_tmp := korr_mnogochlen_bin_tmp;
korr_mn := korr_mnogochlen_bin_tmp;
korr_mnogochlen_bin_tmp := '';
ELSE
aaa_tmp := SUBSTR (aaa_tmp, 9);
END IF;
END LOOP;
korr_mnogochlen_tutto :=
korr_mnogochlen_tutto
|| SUBSTR (aaa_tmp, 1, korr_byte * 8); --korr_mn;
tmp := tmp + count_byte1;
END LOOP;
aaa_tmp := '';
aaa := '';
--туÑую байты данных Ñ ÐºÐ¾Ñ€Ñ€ байтами - должен получитьÑÑ Ð¸Ñ‚Ð¾Ð³Ð¾Ð²Ñ‹Ð¹ маÑÑив Ð´Ð»Ñ Ð¾Ñ‚Ñ€Ð¸Ñовки
tutto := ''; --данные
p_b_tmp := '';
count_byte1 := count_byte;
tmp := 0;
d := 0;
IF ostatok_mod < p_v
THEN
d := 1;
ELSE
d := 0;
END IF;
FOR ii IN 0 .. count_byte + d - 1
LOOP
tmp := 0;
FOR i IN 0 .. p_v - 1
LOOP
IF i >= ostatok_mod
THEN
count_byte1 := count_byte + 1;
ELSE
count_byte1 := count_byte;
END IF;
p_b_tmp := SUBSTR (p_b, tmp * 8 + 1, count_byte1 * 8);
aaa_tmp := SUBSTR (p_b_tmp, ii * 8 + 1, 8);
IF aaa_tmp IS NULL
THEN
aaa_tmp := '';
END IF;
tutto := tutto || aaa_tmp;
tmp := tmp + count_byte1;
END LOOP;
END LOOP;
aaa_tmp := '';
aaa := '';
--корр многочлен
p_b_tmp := '';
tmp := 0;
d := 0;
FOR ii IN 0 .. korr_byte - 1
LOOP
tmp := 0;
FOR i IN 0 .. p_v - 1
LOOP
p_b_tmp :=
SUBSTR (korr_mnogochlen_tutto,
tmp * 8 + 1,
korr_byte * 8);
aaa_tmp := SUBSTR (p_b_tmp, ii * 8 + 1, 8);
IF aaa_tmp IS NULL
THEN
aaa_tmp := '';
END IF;
tutto := tutto || aaa_tmp;
tmp := tmp + korr_byte;
END LOOP;
END LOOP;
aaa_tmp := '';
aaa := '';
--риÑуем маÑÑив 0-белый квадрат 1-черный
CASE
WHEN s.u = 2
THEN
poisk_coor := '18';
count_poisk := 1;
WHEN s.u = 3
THEN
poisk_coor := '22';
count_poisk := 1;
WHEN s.u = 4
THEN
poisk_coor := '26';
count_poisk := 1;
WHEN s.u = 5
THEN
poisk_coor := '30';
count_poisk := 1;
WHEN s.u = 6
THEN
poisk_coor := '34';
count_poisk := 1;
WHEN s.u = 7
THEN
poisk_coor := '6, 22, 38';
count_poisk := 3;
WHEN s.u = 8
THEN
poisk_coor := '6, 24, 42';
count_poisk := 3;
WHEN s.u = 9
THEN
poisk_coor := '6, 26, 46';
count_poisk := 3;
WHEN s.u = 10
THEN
poisk_coor := '6, 28, 50';
count_poisk := 3;
WHEN s.u = 11
THEN
poisk_coor := '6, 30, 54';
count_poisk := 3;
WHEN s.u = 12
THEN
poisk_coor := '6, 32, 58';
count_poisk := 3;
WHEN s.u = 13
THEN
poisk_coor := '6, 34, 62';
count_poisk := 3;
WHEN s.u = 14
THEN
poisk_coor := '6, 26, 46, 66';
count_poisk := 4;
WHEN s.u = 15
THEN
poisk_coor := '6, 26, 48, 70';
count_poisk := 4;
WHEN s.u = 16
THEN
poisk_coor := '6, 26, 50, 74';
count_poisk := 4;
WHEN s.u = 17
THEN
poisk_coor := '6, 30, 54, 78';
count_poisk := 4;
WHEN s.u = 18
THEN
poisk_coor := '6, 30, 56, 82';
count_poisk := 4;
WHEN s.u = 19
THEN
poisk_coor := '6, 30, 58, 86';
count_poisk := 4;
WHEN s.u = 20
THEN
poisk_coor := '6, 34, 62, 90';
count_poisk := 4;
WHEN s.u = 21
THEN
poisk_coor := '6, 28, 50, 72, 94';
count_poisk := 5;
WHEN s.u = 22
THEN
poisk_coor := '6, 26, 50, 74, 98';
count_poisk := 5;
WHEN s.u = 23
THEN
poisk_coor := '6, 30, 54, 78, 102';
count_poisk := 5;
WHEN s.u = 24
THEN
poisk_coor := '6, 28, 54, 80, 106';
count_poisk := 5;
WHEN s.u = 25
THEN
poisk_coor := '6, 32, 58, 84, 110';
count_poisk := 5;
WHEN s.u = 26
THEN
poisk_coor := '6, 30, 58, 86, 114';
count_poisk := 5;
WHEN s.u = 27
THEN
poisk_coor := '6, 34, 62, 90, 118';
count_poisk := 5;
WHEN s.u = 28
THEN
poisk_coor := '6, 26, 50, 74, 98, 122';
count_poisk := 6;
WHEN s.u = 29
THEN
poisk_coor := '6, 30, 54, 78, 102, 126';
count_poisk := 6;
WHEN s.u = 30
THEN
poisk_coor := '6, 26, 52, 78, 104, 130';
count_poisk := 6;
WHEN s.u = 31
THEN
poisk_coor := '6, 30, 56, 82, 108, 134';
count_poisk := 6;
WHEN s.u = 32
THEN
poisk_coor := '6, 34, 60, 86, 112, 138';
count_poisk := 6;
WHEN s.u = 33
THEN
poisk_coor := '6, 30, 58, 86, 114, 142';
count_poisk := 6;
WHEN s.u = 34
THEN
poisk_coor := '6, 34, 62, 90, 118, 146';
count_poisk := 6;
WHEN s.u = 35
THEN
poisk_coor := '6, 30, 54, 78, 102, 126, 150';
count_poisk := 7;
WHEN s.u = 36
THEN
poisk_coor := '6, 24, 50, 76, 102, 128, 154';
count_poisk := 7;
WHEN s.u = 37
THEN
poisk_coor := '6, 28, 54, 80, 106, 132, 158';
count_poisk := 7;
WHEN s.u = 38
THEN
poisk_coor := '6, 32, 58, 84, 110, 136, 162';
count_poisk := 7;
WHEN s.u = 39
THEN
poisk_coor := '6, 26, 54, 82, 110, 138, 166';
count_poisk := 7;
WHEN s.u = 40
THEN
poisk_coor := '6, 30, 58, 86, 114, 142, 170';
count_poisk := 7;
WHEN s.u = 1
THEN
count_poisk := 0;
poisk_coor := '-';
END CASE;
quadro := 21 + (s.u - 1) * 4;
FOR i IN 1 .. quadro
LOOP
FOR j IN 1 .. quadro
LOOP
z (i) (j) := 9;
END LOOP;
END LOOP;
IF count_poisk <> 0
THEN
FOR i IN 1 .. count_poisk
LOOP
IF i = 1
THEN
mincoor :=
TO_NUMBER (REGEXP_SUBSTR (poisk_coor,
'[^,]+',
1,
i));
END IF;
IF i = count_poisk
THEN
maxcoor :=
TO_NUMBER (REGEXP_SUBSTR (poisk_coor,
'[^,]+',
1,
i));
END IF;
END LOOP;
FOR i IN 1 .. count_poisk
LOOP
m :=
TO_NUMBER (REGEXP_SUBSTR (poisk_coor,
'[^,]+',
1,
i));
FOR j IN 1 .. count_poisk
LOOP
n :=
TO_NUMBER (REGEXP_SUBSTR (poisk_coor,
'[^,]+',
1,
j));
IF NOT ( (m = mincoor AND n = mincoor)
OR (m = mincoor AND n = maxcoor)
OR (m = maxcoor AND n = mincoor))
OR mincoor = maxcoor
THEN
FOR k IN 1 .. quadro
LOOP
FOR kk IN 1 .. (quadro /*+1*/
)
LOOP
IF m + 1 = k AND n + 1 = kk
THEN
z (k) (kk) := 1;
z (k) (kk + 1) := 0;
z (k) (kk - 1) := 0;
z (k - 1) (kk - 1) := 0;
z (k - 1) (kk) := 0;
z (k - 1) (kk + 1) := 0;
z (k + 1) (kk - 1) := 0;
z (k + 1) (kk) := 0;
z (k + 1) (kk + 1) := 0;
z (k - 2) (kk - 2) := 1;
z (k - 2) (kk - 1) := 1;
z (k - 2) (kk) := 1;
z (k - 2) (kk + 1) := 1;
z (k - 2) (kk + 2) := 1;
z (k + 2) (kk - 2) := 1;
z (k + 2) (kk - 1) := 1;
z (k + 2) (kk) := 1;
z (k + 2) (kk + 1) := 1;
z (k + 2) (kk + 2) := 1;
z (k + 1) (kk + 2) := 1;
z (k) (kk + 2) := 1;
z (k - 1) (kk + 2) := 1;
z (k + 1) (kk - 2) := 1;
z (k) (kk - 2) := 1;
z (k - 1) (kk - 2) := 1;
END IF;
END LOOP;
END LOOP;
END IF;
END LOOP;
END LOOP;
END IF;
--поиÑковые узоры в углах
--левый верхний
z (1) (1) := 1;
z (1) (2) := 1;
z (1) (3) := 1;
z (1) (4) := 1;
z (1) (5) := 1;
z (1) (6) := 1;
z (1) (7) := 1;
z (1) (8) := 0;
z (2) (1) := 1;
z (2) (2) := 0;
z (2) (3) := 0;
z (2) (4) := 0;
z (2) (5) := 0;
z (2) (6) := 0;
z (2) (7) := 1;
z (2) (8) := 0;
z (3) (1) := 1;
z (3) (2) := 0;
z (3) (3) := 1;
z (3) (4) := 1;
z (3) (5) := 1;
z (3) (6) := 0;
z (3) (7) := 1;
z (3) (8) := 0;
z (4) (1) := 1;
z (4) (2) := 0;
z (4) (3) := 1;
z (4) (4) := 1;
z (4) (5) := 1;
z (4) (6) := 0;
z (4) (7) := 1;
z (4) (8) := 0;
z (5) (1) := 1;
z (5) (2) := 0;
z (5) (3) := 1;
z (5) (4) := 1;
z (5) (5) := 1;
z (5) (6) := 0;
z (5) (7) := 1;
z (5) (8) := 0;
z (6) (1) := 1;
z (6) (2) := 0;
z (6) (3) := 0;
z (6) (4) := 0;
z (6) (5) := 0;
z (6) (6) := 0;
z (6) (7) := 1;
z (6) (8) := 0;
z (7) (1) := 1;
z (7) (2) := 1;
z (7) (3) := 1;
z (7) (4) := 1;
z (7) (5) := 1;
z (7) (6) := 1;
z (7) (7) := 1;
z (7) (8) := 0;
z (8) (1) := 0;
z (8) (2) := 0;
z (8) (3) := 0;
z (8) (4) := 0;
z (8) (5) := 0;
z (8) (6) := 0;
z (8) (7) := 0;
z (8) (8) := 0;
--правый верхний
z (1) (quadro - 7) := 0;
z (1) (quadro - 6) := 1;
z (1) (quadro - 5) := 1;
z (1) (quadro - 4) := 1;
z (1) (quadro - 3) := 1;
z (1) (quadro - 2) := 1;
z (1) (quadro - 1) := 1;
z (1) (quadro) := 1;
z (2) (quadro - 7) := 0;
z (2) (quadro - 6) := 1;
z (2) (quadro - 5) := 0;
z (2) (quadro - 4) := 0;
z (2) (quadro - 3) := 0;
z (2) (quadro - 2) := 0;
z (2) (quadro - 1) := 0;
z (2) (quadro) := 1;
z (3) (quadro - 7) := 0;
z (3) (quadro - 6) := 1;
z (3) (quadro - 5) := 0;
z (3) (quadro - 4) := 1;
z (3) (quadro - 3) := 1;
z (3) (quadro - 2) := 1;
z (3) (quadro - 1) := 0;
z (3) (quadro) := 1;
z (4) (quadro - 7) := 0;
z (4) (quadro - 6) := 1;
z (4) (quadro - 5) := 0;
z (4) (quadro - 4) := 1;
z (4) (quadro - 3) := 1;
z (4) (quadro - 2) := 1;
z (4) (quadro - 1) := 0;
z (4) (quadro) := 1;
z (5) (quadro - 7) := 0;
z (5) (quadro - 6) := 1;
z (5) (quadro - 5) := 0;
z (5) (quadro - 4) := 1;
z (5) (quadro - 3) := 1;
z (5) (quadro - 2) := 1;
z (5) (quadro - 1) := 0;
z (5) (quadro) := 1;
z (6) (quadro - 7) := 0;
z (6) (quadro - 6) := 1;
z (6) (quadro - 5) := 0;
z (6) (quadro - 4) := 0;
z (6) (quadro - 3) := 0;
z (6) (quadro - 2) := 0;
z (6) (quadro - 1) := 0;
z (6) (quadro) := 1;
z (7) (quadro - 7) := 0;
z (7) (quadro - 6) := 1;
z (7) (quadro - 5) := 1;
z (7) (quadro - 4) := 1;
z (7) (quadro - 3) := 1;
z (7) (quadro - 2) := 1;
z (7) (quadro - 1) := 1;
z (7) (quadro) := 1;
z (8) (quadro - 7) := 0;
z (8) (quadro - 6) := 0;
z (8) (quadro - 5) := 0;
z (8) (quadro - 4) := 0;
z (8) (quadro - 3) := 0;
z (8) (quadro - 2) := 0;
z (8) (quadro - 1) := 0;
z (8) (quadro) := 0;
--левый нижний
z (quadro - 7) (1) := 0;
z (quadro - 7) (2) := 0;
z (quadro - 7) (3) := 0;
z (quadro - 7) (4) := 0;
z (quadro - 7) (5) := 0;
z (quadro - 7) (6) := 0;
z (quadro - 7) (7) := 0;
z (quadro - 7) (8) := 0;
z (quadro - 6) (1) := 1;
z (quadro - 6) (2) := 1;
z (quadro - 6) (3) := 1;
z (quadro - 6) (4) := 1;
z (quadro - 6) (5) := 1;
z (quadro - 6) (6) := 1;
z (quadro - 6) (7) := 1;
z (quadro - 6) (8) := 0;
z (quadro - 5) (1) := 1;
z (quadro - 5) (2) := 0;
z (quadro - 5) (3) := 0;
z (quadro - 5) (4) := 0;
z (quadro - 5) (5) := 0;
z (quadro - 5) (6) := 0;
z (quadro - 5) (7) := 1;
z (quadro - 5) (8) := 0;
z (quadro - 4) (1) := 1;
z (quadro - 4) (2) := 0;
z (quadro - 4) (3) := 1;
z (quadro - 4) (4) := 1;
z (quadro - 4) (5) := 1;
z (quadro - 4) (6) := 0;
z (quadro - 4) (7) := 1;
z (quadro - 4) (8) := 0;
z (quadro - 3) (1) := 1;
z (quadro - 3) (2) := 0;
z (quadro - 3) (3) := 1;
z (quadro - 3) (4) := 1;
z (quadro - 3) (5) := 1;
z (quadro - 3) (6) := 0;
z (quadro - 3) (7) := 1;
z (quadro - 3) (8) := 0;
z (quadro - 2) (1) := 1;
z (quadro - 2) (2) := 0;
z (quadro - 2) (3) := 1;
z (quadro - 2) (4) := 1;
z (quadro - 2) (5) := 1;
z (quadro - 2) (6) := 0;
z (quadro - 2) (7) := 1;
z (quadro - 2) (8) := 0;
z (quadro - 1) (1) := 1;
z (quadro - 1) (2) := 0;
z (quadro - 1) (3) := 0;
z (quadro - 1) (4) := 0;
z (quadro - 1) (5) := 0;
z (quadro - 1) (6) := 0;
z (quadro - 1) (7) := 1;
z (quadro - 1) (8) := 0;
z (quadro) (1) := 1;
z (quadro) (2) := 1;
z (quadro) (3) := 1;
z (quadro) (4) := 1;
z (quadro) (5) := 1;
z (quadro) (6) := 1;
z (quadro) (7) := 1;
z (quadro) (8) := 0;
--полоÑÑ‹ Ñинхронизации
dgi := 1;
mincoor := 6;
FOR kk IN 9 .. (quadro - 8)
LOOP
z (kk) (7) := dgi;
IF dgi = 1
THEN
dgi := 0;
ELSE
dgi := 1;
END IF;
END LOOP;
dgi := 1;
FOR kk IN 9 .. (quadro - 8)
LOOP
z (7) (kk) := dgi;
IF dgi = 1
THEN
dgi := 0;
ELSE
dgi := 1;
END IF;
END LOOP;
--код верÑии
IF s.u > 6
THEN
CASE
WHEN s.u = 7
THEN
kod_versii := '000010011110100110';
WHEN s.u = 8
THEN
kod_versii := '010001011100111000';
WHEN s.u = 9
THEN
kod_versii := '110111011000000100';
WHEN s.u = 10
THEN
kod_versii := '101001111110000000';
WHEN s.u = 11
THEN
kod_versii := '001111111010111100';
WHEN s.u = 12
THEN
kod_versii := '001101100100011010';
WHEN s.u = 13
THEN
kod_versii := '101011100000100110';
WHEN s.u = 14
THEN
kod_versii := '110101000110100010';
WHEN s.u = 15
THEN
kod_versii := '010011000010011110';
WHEN s.u = 16
THEN
kod_versii := '011100010001011100';
WHEN s.u = 17
THEN
kod_versii := '111010010101100000';
WHEN s.u = 18
THEN
kod_versii := '100100110011100100';
WHEN s.u = 19
THEN
kod_versii := '000010110111011000';
WHEN s.u = 20
THEN
kod_versii := '000000101001111110';
WHEN s.u = 21
THEN
kod_versii := '100110101101000010';
WHEN s.u = 22
THEN
kod_versii := '111000001011000110';
WHEN s.u = 23
THEN
kod_versii := '011110001111111010';
WHEN s.u = 24
THEN
kod_versii := '001101001101100100';
WHEN s.u = 25
THEN
kod_versii := '101011001001011000';
WHEN s.u = 26
THEN
kod_versii := '110101101111011100';
WHEN s.u = 27
THEN
kod_versii := '010011101011100000';
WHEN s.u = 28
THEN
kod_versii := '010001110101000110';
WHEN s.u = 29
THEN
kod_versii := '110111110001111010';
WHEN s.u = 30
THEN
kod_versii := '101001010111111110';
WHEN s.u = 31
THEN
kod_versii := '001111010011000010';
WHEN s.u = 32
THEN
kod_versii := '101000011000101101';
WHEN s.u = 33
THEN
kod_versii := '001110011100010001';
WHEN s.u = 34
THEN
kod_versii := '010000111010010101';
WHEN s.u = 35
THEN
kod_versii := '110110111110101001';
WHEN s.u = 36
THEN
kod_versii := '110100100000001111';
WHEN s.u = 37
THEN
kod_versii := '010010100100110011';
WHEN s.u = 38
THEN
kod_versii := '001100000010110111';
WHEN s.u = 39
THEN
kod_versii := '101010000110001011';
WHEN s.u = 40
THEN
kod_versii := '111001000100010101';
END CASE;
z (quadro - 10) (1) := TO_NUMBER (SUBSTR (kod_versii, 1, 1));
z (quadro - 10) (2) := TO_NUMBER (SUBSTR (kod_versii, 2, 1));
z (quadro - 10) (3) := TO_NUMBER (SUBSTR (kod_versii, 3, 1));
z (quadro - 10) (4) := TO_NUMBER (SUBSTR (kod_versii, 4, 1));
z (quadro - 10) (5) := TO_NUMBER (SUBSTR (kod_versii, 5, 1));
z (quadro - 10) (6) := TO_NUMBER (SUBSTR (kod_versii, 6, 1));
z (quadro - 9) (1) := TO_NUMBER (SUBSTR (kod_versii, 7, 1));
z (quadro - 9) (2) := TO_NUMBER (SUBSTR (kod_versii, 8, 1));
z (quadro - 9) (3) := TO_NUMBER (SUBSTR (kod_versii, 9, 1));
z (quadro - 9) (4) := TO_NUMBER (SUBSTR (kod_versii, 10, 1));
z (quadro - 9) (5) := TO_NUMBER (SUBSTR (kod_versii, 11, 1));
z (quadro - 9) (6) := TO_NUMBER (SUBSTR (kod_versii, 12, 1));
z (quadro - 8) (1) := TO_NUMBER (SUBSTR (kod_versii, 13, 1));
z (quadro - 8) (2) := TO_NUMBER (SUBSTR (kod_versii, 14, 1));
z (quadro - 8) (3) := TO_NUMBER (SUBSTR (kod_versii, 15, 1));
z (quadro - 8) (4) := TO_NUMBER (SUBSTR (kod_versii, 16, 1));
z (quadro - 8) (5) := TO_NUMBER (SUBSTR (kod_versii, 17, 1));
z (quadro - 8) (6) := TO_NUMBER (SUBSTR (kod_versii, 18, 1));
z (1) (quadro - 10) := TO_NUMBER (SUBSTR (kod_versii, 1, 1));
z (2) (quadro - 10) := TO_NUMBER (SUBSTR (kod_versii, 2, 1));
z (3) (quadro - 10) := TO_NUMBER (SUBSTR (kod_versii, 3, 1));
z (4) (quadro - 10) := TO_NUMBER (SUBSTR (kod_versii, 4, 1));
z (5) (quadro - 10) := TO_NUMBER (SUBSTR (kod_versii, 5, 1));
z (6) (quadro - 10) := TO_NUMBER (SUBSTR (kod_versii, 6, 1));
z (1) (quadro - 9) := TO_NUMBER (SUBSTR (kod_versii, 7, 1));
z (2) (quadro - 9) := TO_NUMBER (SUBSTR (kod_versii, 8, 1));
z (3) (quadro - 9) := TO_NUMBER (SUBSTR (kod_versii, 9, 1));
z (4) (quadro - 9) := TO_NUMBER (SUBSTR (kod_versii, 10, 1));
z (5) (quadro - 9) := TO_NUMBER (SUBSTR (kod_versii, 11, 1));
z (6) (quadro - 9) := TO_NUMBER (SUBSTR (kod_versii, 12, 1));
z (1) (quadro - 8) := TO_NUMBER (SUBSTR (kod_versii, 13, 1));
z (2) (quadro - 8) := TO_NUMBER (SUBSTR (kod_versii, 14, 1));
z (3) (quadro - 8) := TO_NUMBER (SUBSTR (kod_versii, 15, 1));
z (4) (quadro - 8) := TO_NUMBER (SUBSTR (kod_versii, 16, 1));
z (5) (quadro - 8) := TO_NUMBER (SUBSTR (kod_versii, 17, 1));
z (6) (quadro - 8) := TO_NUMBER (SUBSTR (kod_versii, 18, 1));
END IF;
--код маÑки и ÑƒÑ€Ð¾Ð²Ð½Ñ ÐºÐ¾Ñ€Ñ€ÐµÐºÑ†Ð¸Ð¸
-- X ? Ñтолбец, Y ? Ñтрока, % ? оÑтаток от делениÑ, / ? целочиÑленное деление.
--0 (X+Y) % 2
--1 Y % 2
--2 X % 3
--3 (X + Y) % 3
--4 (X/3 + Y/2) % 2
--5 (X*Y) % 2 + (X*Y) % 3
--6 ((X*Y) % 2 + (X*Y) % 3) % 2
--7 ((X*Y) % 3 + (X+Y) % 2) % 2
kod_maski := 0; --3;
CASE
WHEN s.typ = 'l' AND kod_maski = 0
THEN
kod_versii := '111011111000100';
WHEN s.typ = 'l' AND kod_maski = 1
THEN
kod_versii := '111001011110011';
WHEN s.typ = 'l' AND kod_maski = 2
THEN
kod_versii := '111110110101010';
WHEN s.typ = 'l' AND kod_maski = 3
THEN
kod_versii := '111100010011101';
WHEN s.typ = 'l' AND kod_maski = 4
THEN
kod_versii := '110011000101111';
WHEN s.typ = 'l' AND kod_maski = 5
THEN
kod_versii := '110001100011000';
WHEN s.typ = 'l' AND kod_maski = 6
THEN
kod_versii := '110110001000001';
WHEN s.typ = 'l' AND kod_maski = 7
THEN
kod_versii := '110100101110110';
WHEN s.typ = 'm' AND kod_maski = 0
THEN
kod_versii := '101010000010010';
WHEN s.typ = 'm' AND kod_maski = 1
THEN
kod_versii := '101000100100101';
WHEN s.typ = 'm' AND kod_maski = 2
THEN
kod_versii := '101111001111100';
WHEN s.typ = 'm' AND kod_maski = 3
THEN
kod_versii := '101101101001011';
WHEN s.typ = 'm' AND kod_maski = 4
THEN
kod_versii := '100010111111001';
WHEN s.typ = 'm' AND kod_maski = 5
THEN
kod_versii := '100000011001110';
WHEN s.typ = 'm' AND kod_maski = 6
THEN
kod_versii := '100111110010111';
WHEN s.typ = 'm' AND kod_maski = 7
THEN
kod_versii := '100101010100000';
WHEN s.typ = 'q' AND kod_maski = 0
THEN
kod_versii := '011010101011111';
WHEN s.typ = 'q' AND kod_maski = 1
THEN
kod_versii := '011000001101000';
WHEN s.typ = 'q' AND kod_maski = 2
THEN
kod_versii := '011111100110001';
WHEN s.typ = 'q' AND kod_maski = 3
THEN
kod_versii := '011101000000110';
WHEN s.typ = 'q' AND kod_maski = 4
THEN
kod_versii := '010010010110100';
WHEN s.typ = 'q' AND kod_maski = 5
THEN
kod_versii := '010000110000011';
WHEN s.typ = 'q' AND kod_maski = 6
THEN
kod_versii := '010111011011010';
WHEN s.typ = 'q' AND kod_maski = 7
THEN
kod_versii := '010101111101101';
WHEN s.typ = 'h' AND kod_maski = 0
THEN
kod_versii := '001011010001001';
WHEN s.typ = 'h' AND kod_maski = 1
THEN
kod_versii := '001001110111110';
WHEN s.typ = 'h' AND kod_maski = 2
THEN
kod_versii := '001110011100111';
WHEN s.typ = 'h' AND kod_maski = 3
THEN
kod_versii := '001100111010000';
WHEN s.typ = 'h' AND kod_maski = 4
THEN
kod_versii := '000011101100010';
WHEN s.typ = 'h' AND kod_maski = 5
THEN
kod_versii := '000001001010101';
WHEN s.typ = 'h' AND kod_maski = 6
THEN
kod_versii := '000110100001100';
WHEN s.typ = 'h' AND kod_maski = 7
THEN
kod_versii := '000100000111011';
END CASE;
z (quadro) (9) := TO_NUMBER (SUBSTR (kod_versii, 1, 1));
z (quadro - 1) (9) := TO_NUMBER (SUBSTR (kod_versii, 2, 1));
z (quadro - 2) (9) := TO_NUMBER (SUBSTR (kod_versii, 3, 1));
z (quadro - 3) (9) := TO_NUMBER (SUBSTR (kod_versii, 4, 1));
z (quadro - 4) (9) := TO_NUMBER (SUBSTR (kod_versii, 5, 1));
z (quadro - 5) (9) := TO_NUMBER (SUBSTR (kod_versii, 6, 1));
z (quadro - 6) (9) := TO_NUMBER (SUBSTR (kod_versii, 7, 1));
z (quadro - 7) (9) := 1;
z (9) (quadro - 7) := TO_NUMBER (SUBSTR (kod_versii, 8, 1));
z (9) (quadro - 6) := TO_NUMBER (SUBSTR (kod_versii, 9, 1));
z (9) (quadro - 5) := TO_NUMBER (SUBSTR (kod_versii, 10, 1));
z (9) (quadro - 4) := TO_NUMBER (SUBSTR (kod_versii, 11, 1));
z (9) (quadro - 3) := TO_NUMBER (SUBSTR (kod_versii, 12, 1));
z (9) (quadro - 2) := TO_NUMBER (SUBSTR (kod_versii, 13, 1));
z (9) (quadro - 1) := TO_NUMBER (SUBSTR (kod_versii, 14, 1));
z (9) (quadro) := TO_NUMBER (SUBSTR (kod_versii, 15, 1));
z (9) (1) := TO_NUMBER (SUBSTR (kod_versii, 1, 1));
z (9) (2) := TO_NUMBER (SUBSTR (kod_versii, 2, 1));
z (9) (3) := TO_NUMBER (SUBSTR (kod_versii, 3, 1));
z (9) (4) := TO_NUMBER (SUBSTR (kod_versii, 4, 1));
z (9) (5) := TO_NUMBER (SUBSTR (kod_versii, 5, 1));
z (9) (6) := TO_NUMBER (SUBSTR (kod_versii, 6, 1));
z (9) (8) := TO_NUMBER (SUBSTR (kod_versii, 7, 1));
z (9) (9) := TO_NUMBER (SUBSTR (kod_versii, 8, 1));
z (8) (9) := TO_NUMBER (SUBSTR (kod_versii, 9, 1));
z (6) (9) := TO_NUMBER (SUBSTR (kod_versii, 10, 1));
z (5) (9) := TO_NUMBER (SUBSTR (kod_versii, 11, 1));
z (4) (9) := TO_NUMBER (SUBSTR (kod_versii, 12, 1));
z (3) (9) := TO_NUMBER (SUBSTR (kod_versii, 13, 1));
z (2) (9) := TO_NUMBER (SUBSTR (kod_versii, 14, 1));
z (1) (9) := TO_NUMBER (SUBSTR (kod_versii, 15, 1));
--риÑую Ñами данные
tmp := 1; --1-вверх 0-вниз
s_s := '';
tmp1 := 1;
dgi := 0;
colonka := 1; --(quadro-1)/2;
stroka := 1;
flag := 1;
flag_lr := 0; --0-Ð¿Ñ€Ð°Ð²Ð°Ñ 1-леваÑ
WHILE tmp1 <= LENGTH (tutto)
LOOP
IF flag = 1
THEN
s_s := SUBSTR (tutto, tmp1, 1);
IF s_s = '0'
THEN
sss := 2;
END IF;
IF s_s = '1'
THEN
sss := 3;
END IF;
tmp1 := tmp1 + 1;
flag := 0;
END IF;
IF tmp = 1 AND flag = 0
THEN
dgi := z (quadro - stroka + 1) (quadro - colonka + 1);
IF dgi = 9
THEN
z (quadro - stroka + 1) (quadro - colonka + 1) := sss;
flag := 1;
ELSE
flag := 0;
END IF;
IF stroka = quadro AND flag_lr = 1
THEN
tmp := 0;
IF colonka + 2 <> quadro - 5
THEN
colonka := colonka + 2;
ELSE
colonka := colonka + 3;
END IF;
stroka := stroka - 1;
END IF;
IF flag_lr = 1
THEN
stroka := stroka + 1;
END IF;
IF flag_lr = 0
THEN
flag_lr := 1;
colonka := colonka + 1;
ELSE
flag_lr := 0;
colonka := colonka - 1;
END IF;
END IF;
IF tmp = 0 AND flag = 0
THEN
dgi := z (quadro - stroka + 1) (quadro - colonka + 1);
IF dgi = 9
THEN
z (quadro - stroka + 1) (quadro - colonka + 1) := sss;
flag := 1;
ELSE
flag := 0;
END IF;
IF stroka = 1 AND flag_lr = 1
THEN
tmp := 1;
IF colonka + 2 <> quadro - 5
THEN
colonka := colonka + 2;
ELSE
colonka := colonka + 3;
END IF;
stroka := stroka + 1;
END IF;
IF flag_lr = 1
THEN
stroka := stroka - 1;
END IF;
IF flag_lr = 0
THEN
flag_lr := 1;
colonka := colonka + 1;
ELSE
flag_lr := 0;
colonka := colonka - 1;
END IF;
END IF;
END LOOP;
--накладываю маÑку =0 - mod(stroka+colonka,2)
FOR i IN 0 .. quadro - 1
LOOP
FOR j IN 0 .. quadro - 1
LOOP
IF MOD (i + j, 2) = 0
THEN
IF z (i + 1) (j + 1) = 3
THEN
z (i + 1) (j + 1) := 0;
END IF;
IF z (i + 1) (j + 1) = 2
THEN
z (i + 1) (j + 1) := 1;
END IF;
END IF;
END LOOP;
END LOOP;
END LOOP;
--конверт в bmp
DBMS_LOB.createtemporary (bmp_tmp, TRUE);
d := 0;
IF MOD (CEIL (quadro / 8), 4) <> 0
THEN
d := 4 - MOD (CEIL (quadro / 8), 4);
END IF;
strhex := -- размер квадрата в пикÑелах, размер данных.. шапка bmp
REGEXP_REPLACE (
REGEXP_REPLACE (
REGEXP_REPLACE (
REGEXP_REPLACE (
REGEXP_REPLACE (
REGEXP_REPLACE (
REGEXP_REPLACE (
REGEXP_REPLACE (
strhex,
'..',
SUBSTR (
LPAD (
XXXXmake_qr.dec2hex (quadro),
4,
'0'),
1,
2),
39,
1),
'..',
SUBSTR (
LPAD (XXXXmake_qr.dec2hex (quadro),
4,
'0'),
3,
2),
37,
1),
'..',
SUBSTR (
LPAD (XXXXmake_qr.dec2hex (quadro),
4,
'0'),
1,
2),
47,
1),
'..',
SUBSTR (
LPAD (XXXXmake_qr.dec2hex (quadro), 4, '0'),
3,
2),
45,
1),
'..',
SUBSTR (
LPAD (
XXXXmake_qr.dec2hex (
(CEIL (quadro / 8) /*+4*/
+ d) * quadro),
4,
'0'),
1,
2),
71,
1),
'..',
SUBSTR (
LPAD (
XXXXmake_qr.dec2hex (
(CEIL (quadro / 8) /*+4*/
+ d) * quadro),
4,
'0'),
3,
2),
69,
1),
'..',
SUBSTR (
LPAD (
XXXXmake_qr.dec2hex (
(CEIL (quadro / 8) /*+4*/
+ d) * quadro + 62),
4,
'0'),
1,
2),
7,
1),
'..',
SUBSTR (
LPAD (
XXXXmake_qr.dec2hex (
(CEIL (quadro / 8) /*+4*/
+ d) * quadro + 62),
4,
'0'),
3,
2),
5,
1);
aaa := '';
FOR i IN 0 .. 61
LOOP
aaa :=
aaa || CHR (TO_NUMBER (SUBSTR (strhex, i * 2 + 1, 2), 'XX'));
END LOOP;
draw := '';
FOR i IN REVERSE 1 .. quadro
LOOP --reverse
draw := '';
FOR k IN 1 .. quadro
LOOP
draw := draw || z (i) (k);
END LOOP;
draw := REPLACE (draw, '9', '0');
draw := REPLACE (draw, '2', '0');
draw := REPLACE (draw, '3', '1');
aaa_tmp := RPAD (draw, (CEIL (quadro / 8) /*+4*/
+ d) * 8, '0');
FOR j IN 1 .. quadro
LOOP
IF SUBSTR (aaa_tmp, j, 1) = '0'
THEN
aaa_tmp :=
REGEXP_REPLACE (aaa_tmp,
'.',
'1',
j,
1);
ELSE
aaa_tmp :=
REGEXP_REPLACE (aaa_tmp,
'.',
'0',
j,
1);
END IF;
END LOOP;
FOR j IN 0 .. (CEIL (quadro / 8) /*+4*/
+ d) - 1
LOOP
p_tmp := SUBSTR (aaa_tmp, j * 8 + 1, 8);
--dbms_lob.append(bmp_tmp, utl_raw.cast_to_raw( chr(to_number(dec2hex(bin2dec(p_tmp)),'XX')) ) );
aaa :=
aaa || CHR (TO_NUMBER (dec2hex (bin2dec (p_tmp)), 'XX'));
END LOOP;
END LOOP;
DBMS_LOB.append (bmp_tmp, UTL_RAW.cast_to_raw (TRIM (aaa)));
RETURN bmp_tmp;
DBMS_LOB.freetemporary (bmp_tmp);
END;
--http://www.pvsm.ru/pesochnitsa/29255
END XXXXmake_qr;
/