Oracle SQLÓï¾ä²Ù×÷Êý×Ö£ºÈ¡Õû¡¢ËÄÉáÎåÈë¼°¸ñʽ»¯
http://cheneyph.javaeye.com/blog/453492
ÓÃoracle sql¶ÔÊý×Ö½øÐвÙ×÷: È¡ÉÏÈ¡Õû¡¢ÏòÏÂÈ¡Õû¡¢±£ÁôNλСÊý¡¢ËÄÉáÎåÈë¡¢Êý×Ö¸ñʽ»¯
È¡Õû£¨ÏòÏÂÈ¡Õû£©£º
select floor(5.534) from dual;
select trunc(5.534) from dual;
ÉÏÃæÁ½ÖÖÓ÷¨¶¼¿ÉÒÔ¶ÔÊý×Ö5.534ÏòÏÂÈ¡Õû£¬½á¹ûΪ5.
Èç¹ûÒªÏòÉÏÈ¡Õû £¬µÃµ½½á¹ûΪ6£¬ÔòÓ¦¸ÃÓÃceil
select ceil(5.534) from dual;
ËÄÉáÎåÈ룺
SELECT round(5.534) from dual;
SELECT round(5.534,0) from dual;
SELECT round(5.534,1) from dual;
SELECT round(5.534,2) from dual;
½á¹û·Ö±ðΪ 6, 6, 5.5, 5.53
±£ÁôNλСÊý£¨²»ËÄÉáÎåÈ룩£º
select trunc(5.534,0) from dual;
select trunc(5.534,1) from dual;
select trunc(5.534,2) from dual;
½á¹û·Ö±ðÊÇ 5,5.5,5.53£¬ÆäÖб£Áô0λСÊý¾ÍÏ൱ÓÚÖ±½ÓÈ¡ÕûÁË¡£
Êý×Ö¸ñʽ»¯£º
select to_char(12345.123,'99999999.9999') from dual;
½á¹ûΪ12345.123
select to_char(12345.123,'99999999.9900') from dual;
СÊýºóµÚÈýµÚËÄΪ²»×ã²¹0£¬½á¹ûΪ12345.1230
select to_char(0.123,'99999999.9900') from dual;
select to_char(0.123,'99999990.9900') from dual;
½á¹û·Ö±ðΪ .123, 0.123
Ïà¹ØÎĵµ£º
1. ASCII
·µ»ØÓëÖ¸¶¨µÄ×Ö·û¶ÔÓ¦µÄÊ®½øÖÆÊý;
SQL> select ascii(A) A,ascii(a) a,ascii(0) zero,ascii( ) space from dual;
A A ZERO SPACE
--------- --------- --------- ---------
65 97 48 32
2. CHR
¸ø³öÕûÊý,·µ»Ø¶ÔÓ¦µÄ×Ö·û;
SQL> select chr(54740) zhao,chr(65) chr65 from dual;
ZH ......
procedure Tform1.Button5Click(Sender: TObject);
var
p:pointer;
FrfStr:string;
begin
inherited;
Screen.Cursor:=MYCURSORWAITHAND;
with cdsPrint do
begin
Active:=false;
//Õâ¸öSQLÓÃÓÚ½«remarkÖеļǼºÏ²¢µ½Ò»Æ ......
YearCode:=yearof(Date);
MonthCode:=monthof(Date);
if MonthCode>9 then
FTime1:=inttostr(YearCode)+inttostr(MonthCode)
else
&nb ......
ÓйØSQLÖÐÂß¼²éѯ´¦ÀíµÄ¸÷¸ö½×¶Î£¨×Ô¼º¸ãµÄÀý×Ó£¬²»¶ÔµÄ»¶ÓÖ¸ÕýŶ£©
SQL²»Í¬ÓÚÆäËûµÄ±à³ÌÓïÑÔµÄ×î´ó×î´óÌØÕ÷ÓÐ3¸ö°É£¬
Ò»¸öÊÇËüÊÇÃæÏò¼¯ºÏµÄ±à³Ì˼Ï룬µÚ¶þ¸öÊÇÈýÖµÂß¼£¨Õâ¸öºóÃæ»á˵µ½£©£¬»¹ÓÐÒ»¸ö¾ÍÊǽñÌìÖ÷ҪҪ˵µÄ²éÑ¯ÔªËØµÄÂß¼´¦Àí´ÎÐò¡£
Çë¿´Ò»¸ö»ù±¾²éѯµÄÂß¼¹ý³Ì£º
(8) SELECT (9) DISTINCT ( ......