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

oracle xunhuan

²âÊÔtable
create table table1 (id int,name char)
insert into table1
select 1,'q'
union all select 2,'r'
union all select 3,'3'
union all select 4,'5'
ÒªÇó°´Ö¸¶¨µÄid˳Ðò(±ÈÈç2,1,4,3)ÅÅÁлñÈ¡table1µÄÊý¾Ý
·½·¨1:ʹÓÃunion all,µ«ÊÇÓÐ256ÌõÊý¾ÝµÄÏÞÖÆ
select id,name from table1 where id=2
union all
select id,name from table1 where id=1
union all
select id,name from table1 where id=4
union all
select id,name from table1 where id=3
·½·¨2:ÔÚorder byÖÐʹÓÃcase when
select id ,name from t where id in (2,1,4,3)
order by (case id
when 2 then 'A'
when 1 then 'B'
when 4 then 'C'
when 3 then 'D' end)
*ÒÔÉÏÁ½ÖÖ·½·¨ÊʺÏÔÚÊý¾ÝÁ¿·Ç³£Ð¡µÄÇé¿öÏÂʹÓÃ
·½·¨3:ʹÓÃÓαêºÍÁÙʱ±í
ÏȽ¨Ò»¸ö¸¨Öú±í,ÀïÃæÄãÐèÒªµÄ˳Ðò²åÈë,±ÈÈç2,1,4,3
create table t1(id int)
insert into t1
select 2
union all select 1
union all select 4
union all select 3
declare @id int --¶¨ÒåÓαê
declare c_test cursor for
select id from t1
select * into #tmp from table1 where 1=2 --¹¹ÔìÁÙʱ±íµÄ½á¹¹
OPEN c_test
FETCH NEXT from c_test
INTO @id
WHILE @@FETCH_STATUS = 0
BEGIN
--°´t1ÖеÄid˳Ðò²åÊý¾Ýµ½ÁÙʱ±í
insert into #tmp select id,name from table1 where id=@id
FETCH NEXT from c_test INTO @id
End
Close c_test
deallocate c_test
*¸Ã·½·¨ÊʺÏÐèÒª°´ÕÕ¸¨Öú±íµÄ˳ÐòÖØÅÅtableµÄ˳ÐòʱʹÓÃ
(¼´¸¨Öú±íÒѾ­´æÔÚµÄÇé¿ö)
·½·¨4:·Ö¸î×Ö·û´®²ÎÊý
select * into #tmp from table1 where 1=2 --¹¹ÔìÁÙʱ±íµÄ½á¹¹
declare @str varchar(300),@id varchar(300),@m int,@n int
set @str='2,1,4,3,' ---×¢ÒâºóÃæÓиö¶ººÅ
set @m=CHARINDEX(',',@str)
set @n=1
WHILE @m>0
BEGIN
set @id=substring(@str,@n,@m-@n)
--print @id
insert into #tmp select id,name from table1 where id=convert(int,@id)
set @n=@m+1
set @m=CHARINDEX(',',@str,@n)
END
*¸Ã·½·¨±È½ÏÓÐͨÓÃÐÔ
²âÊÔ½á¹û
id name
----------- ----
2 r
1 q
4 5
3 3


Ïà¹ØÎĵµ£º

Oracle±í¿Õ¼ä¹ÜÀí

extent--×îС¿Õ¼ä·ÖÅ䵥λ --tablespace management
block --×îСi/oµ¥Î»      --segment    management
create tablespace james
datafile '/export/home/oracle/oradata/james.dbf'
size 100M ¡¡¡¡¡¡¡¡¡¡¡¡--³õʼµÄÎļþ´óС¡¡
autoextend On¡¡¡¡¡¡¡¡ --×Ô¶¯Ôö³¤
next 10M¡ ......

Oracle À俽±¸ÊµÀý¹Òµ½ÐÂORACLEʱӦעÒâÎÊÌâ¡£

À俽±¸ÁËÒ»¸öÔ­ÓÐÊý¾Ý¿â£¬Òª°ÑËûÒÆÖ²µ½ÐµÄÊý¾Ý¿âÖÐʱ£¬Òª×¢Òâһϣº
1.Oradim -new -sid [ʵÀýÃû:demo] -intpwd [PWD]  -pfile= [Òª´´½¨ÊµÀýµÄÅäÖÃÎļþ£º*.ora]
2.set Oracle_SID=[ʵÀýÃû]£¨×°Íêºó¼ÇµÃÒªÔÚ×¢²á±íÀï¼ÓÉÏ:HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraDb10g_home1£ºORACLE_SID£¬ÖµÎªÊµÀýÃû¡££©
3.sql ......

Oracle ÔÚwindowÏÂ×Ô¶¯±¸·Ý

£±¡¢È·¶¨ÄãµÄ¼ÆËã»úÉÏ×°ÓÐoracleµÄ¿Í»§¶Ë£¬Èç¹ûûÓУ¬Çë°²×°oracle¿Í»§¶Ë
£²¡¢È·¶¨ÓÐÄãµÄoracle·þÎñÀïÓÐÄãÒªÐèÒª±¸·ÝµÄÊý¾Ý¿âµÄ·þÎñÃû¡£
£³¡¢ÖÆ×÷Ò»¸öÅú´¦ÀíÎļþ£¨oracleBackup.bat£©£¬¾ßÌå·½·¨£º´ò¿ª“¼Çʱ¾”£¬±£´æΪoracleBackup.bat£¬
¡¡¡¡´Ëʱ±£´æµÄÎļþÀàÐÍÑ¡ÔñΪ“ËùÓÐÎļþ”¡£Îҵı£´æÄ¿Â ......

ORACLE ÐÐתÁÐ ÓùýµÚÒ»¸öЧ¹û²»ËãÌ«ºÃ£¡

Êý¾Ý¿â²éѯÖÐÄÑÃâ»áÓöµ½ÐÐÁÐת»»µÄÇé¿ö£¬ÕªÁÐһЩ½Ï¾«µäµÄ½â¾ö·½°¸
--####################################################################
Ò»¡¢²ÉÓÃSQL decodeºÍPL/SQLº¯ÊýʵÏÖ
--####################################################################
1¡¢¹Ì¶¨ÁÐÊýµÄÐÐÁÐת»»
Èç
student subject grade
------ ......

oracleµÄ»ù±¾ÖªÊ¶

Á·Ï°:
  drop  table  Employee;
create  table    Employee(
                 id         number    primary key,
    ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ