ВСЁ придумал, помог этот форум - предыдущая тема.
Расказываю (вариант на половину сырой ):
На стороне BW в Oracle делаем функцию :
--------------------------------------------------------
create or replace function hex_to_raw(inhex varchar2) return varchar2 as
inhex_work varchar2(2000);
hex1 varchar2(2000);
hex2 varchar2(2000);
decimal_number number;
ascii_char varchar2(2000);
return_string varchar2(2000);
begin
inhex_work := rtrim(ltrim(inhex));
if length(inhex_work) is null then
return NULL;
end if;
hex1 := substr(inhex_work,1,1);
hex2 := substr(inhex_work,2,1);
loop
if instr(hex1,'A') = 1 Then
hex1 := '10';
elsif instr(hex1, 'B') = 1 Then
hex1 := '11';
elsif instr(hex1, 'C') = 1 Then
hex1 := '12';
elsif instr(hex1, 'D') = 1 Then
hex1 := '13';
elsif instr(hex1, 'E') = 1 Then
hex1 := '14';
elsif instr(hex1, 'F') = 1 Then
hex1 := '15';
end if;
if instr(hex2, 'A') = 1 Then
hex2 := '10';
elsif instr(hex2, 'B') = 1 Then
hex2 := '11';
elsif instr(hex2, 'C') = 1 Then
hex2 := '12';
elsif instr(hex2, 'D') = 1 Then
hex2 := '13';
elsif instr(hex2, 'E') = 1 Then
hex2 := '14';
elsif instr(hex2, 'F') = 1 Then
hex2 := '15';
end if;
decimal_number := to_number(hex1) * 16 + to_number(hex2);
ascii_char := chr(decimal_number);
return_string := concat(return_string, ascii_char);
inhex_work := substr(inhex_work, 3);
if inhex_work is null then
return return_string;
exit;
end if;
hex1 := substr(inhex_work,1,1);
hex2 := substr(inhex_work,2,1);
end loop;
end;
---------------------------------------------------------------------------
На строне базы источника делаем View на интересующие нас таблицы, по
примеру:
-------------------------------------
create or replace view scott.temp2 as
select
rawtohex(empno) empno,
rawtohex(ename) ename
from SCOTT.EMP
---------------------------------------
для примера, меня интересуют два поля : empno и ename.
Основное что мы делаем, это rawtohex ( см. select rawtohex('моё_слово') from dual ).
Потом на стороне BW делаем DB_link и смортим на эту "view scott.temp2" .
SELECT hex_to_raw(empno), hex_to_raw(ename) FROM temp2@ORCLDWH ,
где ORCLDWH - имя DB_link, он же мой SID ( я занёс в scott.emane - русские буквы )
Всё - проблема закрыта.
Всем спасибо, сегодня я себя угощаю пивом
|
|