PL/SQL Developer ʹÓü¼ÇÉС½á
ÒÔϵļ¼ÇÉÖ»Õë¶ÔPL/SQL Developer 6ÒÔÉÏ°æ±¾£¬°æ±¾5Ö»ÓÐÆäÖеIJ¿·ÖÌØÐÔ¡£
1£¬ÓÒ¼ü²Ëµ¥
ÔÚPL/SQL Developer£¨ÏÂÃæ¼ò³ÆPLD£©ÖеÄÿһ¸öÎı¾±à¼´°¿Ú£¬ÈçSQL Window£¬Command WindowºÍPorgram Window£¬ÓÒ¼üµã»÷ij¸ö¶ÔÏóÃû³Æ£¬»áµ¯³öÒ»¸ö°üº¬²Ù×÷¶ÔÏóÃüÁîµÄ²Ëµ¥£¬ÎÒÃÇÕâÀï³Æ֮ΪÓÒ¼ü²Ëµ¥¡£ÈçÏÂͼ£º
¶ÔÏóÀàÐÍ¿ÉÒÔÊÇ±í£¬ÊÓͼ£¬Í¬Òå´Ê£¬´æ´¢¹ý³ÌºÍº¯ÊýµÈ¡£¸ù¾Ý¶ÔÏóÀàÐ͵IJ»Í¬£¬µ¯³öµÄ²Ëµ¥Ò²ÓÐÇø±ð¡£±íºÍÊÓͼÓÐView, Edit, Rename, Drop, Query data ºÍEdit dataµÈ¹¦ÄÜ¡£ViewºÍEdit·Ö±ðÊDz鿴ºÍÐ޸ıíµÄ½á¹¹ÐÅÏ¢£¬Èç×ֶΣ¬Ö÷¼ü£¬Ë÷ÒýºÍÔ¼ÊøµÈ¡£Query dataÏ൱ÓÚдò¿ªÒ»¸ö´°¿Ú£¬²¢Ö´ÐÐselect * from ±í¡£Edit dataÏ൱ÓÚдò¿ªÒ»¸ö´°¿Ú£¬²¢Ö´ÐÐselect * from ±í for update¡£´æ´¢¹ý³ÌºÍº¯ÊýÓÐTest¹¦ÄÜ£¬Ñ¡Öкó¿ÉÒÔ½øÈëµ÷ÊÔ״̬¡£
ÓÐʱÓÉÓÚPLDʶ±ð´íÎó£¬ÓÒ¼üµã»÷¶ÔÏó²¢²»ÄܳöÀ´ÕýÈ·µÄ²Ëµ¥£¬¿ÉÒÔÔÚ¶ÔÏóËùÔÚµÄDDL»òDMLÓï¾äµÄÇ°Ã棬¼ÓÉϷֺţ¬ÕâÑùPLD¾ÍÄÜÕýÈ·µÄÅжϳö¶ÔÏóµÄÀàÐÍ
2£¬Select for Update
ÓÐʱÎÒÃÇÐèÒª°ÑһЩÊý¾Ýµ¼ÈëÊý¾Ý¿âÖУ¬Èç¹ûÓÃUEÆ´InsertÓï¾ä£¬»á±È½ÏÂé·³£¬¶øÇÒ²Ù×÷ÐÔ²»Ç¿¡£PLDµÄSQL Window¿ÉÒÔ²éѯ£¬ÐÂÔö£¬Ð޸ĺÍɾ³ý±íµÄÄÚÈÝ¡£²éѯ×Ô²»±Ø˵£¬¶øÐÂÔö£¬É¾³ýºÍÐ޸ģ¬Ö»ÐèÔÚselectÓï¾äºó¼ÓÈëfor update£¬¶Ô±í½øÐÐÐм¶Ëø¶¨£¬È»ºóµã»÷´°¿ÚµÄËøÐÍͼ±ê£¬¼´¿É½øÈë±à¼×´Ì¬¡£
ÏÂÃæ½éÉÜÒ»ÏÂÈçºÎ´ÓExcelÖÐÌáÈ¡Îı¾²åÈëµ½Êý¾Ý¿âÖÐ
ÎÒÃǵÄExcelÎļþÖÐÓÐÈýÁУº
ÔÚÊý¾Ý¿âÖн¨Á¢ÁÙʱ±í£º
create table t1 (cino varchar2(100), contno varchar2(100), loanno varchar2(100))
È»ºóÔÚSQL WindowÖÐÊäÈëselect t1 for update£¬²¢µã»÷ËøÐÍÊó±ê£¬½øÈë±à¼×´Ì¬£º
ÓÃÊó±êµã»÷µÚÒ»ÐеÄÊäÈë´°¿Ú£¬ÕâʱPLD»áËÀËø¼¸ÃëÖÓ£¬È»ºó¿ÉÒÔ¼ûµ½¹â±êÔÚµÚÒ»ÐеÄÊäÈë¿òÖÐÉÁ¶¯£¬ÓÃÊó±ê°ÑCINO, CONTNO, LOANNOÑ¡ÖУº
½øÈëExcelÖУ¬°ÑÐèÒª²åÈëÊý¾Ý¿âµÄÄÚÈÝÑ¡ÖУ¬È»ºóÇл»µ½PLD£¬°´Ctrl + V£º
µã»÷√£¬È»ºóÔÙµã»÷Commit°´Å¥£¬ÔòÊý¾ÝÌá½»µ½±ít1ÖУ¬Ö´ÐÐselect * from t1¿ÉÒÔ¿´µ½ÄÚÈÝ£º
3£¬PL/SQL Beautifier
PLD 6ÒÔÉÏ°æ±¾ÓжÔDML´úÂë¸ñʽ»¯µÄ¹¦ÄÜ¡£ÔÚSQL Window»òProgram WindowÖÐÑ¡Öв¿·Ö´úÂ루Èç¹û²»Ñ¡Ôò¶ÔÕû¸ö´°¿ÚµÄ´úÂë²Ù×÷£©£¬Ôڲ˵¥ÖÐÑ¡Edit à PL/SQL Beautifier£¬µÃµ½¸ñʽ»¯µÄ´úÂë¡£¶ÔÓÚ·Ç·¨µÄDMLÓï¾ä»òDDLÓï¾ä£¬PLD½«»áÔÚÏ·½×´Ì¬À¸ÌáʾPL/SQL Beautifier could not parse text¡£
ÔÚȱʡµÄ״̬Ï£¬PLD»á°ÑDMLÓï¾äµÄÿһ¸ö×ֶζ¼ÅÅÔÚµ¥¶ÀµÄÒ»ÐУ¬ÕâÑù
Ïà¹ØÎĵµ£º
Êý¾Ý×Öµädict×ÜÊÇÊôÓÚOracleÓû§sysµÄ¡£
¡¡¡¡1¡¢Óû§£º
¡¡¡¡¡¡select username from dba_users;
¡¡¡¡¸Ä¿ÚÁî
¡¡¡¡¡¡alter user spgroup identified by spgtest;
¡¡¡¡2¡¢±í¿Õ¼ä£º
¡¡¡¡¡¡select * from dba_data_files;
¡¡¡¡¡¡select * from dba_tablespaces;//±í¿Õ¼ä
¡¡¡¡¡¡select tablespace_name,sum(bytes), sum(b ......
Ò»¡¢»ù´¡
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE DATABASE database-name
2¡¢ËµÃ÷£ºÉ¾³ýÊý¾Ý¿â
drop database dbname
3¡¢ËµÃ÷£º±¸·Ýsql server
--- ´´½¨ ±¸·ÝÊý¾ÝµÄ device
USE master
EXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssql7backup\MyNwind_1.dat'
--- ¿ªÊ¼ ±¸·Ý
BACKUP DATABASE pubs TO testBack
4¡¢Ëµ ......
Êý¾Ý¿âÖ´ÐÐexec sp_renamedb 'oldname','newname'Óï¾ä£¬ÖØÃüÃûºó£¬½«Êý¾Ý¿â±¸·ÝÎļþ»¹Ôʱ£¬»á³öÏÖ´íÎó£¬Èçͼ
ÒòÊýÊý¾ÝÎļþÓëÊý¾Ý¿âÃû³Æ²»Ò»Ö¡£
½â¾ö·½·¨£º¿ÉÒÔÕÒµ½Êý¾ÝÎļþµÄÃû³Æ£¬½«Êý¾Ý¿â»¹ÔÃû³Æ¸úÊý¾Ý¿âÎļþÒ»ÖµÄÃû³Æ£¬´Ëʱ»¹Ô³É¹¦ºó£¬ÔÙÐÞ¸ÄÊý¾Ý¿âµÄÃû³Æ¡£
×¢£ºÊý¾Ý¿âÖØÃüʱ£¬Ð轫SQL·þÎñÆ÷Í£Ö¹£¬ÖØÃüÃûºóÔÙÖØÐ ......
'ÔÚÒýÓÃÀïÌí¼ÓADODB
Public vscn As ADODB.Connection
Public SQLString As String
SQLString = "Provider=SQLOLEDB.1;Password=ÃÜÂë;Persist Security Info=True;User ID=ÓÃ" & _
"»§;Initial Catalog=Êý¾Ý¿âÃû;Data Source=·þÎñÆ÷Ãû"
  ......
ÔÚSQL Server2005ÖÐÓÐFOR XML Ó÷¨£¬¿ÉÒÔ½²Ò»¸ö±í×÷Ϊһ¸ö×ֶΡ£
ÎÒµÄÉè¼ÆÏë·¨Ö÷ÒªÊÇÓÃÔÚ1¶Ô¶àµÄ¹ØϵÖбí¶ÁÈ¡µÄÎÊÌâ¡£
±íA ±íB
ÔÚAÖÐÓÐÒ»Ìõ¼Ç¼¶øÔÚBÖÐÓжàÌõ¼Ç¼¿ÉÒÔ²ÎÕÕÏÂÃæµÄд·¨£º£¨ÎÒµÄÏîÄ¿ÖÐÓõ½µÄ£¬ÐÞ¸ÄÁË×Ö¶ÎÖ÷ÒªÊÇÑÝʾÓã©
select A.*,
(SELECT a, CAST(G_Univalence AS NVARCHAR(48)) AS G_Univa ......