oracleÖÐʵÏÖÖ÷¼ü×Ô¶¯Éú³É
IDÊÇÖ÷½¡£¬ÊµÏÖ²åÈëÒ»¸öNAME,ID×Ô¶¯Ôö¼Ó
SQL> create table t1
2 (
3 id number,
4 name varchar2(10)
5 )
6 ;
SQL> create sequence T1ID_SEQ
2 minvalue 1
3 maxvalue 999999
4 start with 1
5 increment by 1
6 cache 20
7 ;
´´½¨´¥·¢Æ÷
sql> create or replace trigger tr
before insert on table for each row
begin
select to_char(seq.nextval) into :new.id form dual;
end tr;
/
Ïà¹ØÎĵµ£º
Ò»¡¢×¼±¸ÌØÊâÊý¾Ý
create table t_escape(s varchar2(50));
--show define -- define "&" (hex 26)
--show escape -- escape off
set define off
set escape on
insert into t_escape values('string&text');
insert into t_escape values('string\&text');
insert into t_escape values('st ......
1.ÔÚOracle ÖУ¬Äã»áÁ˽⵽£º
ÊÂÎñÊÇÿ¸öÊý¾Ý¿âµÄºËÐÄ£¬ËüÃÇÊÇ“ºÃ¶«Î÷”¡£
Ó¦¸ÃÑÓ³Ùµ½Êʵ±µÄʱ¿Ì²ÅÌá½»¡£²»ÒªÌ«¿ìÌá½»£¬ÒÔ±ÜÃâ¶Ôϵͳ´øÀ´Ñ¹Á¦¡£ÕâÊÇÒòΪ£¬Èç¹û
ÊÂÎñºÜ³¤»òºÜ´ó£¬Ò»°ã²»»á¶ÔϵͳÓÐѹÁ¦¡£ÏàÓ¦µÄÔÔòÊÇ£ºÔÚ±ØÒªÊ±²ÅÌá½»£¬µ«ÊÇ´Ëǰ²»ÒªÌá
½»¡£ÊÂÎñµÄ´óСֻӦ¸Ã¸ù¾ÝÒµÎñÂß¼À´¶¨¡£
Ö»ÒªÐèÒ ......
1.Çó²¿ÃÅÖÐÄÄЩÈËнˮ×î¸ß£º
select ename,sal
from emp join
(
select max(sal) max_sal, deptno
from emp
group by deptno
) t
on (emp.sal = t.max_sal and emp.deptno = t.deptno);
2.Çó²¿ÃÅÆ½¾ùнˮµÄµÈ¼¶£º
select deptno, avg_sal, grade ......
001¡¢×Ö·û
length/lengthb ×Ö·ûÊý(1¸öºº×Ö1¸ö×Ö·û) / ×Ö½ÚÊý(1¸öºº×Ö2¸ö×Ö½Ú)
ltrim/rtrim/trim ɾ³ý¿Õ¸ñ
lower/upper ´óСдת»»
select length('abc') from dual;
select substr(ename, 1, 3) from emp; ´ÓµÚÒ»¸ö×Ö·û¿ªÊ¼½Ø£¬Ò»¹²½Ø3¸ö×Ö·û
substr('abcdefg',2,3) => ......