oracleÖÐtype
oracleÖÐ×Ô¶¨ÒåÊý¾ÝÀàÐÍ
oracleÖÐÓлù±¾µÄÊý¾ÝÀàÐÍ£¬Èçnumber£¬varchar2£¬date£¬numeric£¬float....µ«ÓÐʱºòÎÒÃÇÐèÒªÌØÊâµÄ¸ñʽ£¬È罫name¶¨ÒåΪ
£¨firstname,lastname£©µÄÐÎʽ£¬ÎÒÃÇÏë°ÑÕâ¸ö×÷Ϊһ¸ö±íµÄÒ»Áп´´ý£¬Õâʱºò¾Í²»ÒªÎÒÃÇ×Ô¼º¶¨ÒåÒ»¸öÊý¾ÝÀàÐÍ
create or replace type type_name as object(firstname varchar2(20),lastname varchar2(30));
ÕâÑù×Ó¶¨ÒåÖ®ºóÎÒÃǾÍÄÜÏñʹÓûù±¾ÀàÐÍÒ»ÑùʹÓÃ×Ô¶¨ÒåÀàÐÍÈ¥½¨±í:
È磺
create or replace type name_format as object(firstname varchar2(20),lastname varchar2(30));
¶¨ÒåÁËÀàÐÍÖ®ºó£¬ÎÒÃǾͿÉÒÔ½«Ëüµ±×÷ÆÕͨµÄ»ù±¾ÀàÐÍÓÃÁË£¬½¨±í£¬Ð´functionµÈµÈ£¬ÈçÓÃ×Ô¶¨ÒåÊý¾ÝÀàÐͽ¨±í£º
create table testtable(id number primary key,name name_format);
²åÈëÊý¾Ýʱ£¬¹¹ÔìÎÒÃǵÄÕâ¸ö×Ô¶¨ÒåÁÐʱ£¬¾ÍÏñ¹¹Ôì¶ÔÏóÒ»Ñù£¬ÈçÉÏÃæµÄ±í²åÈëÊý¾ÝµÄsqlÓï¾äÈçÏ£º
insert into testtable values(1,name_format('hust','lkq'));
²éѯ×Ô¶¨ÒåÁеÄij¸öÖµ¿ÉÒÔÓÃ.À´·ÃÎÊ,ÈçÉÏÃæÎÒÒª²éѯtesttable±íÖÐnameÁеÄfirstnameµÄÖµ¿ÉÒÔ°´ÕÕÈçϲéѯ£º
select t.name.firstname from testtable t;
×Ô¶¨ÒåÊý¾ÝÀàÐÍÒ²¿ÉÒÔÊǼ¯ºÏ
ÀýÈ磺create or replace type numers_set as array(10) of number;
Õâ¾Í±íʾ´´½¨ÁËÒ»¸ö°üº¬10¸önumberÊý¾ÝµÄ×Ô¶¨ÒåÀàÐÍ£¬
×¢£ºÕâÀïµÄ¼¯ºÏÀïÃæµÄ»ù±¾ÔªËØÒ²¿ÉÒÔÊÇÄã×Ô¶¨ÒåµÄÀàÐÍ£¬Ò²¾ÍÊÇ˵֧³ÖǶÌ׶¨Òå
create or replace type name_list as array(10) of name_format:£¨´Ë´¦µÄname_format¾ÍÊÇÎÒÃÇÔÚÉÏÃ涨ÒåµÄÒ»¸ö×Ô¶¨ÒåÀàÐÍ£©
Ïà¹ØÎĵµ£º
ÔÚOracleÖÐʹÓÃGuid
ÔÚOracleÖпÉÒÔÓÃSYS_GUID()À´Éú³ÉÒ»¸öguid,Ï൱ÓÚmsSqlÖеÄnewid()¡£
ÔÚOracle9iºÍOracle 10g ÀïSYS_GUID²úÉúµÃµ½µÄÊý¾ÝÊÇ32 λµÄ£¬È磺234E45F0077881AAE0430AA3034681AA
µ«OracleÖеÄguidÓëmsSqlÖеÄguid¸ñʽ²»ÍêÈ«Ïàͬ¡£
½«OracleÖеÄguid·Ö¸î³ÉΪ Windowsϵͳ ObjectId µÄ¸ñʽ£º{8-4-4-4-12} £ ......
×ܽáÁËÒ»ÏÂɾ³ýÖظ´¼Ç¼µÄ·½·¨£¬ÒÔ¼°Ã¿ÖÖ·½·¨µÄÓÅȱµã¡£
¼ÙÉè±íÃûΪTbl£¬±íÖÐÓÐÈýÁÐcol1£¬col2£¬col3£¬ÆäÖÐcol1£¬col2ÊÇÖ÷¼ü£¬²¢ÇÒ£¬col1£¬col2ÉϼÓÁËË÷Òý¡£
1¡¢Í¨¹ý´´½¨ÁÙʱ±í
¿ÉÒÔ°ÑÊý¾ÝÏȵ¼Èëµ½Ò»¸öÁÙʱ±íÖУ¬È»ºóɾ³ýÔ±íµÄÊý¾Ý£¬ÔÙ°ÑÊý¾Ýµ¼»ØÔ±í£¬SQLÓï¾äÈçÏ£º
creat table tbl_tmp (select distinct* from tb ......
ORACLE 10 ѧϰ±Ê¼Ç-µÚ2½Ú-ÃüÁî¡£
1. inner join / left join/ right join / full join
select a.dname, b.ename from dept a, emp b where a.deptno=b.deptno and a.deptno=10;
select a.dname, b.ename from dept a inner join emp b
on a.deptno=b.deptno and a.deptno=10;
select dname,ename from dept natural ......
oracle Set ÃüÁî½éÉÜ
http://luoke920.javaeye.com/blog/323743
1). ÉèÖõ±Ç°sessionÊÇ·ñ¶ÔÐ޸ĵÄÊý¾Ý½øÐÐ×Ô¶¯Ìá½»
SQL>SET AUTO[COMMIT] {ON|OFF|IMM[EDIATE]| n}
2)£®ÔÚÓÃstartÃüÁîÖ´ÐÐÒ»¸ösql½Å±¾Ê±£¬ÊÇ·ñÏÔʾ½Å±¾ÖÐÕýÔÚÖ´ÐеÄSQLÓï¾ä
SQL> SET ECHO {ON|OFF}
3).ÊÇ·ñÏÔʾµ±Ç°sqlÓï¾ä²éѯ»òÐ޸ĵÄÐÐÊý ......