Oracle DBLinkµÄʹÓÃ
ÔÚ×öÓ¦ÓÃϵͳ¿ª·¢Ê±£¬ÎÒÃÇ»áÓöµ½Ò»¸öÎÊÌ⣬¾ÍÊÇÎÒÃÇÓ¦ÓÃϵͳÓÐЩÊý¾ÝÐèÒª´ÓÆäËûÊý¾Ý¿âµÄijһÕűíÄõ½Êý¾Ý£¬ÄÇÎÒÃÇÓ¦¸ÃÔõô°ì£¿±ÈÈ磺×Ó¹«Ë¾µÄÏúÊÛϵͳÐèÒª´Ó¹ãÖÝ×ܲ¿ÈËÁ¦×ÊÔ´¹ÜÀíϵͳµÄÊý¾Ý¿âµ±ÖлñÈ¡×îеÄÓû§ÐÅÏ¢£¬ÄÇÎÒÃÇÓ¦¸ÃÔõôʵÏÖ£¿ÊµÏÖÏÖÔÚµÄ×ö·¨Óкܶ࣬¿ÉÒÔͨ¹ýWebService·½Ê½»ñÈ¡£¬µ«¿ª·¢³É±¾»¹ÊDZȽϸߣ¬¼ÙÉ谲ȫ·½ÃæµÄÎÊÌâÒѾµÃµ½Á˺ܺõĽâ¾ö£¬ÎÒÃÇÖ»ÐèҪͨ¹ýÔ¶³ÌÊý¾Ý¿âËùÌṩµÄÓû§Ãû¸úÕʺŽøÐÐÊý¾ÝµÄ»ñÈ¡¾ÍÐÐÁË£¬²»ÐèÒª¿¼ÂÇÆäËû¸´ÔÓµÄÎÊÌ⣬ÄÇDBLinkÊÇÒ»¸ö²»´íµÄÑ¡Ôñ¡£Ê¹ÓÃDBLinkµÄ·½Ê½£¬¿ÉÒÔÏñ²Ù×÷±¾µØÊý¾Ý¿â±íÒ»Ñù£¬²Ù×÷Ô¶³ÌÊý¾Ý¿âµÄ±íÊý¾Ý¡£
Ê×ÏÈ£¬ÎÒÃÇÐèÒª´´½¨Ò»¸öDBLink£¬½«¹ãÖÝ×ܲ¿µÄÊý¾Ý¿âÓ³Éäµ½ÉϺ£·Ö¹«Ë¾Êý¾Ý¿â·þÎñÆ÷ÉÏ¡£
create database link hr_tables
connect to manbu
identified by "admin"
using 'WALK'
ÆäÖÐhr_tablesÊÇÔ¶³ÌÊý¾Ý¿âµÄÒ»¸ö±ðÃû
manbuÊÇÔ¶³ÌÊý¾Ý¿âµÄÊý¾Ý¿âÓû§Ãû
adminΪmanbuµÄÃÜÂë
WALKΪÊý¾Ý¿âÔÚ±¾µØÊý¾Ý¿âµÄSID
½Ó×Å£¬ÎÒÃÇ¿ÉÒÔ×öһϲâÊÔ£¬±ÈÈçÎÒÃÇÏëÄõ½Êý¾Ý¿âµÄijһÕűíÊý¾Ý£¬ÄÇÎÒÃÇ¿ÉÒÔÔÚÃüÃûÐÐÏÂ×öÈçϵIJâÊÔ£º
select user_name from mall_user@hr_tables;
ÿһÕÅ±í¶¼±ØÐë¼ÓÉÏ@hr_tables×Ö·û´®£¬±íʾ¸Ã±íÊÇdblinkËùÖ¸ÏòµÄÔ¶³ÌÊý¾Ý¿âµÄ±íµ¥
»òÕߣ¬Äã»á¾õµÃÕâÑù×ÓºÜÂé·³£¬ÄÇÎÒÃÇ¿ÉÒÔΪmall_user@hr_tablesÅäÖÃÒ»¸ö±ðÃû£¬ÄǾÍûÓиÄÐëÂé·³À²¡£
´´½¨mall_user@hr_tablesµÄͬÒå´Ê£¬Ò²¼´±ðÃû£º
create synonym mall_user for mall_user@hr_tables;
Ïà¹ØÎĵµ£º
OracleÈÕÆÚº¯Êýѧϰʱ£¬Ôڽ̳ÌÓм¸¸öʵÀýÈçÏ£º
Months_between(’01-sep-95’, ’11-jan-94’)
½á¹ûÊÇ£º19.6774194
Add_months ÔÚÖ¸¶¨µÄÔ·ÝÉÏÃæÔö¼ÓÏàÓ¦µÃÔ·Ý
ÀýÈ磺
Add_months(’11-jan-94’, 6)
½á¹ûÊÇ£º11-jul-94
Next_day ¼ÆËã¹æ¶¨ÈÕÆڵĺóÒ»¸öÌض¨ÈÕÆÚ
ÀýÈ磺
Next_ ......
PRAGMA RESTRICT_REFERENCES()£¬Õâ¸öPRAGMA±È½Ï¸´ÔÓ£¬ ×ܵÄÀ´Ëµ£¬ËüÊÇÒ»¸ö³ÌÐò¸¨Öú¼ìÑéÂ룬¼ì²é×Ó³ÌÐòµÄ´¿¶È£¨PURITY£©£¬°ïÖú¼ìÑé×Ó³ÌÐòÊÇ·ñÓÐÎ¥·´¹æÔòµÄµØ·½¡£Ò»°ãÓÃÔÚº¯ÊýÉÏ£¬µ«µ±º¯Êýµ÷Óùý³Ìʱ£¬Ò²Òª×÷ÏàÓ¦µÄÉèÖüì²é¡£ÕâÊÇΪÁ˱ÜÃâµ±ÔÚDMLÓï¾äÉϵ÷Óú¯ÊýʱÕý³£Ö´Ðв»ÖÁÓÚ²úÉú´íÎó¡£
Óï·¨£¬PRAGMA ......
BLOBµÄº¬Òå¡¡¡¡
BLOB (binary large object)£¬¶þ½øÖÆ´ó¶ÔÏó£¬ÊÇÒ»¸ö¿ÉÒÔ´æ´¢¶þ½øÖÆÎļþµÄÈÝÆ÷¡£
¡¡¡¡ÔÚ¼ÆËã»úÖУ¬BLOB³£³£ÊÇÊý¾Ý¿âÖÐÓÃÀ´´æ´¢¶þ½øÖÆÎļþµÄ×Ö¶ÎÀàÐÍ¡£
¡¡¡¡BLOBÊÇÒ»¸ö´óÎļþ£¬µäÐ͵ÄBLOBÊÇÒ»ÕÅͼƬ»òÒ»¸öÉùÒôÎļþ£¬ÓÉÓÚËüÃǵijߴ磬±ØÐëʹÓÃÌØÊâµÄ·½Ê½À´´¦Àí£¨ÀýÈ磺ÉÏ´«¡ ......
Ò»£ºÎÞ·µ»ØÖµµÄ´æ´¢¹ý³Ì
´æ´¢¹ý³ÌΪ£º
create or replace procedure adddept(deptno number,dname varchar2,loc varchar2)
as
begin
insert into dept values(deptno,dname,loc);
end;
È»ºóÄØ£¬ÔÚjavaÀïµ÷ÓÃʱ¾ÍÓÃÏÂÃæµÄ´úÂ룺
public class TestProcedure {
Connectio ......
oracleÊý¾Ý¿âµÄµ¼ÈëÓëµ¼³öÊÇ×öΪһÃûʵʩ¹¤³Ìʦ»òά»¤¹¤³Ìʦÿ¾³£Òª×öµÄ¹¤×÷¡£µ±Êý¾Ý¿â½á¹¹ÐèÒª×ö±ä»¯µÄʱºò£¬ÎÒÃÇÒ»°ãÏȽ«Êý¾Ý×ö±¸·Ý£¬´ËʱÎÒÃÇÐèҪʹÓõ½OracleµÄµ¼³ö¹¦ÄÜ¡£µ±ÎÒÃÇÔÚ×öµ¼ÈëµÄʱºò³ö´í»òÕßÎÒÃǵÄÊý¾ÝÔâµ½´íÎóɾ³ýµÄʱºò£¬ÎÒÃÇÐèÒª»Ö¸´Êý¾Ý¿â£¬ÄÇÎÒÃÇÐèҪʹÓõ½µ¼ÈëµÄ¹¦ÄÜ¡£ÏÖÔÚÒ²Óкܶ๦ÄÜÄܹ»°ïÎÒÃÇ×öµ½ ......