| 1 | = Oracle FdW = |
| 2 | |
| 3 | Deklaracja serwera |
| 4 | {{{ |
| 5 | CREATE extension oracle_fdw; |
| 6 | CREATE SERVER egeria FOREIGN DATA WRAPPER oracle_fdw OPTIONS (dbserver '//10.0.0.251/PROD'); |
| 7 | GRANT USAGE ON FOREIGN SERVER egeria TO http; |
| 8 | CREATE USER MAPPING FOR postgres SERVER egeria OPTIONS( user 'zre', password '*****'); |
| 9 | CREATE USER MAPPING FOR http SERVER egeria OPTIONS( user 'zre', password '*****'); |
| 10 | }}} |
| 11 | |
| 12 | Deklaracja tabel |
| 13 | {{{ |
| 14 | CREATE FOREIGN TABLE egeria_ek_pracownicy (PRC_ID integer, PRC_NUMER integer) SERVER egeria OPTIONS (table 'EK_PRACOWNICY'); |
| 15 | CREATE FOREIGN TABLE egeria_ekt_rcp ( RCP_ID integer,RCP_PRC_ID integer, RCP_DATA_WE varchar(50), RCP_RODZAJ_WE char(2), RCP_STANE_WE char(1), RCP_CZYTNIK_WE char(2), RCP_DATA_WY varchar(50) ) SERVER egeria OPTIONS (table 'EKT_RCP'); |
| 16 | }}} |
| 17 | |
| 18 | |
| 19 | i sam select |
| 20 | {{{ |
| 21 | SELECT egeria_ek_pracownicy.PRC_NUMER,egeria_ekt_rcp.RCP_DATA_WE::timestamp,egeria_ekt_rcp.RCP_DATA_WY::timestamp |
| 22 | FROM egeria_ekt_rcp inner join egeria_ek_pracownicy ON egeria_ek_pracownicy.PRC_ID=egeria_ekt_rcp.RCP_PRC_ID |
| 23 | WHERE egeria_ek_pracownicy.PRC_NUMER='5955' and egeria_ekt_rcp.RCP_DATA_WE::date = '2015-07-28'; |
| 24 | |
| 25 | }}} |