SQL/PLUS
4£®Êý¾ÝÀàÐÍת»»º¯Êý
¡ñÒþʽת»»
¸³ÖµÊ±¿É½øÐеÄÒþʽת»»ÓÐ
VARCHAR2»òCHAR —¡µNUMBER
VARCHAR2»òCHAR —¡µDATE
NUMBER —¡µVARCHAR2
DATE —¡µVARCHAR2
±í´ïʽÖпɽøÐеÄÒþʽת»»ÓÐ
VARCHAR2»òCHAR —¡µNUMBER
VARCHAR2»òCHAR —¡µDATE
¡ñÏÔʽת»»
TO_CHAR(number|date[,’fm___’])°´¸ñʽ°ÑÊý×Ö»òÈÕÆÚת»»³ÉVARCHAR2
TO_NUMBER(char)½«Êý×Ö×Ö·û´®×ª»¯³ÉÊý×Ö
TO_DATE(char[,’fm___’])°´¸ñʽ°Ñ×Ö·û´®×ª»»³ÉÈÕÆÚ
5£®³£¹æº¯Êý
¡ñNVL(expression1,expression2)£ºÈç¹ûexpression1ÖÐÓпÕÖµ´æÔÚ½«Ëüת»¯³É
expression2掙歜
¡ñDECODE(columnname|expression,search1,result1[,search2,result2,…][,default])
Èç¹ûexpressionµÄÖµµÈÓÚsearch1£¬ÔòÏÔʾresult1£¬·ñÔò¼ÌÐøÏòϲéÕÒ¡£Èç¹ûËùÓеÄ
search¶¼²»Âú×㣬ÏÔʾdefaultÖµ¡£
6£®Ìæ»»±äÁ¿
¡ñ&£ºÈç¹ûÔÚ±äÁ¿Ç°Ê¹ÓÃ&·ûºÅ£¬ÔÚÖ´ÐÐSELECTÓï¾äʱ£¬ÏµÍ³»áÌáʾÓû§Ìṩ¸Ã±äÁ¿µÄ
Öµ¹æÔò£º
1)Ìæ»»±äÁ¿µÄÀàÐÍÊÇ×Ö·û£¬±ØÐëÓÃÒýºÅÒýÆðÀ´
2)ϵͳ»áÏÔʾÌæ»»±äÁ¿±»Ìæ»»µÄ¹ý³Ì
¡ñ&&£ºÈç¹ûÐèÒªÖظ´Ê¹ÓÃijÌæ»»±äÁ¿µÄÖµ¶ø²»ÒªÇóÓû§¶à´Î¼üÈ룬¿ÉÒÔÔÚËüµÚÒ»´Î³öÏÖ
ʱʹÓÃ&&×Ö·û¡£
¡ñDEFINE£ºDEFINE variable*value£º´´½¨Ò»¸öCHARÀàÐͱäÁ¿²¢¸øÓè³õʼֵ
DEFINE variable£ºÏÔʾ±äÁ¿µÄÃû³Æ£¬ÖµºÍÀàÐÍ
DEFINE£ºÏÔʾËùÓÐÓû§¶¨ÒåµÄ±äÁ¿
UNDEFINE variable£ºÏû³ý±äÁ¿¶¨Òå
¡ñACCEPT£ºACCEPT variable [datatype][FORMAT format][PROMPT text][HIDE]
°´Ö¸¶¨¸ñʽ´´½¨Öƶ¨ÀàÐ͵ıäÁ¿£¬²¢Öƶ¨Óû§Ìáʾ£¬ÌáʾÓ
Ïà¹ØÎĵµ£º
Oracle µÄSQL*LOADER¿ÉÒÔ½«ÍⲿÊý¾Ý¼ÓÔص½Êý¾Ý¿â±íÖС£ÏÂÃæÊÇSQL*LOADERµÄ»ù±¾Ìص㣺
1£©ÄÜ×°È벻ͬÊý¾ÝÀàÐÍÎļþ¼°¶à¸öÊý¾ÝÎļþµÄÊý¾Ý
2£©¿É×°Èë¹Ì¶¨¸ñʽ£¬×ÔÓɶ¨½çÒÔ¼°¿É¶È³¤¸ñʽµÄÊý¾Ý
3£©¿ÉÒÔ×°Èë¶þ½øÖÆ£¬Ñ¹ËõÊ®½øÖÆÊý¾Ý
4£©Ò»´Î¿É¶Ô¶à¸ö±í×°ÈëÊý¾Ý
5£©Á¬½Ó¶à¸öÎïÀí¼Ç¼װµ½Ò»¸ö¼Ç¼ÖÐ
6£©¶ÔÒ»µ¥¼Ç¼·Ö½âÔÙ×°Èëµ½± ......
ÔÚËÑË÷Êý¾Ý¿âÖеÄÊý¾Ýʱ£¬SQL ͨÅä·û¿ÉÒÔÌæ´úÒ»¸ö»ò¶à¸ö×Ö·û¡£
SQL ͨÅä·û±ØÐëÓë LIKE ÔËËã·ûÒ»ÆðʹÓá£
ÔÚ SQL ÖУ¬¿ÉʹÓÃÒÔÏÂͨÅä·û£º
ͨÅä·ûÃèÊö
%
Ìæ´úÒ»¸ö»ò¶à¸ö×Ö·û
_
½öÌæ´úÒ»¸ö×Ö·û
[charlist]
×Ö·ûÁÐÖеÄÈκε¥Ò»×Ö·û
[^charlist]
»òÕß
[!charlist]
²»ÔÚ×Ö·ûÁÐÖеÄÈκε¥Ò»×Ö·û
ÔʼµÄ±í (ÓÃÔÚÀý×ÓÖ ......
´ó¼Ò´ò¿ªÕâ¸öÁ´½Ó¿ÉÒÔ¿´µ½ºÜ¶àÊý¾Ý¿âµÄÁ¬½Ó·½·¨¡£http://www.connectionstrings.com
ÕâЩÊý¾Ý¿âÖ®¼äµÄÊý¾Ý½»»»¾ÍÊÇÕâ¸öÌù×ÓËùÒª×ܽáµÄÄÚÈÝ¡£
£¨Ò»£©SQL ServerÖ®¼ä
°ÑÔ¶³ÌÊý¾Ý¿âÖеÄÊý¾Ýµ¼Èëµ½±¾µØÊý¾Ý¿â¡£
http://community.csdn.net/Expert/topic/5079/5079649.xml?temp=.7512018
http://community.csdn.net/Expert/ ......
SQLÊý¾Ý¿âÖÐÓÃimageÀ´´æ´¢Îļþ,µ«SQLûÓÐÌṩֱ½ÓµÄ´æÈ¡ÎļþµÄÃüÁî.
/*--bcp ʵÏÖ¶þ½øÖÆÎļþµÄµ¼Èëµ¼³ö
Ö§³Öimage,text,ntext×ֶεĵ¼Èë/µ¼³ö
imageÊʺÏÓÚ¶þ½øÖÆÎļþ,°üÀ¨:WordÎĵµ,ExcelÎĵµ,ͼƬ,ÒôÀÖµÈ
text,ntextÊʺÏÓÚÎı¾Êý¾ÝÎļþ
×¢Òâ:µ¼Èëʱ,½«¸²¸ÇÂú×ãÌõ¼þµÄËùÓÐÐÐ
µ¼³öʱ,½ ......
±È½ÏÁ½¸öSQLµÄÖ´ÐÐʱ¼ä
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PROC_SQL_COMP]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[PROC_SQL_COMP]
GO
/*--²âÊÔÁ½×éSQLµÄƽ¾ùʱ¼ä
ÀûÓÃosql.exeÀ´²âÊÔÁ½×é SQL Óï¾äµÄÖ´ÐÐʱ¼ä
²âÊԵĴ洢¹ý³ ......