Oracleϵͳº¯ÊýÖ®ÀàµÄ
×Ö·ûº¯Êý
ÏÂÃæÊÇOracleÖ§³ÖµÄ×Ö·ûº¯ÊýºÍËüÃǵÄMicrosoft SQL ServerµÈ¼Ûº¯Êý¡£
º¯Êý Oracle Microsoft SQL¡¡Server
°Ñ×Ö·ûת»»ÎªASCII :ASCII ASCII
×Ö´®Á¬½Ó: CONCAT --------------(expression + expression)
°ÑASCIIת»»Îª×Ö·û CHR, CHAR
·µ»Ø×Ö·û´®ÖеĿªÊ¼×Ö·û£¨×óÆ𣩠INSTR ,---------------CHARINDEX
°Ñ×Ö·ûת»»ÎªÐ¡Ð´ LOWER ---------------------LOWER
°Ñ×Ö·ûת»»Îª´óд UPPER-------------------- UPPER
Ìî³ä×Ö·û´®µÄ×ó±ß LPAD --------------------N/A
Çå³ý¿ªÊ¼µÄ¿Õ°× LTRIM--------------------LTRIM
Çå³ýβ²¿µÄ¿Õ°× RTRIM --------------------RTRIM
×Ö·û´®ÖеÄÆðʼģʽ£¨pattern£© INSTR --------------------PATINDEX
¶à´ÎÖظ´×Ö·û´® RPAD --------------------REPLICATE
×Ö·û´®µÄÓïÒô±íʾ SOUNDEX --------------------SOUNDEX
Öظ´¿Õ¸ñµÄ×Ö´® RPAD --------------------SPACE
´ÓÊý×ÖÊý¾Ýת»»Îª×Ö·ûÊý¾Ý TO_CHAR --------------------STR
×Ó´® SUBSTR --------------------SUBSTRING
Ìæ»»×Ö·û REPLACE --------------------STUFF
½«×Ö´®ÖеÄÿ¸ö´ÊÊ××Öĸ´óд INITCAP --------------------N/A
·Òë×Ö·û´® TRANSLATE --------------------N/A
×Ö·û´®³¤¶È LENGTH-------------------- DATELENGTH or LEN
ÁбíÖÐ×î´óµÄ×Ö·û´® GREATEST-------------------- N/A
ÁбíÖÐ×îСµÄ×Ö·û´® LEAST --------------------N/A
Èç¹ûΪNULLÔòת»»×Ö´® NVL-------------------- ISNULL
ÈÕÆÚº¯Êý
ÏÂÃæÊÇOracleÖ§³ÖµÄÈÕÆÚº¯ÊýºÍËüÃǵÄMicrosoft SQL ServerµÈ¼Ûº¯Êý¡£
º¯Êý Oracle --------------------Microsoft SQL¡¡Server
ÈÕÆÚÏà¼Ó (date column +/- value) or ADD_MONTHS --------------------DATEADD
Á½¸öÈÕÆڵIJî (date column +/- value) or MONTHS_BETWEEN --------------------DATEDIFF
µ±Ç°ÈÕÆÚºÍʱ¼ä SYSDATE --------------------GETDATE()
Ò»¸öÔµÄ×îºóÒ»Ìì LAST_DAY --------------------N/A
ʱÇøת»» NEW_TIME --------------------N/A
ÈÕÆÚºóµÄµÚÒ»¸öÖÜÈÕ NEXT_DAY --------------------N/A
´ú±íÈÕÆÚµÄ×Ö·û´® TO_CHAR --------------------DATENAME
´ú±íÈÕÆÚµÄÕûÊý TO_NUMBER (TO_CHAR)) --------------------DATEPART
ÈÕÆÚÉáÈë ROUND --------------------CONVERT
ÈÕÆÚ½Ø¶Ï TRUNC --------------------CONVERT
×Ö·û´®×ª»»ÎªÈÕÆÚ TO_DATE ------------------
Ïà¹ØÎĵµ£º
1)ÔÚdelphiÖÐ,¾³£ÓÐÈËдSQL²¢´«Èëµ½Êý¾Ý¿âÖÐÖ´ÐÐ,Ò»°ã¶¼ÊÇ°ÑsqlÆ´³öÀ´,ÈçÏÂ:
sSql := 'select * from ContainerStateH where container like '+QuotedStr('%'+trim(Edit2.Text)+'%') +' order by BeginDay';
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add(sSql);
ADOQuery1.Open;
µ«ÊÇ´ÓoracleÊý¾Ý¿â½Ç¶È¿¼Â ......
ÔÚ¶ÔÊý¾Ý¿â½øÐвÙ×÷¹ý³ÌÖÐÎÒÃÇ¿ÉÄÜ»áÓöµ½ÕâÖÖÇé¿ö£¬±íÖеÄÊý¾Ý¿ÉÄÜÖظ´³öÏÖ£¬Ê¹ÎÒÃǶÔÊý¾Ý¿âµÄ²Ù×÷¹ý³ÌÖдøÀ´ºÜ¶àµÄ²»±ã£¬ÄÇôÔõôɾ³ýÕâЩÖظ´Ã»ÓÐÓõÄÊý¾ÝÄØ?
¡¡¡¡Öظ´Êý¾Ýɾ³ý¼¼Êõ¿ÉÒÔÌṩ¸ü´óµÄ±¸·ÝÈÝÁ¿£¬ÊµÏÖ¸ü³¤Ê±¼äµÄÊý¾Ý±£Áô£¬»¹ÄÜʵÏÖ±¸·ÝÊý¾ÝµÄ³ÖÐøÑéÖ¤£¬Ìá¸ßÊý¾Ý»Ö¸´·þÎñˮƽ£¬·½±ãʵÏÖÊý¾ÝÈÝÔֵȡ£ Öظ´µÄÊý¾ ......
Q£ºÎҵıíÖÐÓÐÒ»¸ö×Ö¶ÎÊÇvarchar2(4000) £¬ÆäÖд洢Á˲»ÉÙÖÐÎÄ£¬ÏÖÔÚÓÉÓÚÅÅ°æÐèÒª£¬ÎÒÏëÕÒ³öº¬Óлسµ·ûµÄ¼Ç¼ɾ³ý»Ø³µ·û£¬ÇëÎʸßÊÖSQLÓï·¨Ôõôд£¿
A£ºOracleÖлسµ·ûÊÇchr(10),¿ÉÒÔʹÓú¯Êýreplace(×Ö¶Î,chr(10),'')
È磺 update x set a=replace(a,chr(10),'')¡£
º¯Êý£º
1.CHR
¸ø³öÕûÊ ......
ÔÚOracle¹ØÓÚʱ¼äÊôÐԵĽ¨±í
Example:
create table courses(
cid varchar(20) not null primary key,
cname varchar(20) not null,
ctype integer,
ctime date DEFAULT SYSDATE,
cscore float not null
)
insert into courses values('ss01','java',0,TO_DATE('2009-8-28','yyyy-mm-dd'),94)
insert into course ......