Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

oracleÖе¥¼Ç¼º¯ÊýµÄ¹éÄÉ×ܽá

 SQLÖеĵ¥¼Ç¼º¯Êý
Ò»¡¢×Ö·ûº¯Êý
 
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 C
-- -
ÕÔ A
3.CONCAT
Á¬½ÓÁ½¸ö×Ö·û´®;
SQL> select concat(’010-’,’88888888’)||’ת23’ ¸ßǬ¾ºµç»° from dual;
¸ßǬ¾ºµç»°
----------------
010-88888888ת23
4.INITCAP
·µ»Ø×Ö·û´®²¢½«×Ö·û´®µÄµÚÒ»¸ö×Öĸ±äΪ´óд;
SQL> select initcap(’smith’) upp from dual;
UPP
-----
Smith
5.INSTR(C1,C2,I,J)
ÔÚÒ»¸ö×Ö·û´®ÖÐËÑË÷Ö¸¶¨µÄ×Ö·û,·µ»Ø·¢ÏÖÖ¸¶¨µÄ×Ö·ûµÄλÖÃ;
C1 ±»ËÑË÷µÄ×Ö·û´®
C2 Ï£ÍûËÑË÷µÄ×Ö·û´®
I ËÑË÷µÄ¿ªÊ¼Î»ÖÃ,ĬÈÏΪ1
J ³öÏÖµÄλÖÃ,ĬÈÏΪ1
SQL> select instr(’oracle traning’,’ra’,1,2) instring from dual;
INSTRING
---------
9
6.LENGTH
·µ»Ø×Ö·û´®µÄ³¤¶È;
SQL> select name,length(name),addr,length(addr),sal,length(to_char(sal)) from gao.nchar_tst;
NAME LENGTH(NAME) ADDR LENGTH(ADDR) SAL LENGTH(TO_CHAR(SAL))
------ ------------ ---------------- ------------ --------- --------------------
¸ßǬ¾º 3 ±±¾©Êк£¶§Çø 6 9999.99 7
7.LOWER
·µ»Ø×Ö·û´®,²¢½«ËùÓеÄ×Ö·ûСд
SQL> select lower(’AaBbCcDd’)AaBbCcDd from dual;
AABBCCDD
--------
aabbccdd
8.UPPER
·µ»Ø×Ö·û´®,²¢½«ËùÓеÄ×Ö·û´óд
SQL> select upper(’AaBbCcDd’) upper from dual;
UPPER
--------
AABBCCDD
9.RPADºÍLPAD(Õ³Ìù×Ö·û)
RPAD ÔÚÁеÄÓÒ±ßÕ³Ìù×Ö·û
LPAD ÔÚÁеÄ×ó±ßÕ³Ìù×Ö·û
SQL> select lpad(rpad(’gao’,10,’*’),17,’*’)from dual;
LPAD(RPAD(’GAO’,1
-----------------
*******gao*******
²»¹»×Ö·ûÔòÓÃ*À´ÌîÂú
10.LTRIMºÍRTRIM
LTRIM ɾ³ý×ó±ß³öÏÖµÄ×Ö·û´®
RTRIM ɾ³ýÓұ߳öÏÖµÄ×Ö·û´®
SQL> select ltrim(rtrim(’ ga


Ïà¹ØÎĵµ£º

Oracle³£ÓÃSQLÓï¾ä(PL/SQL developer¹¤¾ßϵÄ)

 ½¨±í
create table users(
id number(4) primary key,
username varchar2(10),
password varchar2(10)
)
²éѯ±í²¢½âËø±í(¼´¿ÉÒÔµã»÷ÊäÈë¿òÏÂÃæµÄ"Ëø"ͼ±ê¹¤¾ß, ¼´"Edit data")
select * from users for update
ɾ³ý±íÖжàÓàµÄÁÐ
alter table mobilephone drop column mobiletype
תÔØ
------------------- ......

Oracle 11g R2ÐÂÌØÐÔ¸ÅÊö£¨×ª£©

 µ¼¶Á£º
¡¡¡¡2009Äê9ÔÂOracle¹«Ë¾·¢²¼ÁËÆÚ´ýÒѾõÄOracle 11g R2£¬±¾ÏµÁÐÎÄÕ½«¸ø¶ÁÕßÒ»Ò»½Ò¿ªÐ°汾ÖеÄÐÂÌØÐÔ£¬²¢»á½éÉÜÆóÒµÈçºÎÀûÓÃÕâЩÐÂÌØÐÔ½«ÏÖÓеÄOracle 9i£¬10g£¬11g R1Éý¼¶µ½Oracle 11g R2.
¡¡¡¡¾­ÀúÁËÄÑÒÔÈÌÊܵij¤Ê±¼äµÈ´ý£¬Oracle¹«Ë¾Í»È»ÔÚ9ÔÂ1·¢²¼ÁËOracle 11g R2£¬ÎÒ²»µÃ²»³ÐÈÏOracleµÄ±£Ãܹ¤×÷×öµÃ ......

Oracle±¸·Ý¹ÜÀí ÌåÑé°æ

Oracle±¸·Ý¹ÜÀí
×î¼òµ¥µÄOracle Âß¼­±¸·ÝÈí¼þ£¬Ç¿´óµÄ¼Æ»®±¸·Ý¼°ÈßÓ౸·Ý¹¦ÄÜ
Èí¼þÌØÉ«£º
1.ÂéȸËäС£¬ÎåÔà¾ãÈ«¡£±¾×ÅʵÓõĽǶȿª·¢Õâ¸öÈí¼þ£¬Í¬Ê±¼æ¹Ë½çÃæÓ빦ÄÜ
2.ÖÇÄÜ»¯±¸·Ý¹¦ÄÜ£¬µ÷ÓÃOracle µÄexp±¸·Ý¹¦ÄÜ£¬ÖÇÄܼì²â±¸·Ý²ÎÊý
3.ÖÇÄÜѹËõ±¸·ÝÎļþ£¬²»Óõ£Ðı¸·ÝÊý¾Ý¹ý´ó¶øÓ²Å̳ÔÁ¦
4.¼°Æä¼òµ¥µÄ²Ù×÷½çÃ棬¼¸·ÖÖÓ¼ ......

oracle ±Ê¼Ç II Ö®DML:Êý¾Ý²Ù×÷ÓïÑÔ

 DML:Data Manipulation Language Êý¾Ý²Ù×÷ÓïÑÔ
°üÀ¨£ºCRUD
1. insertÓï¾ä
(1) ´ÓÆäËü±íÖи´ÖÆÊý¾Ý,ʵÏÖ·½·¨:ÔÚinsert Óï¾äÖмÓÈë²éѯÓï¾ä
insert into sales_reps(id,name,salary,commission_pct)  select employee_id,last_name,salary,commission_pct
from employees where job_id like '%rep';
(2) up ......

OracleÖÐdateÐÍÊý¾Ý¼ìË÷

 
ÓÃdateÐÍ×ֶνøÐÐÊý¾Ý¼ìË÷ʱÐèҪעÒ⣺Êý¾Ý¸ñʽ»¯£¡
´ËÊý¾Ý¸ñʽ»¯²»Í¬ÓÚÓÃSimpleDateFormat("yyyy-MM-dd")¶ÔÏó½øÐиñʽ»¯£¬¶øÊÇÓÃOracleµÄÄÚÖú¯Êýto_date()
»ò±êʶ·ûdateÀ´¸ñʽ»¯¡£
ÀýÈ磺
        Óиö×Ö¶ÎÊÇdateÊý¾Ý£¬ÎÒÏë²éѯijijÄê¶ÈµÄÊý¾Ý¡£
´íÎóд·¨£ºs ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ