PL/SQLÁ¬½ÓOracle(Ãâ°²×°oracle¿Í»§¶Ë)
´ó¼Ò¶¼ÖªµÀ£¬ÓÃPL/SQLÁ¬½ÓOracle£¬ÊÇÐèÒª°²×°Oracle¿Í»§¶ËÈí¼þµÄ¡£ÓÐûҪÏë¹ý²»°²×°Oracle¿Í»§¶ËÖ±½ÓÁ¬½ÓOracleÄØ£¿
ÆäʵÎÒÒ»Ö±ÏëÕâÑù×ö£¬ÒòΪÕâ¸ö¿Í»§¶ËʵÔÚÌ«ÈÃÈËÌÖÑáÁË£¡£¡£¡²»µ«»á°²×°Ò»¸öJDK£¬¶øÇÒ»¹»á°Ñ×Ô¼º·ÅÔÚ»·¾³±äÁ¿µÄ×îÇ°Ã棬»áÔì³É²»Ð¡µÄÂé·³¡£
ÆäʵÎÒ֮ǰÎʹýºÜ¶àÈ˵ģ¬µ«ÊÇËûÃǶ¼ËµÒ»¶¨ÐèÒª°²×°Oracle¿Í»§¶ËµÄ.......Ö±µ½×òÌìÎÞÒâÖз¢ÏÖÁËÒÔÏÂÕâ¸ö·½·¨£º
Ö»ÐèÒªÔÚOracleÏÂÔØÒ»¸ö½ÐInstant Client PackageµÄÈí¼þ¾Í¿ÉÒÔÁË£¬Õâ¸öÈí¼þ²»ÐèÒª°²×°£¬Ö»Òª½âѹ¾Í¿ÉÒÔÓÃÁË£¬ºÜ·½±ã£¬¾ÍËãÖØ×°ÁËϵͳ»¹ÊÇ¿ÉÒÔÓõġ£
ÏÂÔصØÖ·£ºhttp://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html
ÏÂÔØÕâ¸ö£¬Instant Client Package - Basic°ü¡£È»ºó½âѹµ½ÈÎÒâĿ¼£¬ÔÚÕâ¸öĿ¼Ï½¨Á¢NETWORKÎļþ¼Ð£¬½Ó×ÅÔÙÕâ¸öÎļþ¼ÐÏÂÔÙ½¨Á¢ADMINÎļþ¼Ð£¬È»ºó½¨Á¢tnsnames.oraÎļþ£¬ÄÚÈÝÈçÏ£º
oracledata =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = yourhostIp )(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = yourSID )
)
)
ÕâÀï¸ù¾Ý×Ô¼ºµÄʵ¼ÊÇé¿öÅäÖ᣽Ó×Å´ò¿ªPL/SQL£¬ÔÚperferenceÀïÃæÉèÖÃOCI LibraryºÍOracle_home£¬ÎÒµÄÉèÖÃÊÇOCI Library=c:\oracleclient\oci.dll,Oracle_home=c:\oracleclient¡£
¸ù¾Ý×Ô¼ºµÄʵ¼ÊÇé¿öÅäÖã¬Æäʵ¾ÍÊǸղÅÏÂÔØÏ
Ïà¹ØÎĵµ£º
ÏÂÃæÊÇSql Server ºÍ Access ²Ù×÷Êý¾Ý¿â½á¹¹µÄ³£ÓÃSql£¬Ï£Íû¶ÔÄãÓÐËù°ïÖú¡£
н¨±í£º
create table [±íÃû]
(
[×Ô¶¯±àºÅ×Ö¶Î] int IDENTITY (1,1) PRIMARY KEY ,
[×Ö¶Î1] nVarChar(50) default \'ĬÈÏÖµ\' null ,
[×Ö¶Î2] ntext null ,
[×Ö¶Î3] datetime,
[×Ö¶Î4] money null ,
[×Ö¶Î5] int default 0,
[×Ö¶Î6] De ......
[SQL SERVER] ¿ç·þÎñÆ÷²éѯ
[SQL SERVER] ¿ç·þÎñÆ÷²éѯ
·½·¨Ò»:
ÓÃOPENDATASOURCE
ÏÂÃæÊǸö¿çSQLServer²éѯµÄʾÀý
Select TableA.*,TableB.* from OPENDATASOURCE(
'SQLOLEDB',
'Data Source=ServerA;User ID ......
sql Á½±í¹ØÁª ¸üÐÂ
update set from Óï¾ä¸ñʽ
SybaseºÍSQL SERVER£ºUPDATE...SET...from...WHERE...µÄÓï·¨£¬Êµ¼ÊÉÏ´ÓÔ´±í»ñÈ¡¸üÐÂÊý¾Ý¡£
ÔÚ SQL ÖУº
Update A SET A.dept =B.name
from A LEFT JOIN B ON B.ID=A.dept_ID ......
Ö±½ÓÔÚSQL²éѯ·ÖÎöÆ÷ÖжÁÈ¡EXCELÎļþÐèҪʹÓõ½OPENDATASOURCE¡£
µ«ÊÇʹÓÃËü֮ǰÐèÒª½øÐÐÅäÖÃһϡ£¼ÇµÃÈçÏÂÅäÖÃÊDZØÐëµÄ£º
1¡¢Ö´ÐÐÕâÁ½¸ö´æ´¢¹ý³Ì£º
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
ËüµÄ×÷Óãº
µÚÒ»¸öÊÇ£ºÊÇ·ñÖ§³Ö¸ß¼¶Ñ¡ ......
sqlµ¼³öµ½Excel
´ÓExcelÎļþÖÐ,µ¼ÈëÊý¾Ýµ½SQLÊý¾Ý¿âÖÐ,ºÜ¼òµ¥,Ö±½ÓÓÃÏÂÃæµÄÓï¾ä:
/*===================================================================*/
--Èç¹û½ÓÊÜÊý¾Ýµ¼ÈëµÄ±íÒѾ´æÔÚ
insert into ±í select * from
OPENROWSET('MICROSOFT.JET.OLEDB.4.0'
,'Excel 5.0;HDR=YES;DATABASE=c:\test.xls',sheet1 ......