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¾ÍÊÇÎÒÃÇÔÚÉÏÃæ¶¨ÒåµÄÒ»¸ö×Ô¶¨ÒåÀàÐÍ£©
Ïà¹ØÎĵµ£º
×ܽáÁËÒ»ÏÂɾ³ýÖØ¸´¼Ç¼µÄ·½·¨£¬ÒÔ¼°Ã¿ÖÖ·½·¨µÄÓÅȱµã¡£
¼ÙÉè±íÃûΪTbl£¬±íÖÐÓÐÈýÁÐcol1£¬col2£¬col3£¬ÆäÖÐcol1£¬col2ÊÇÖ÷¼ü£¬²¢ÇÒ£¬col1£¬col2ÉϼÓÁËË÷Òý¡£
1¡¢Í¨¹ý´´½¨ÁÙʱ±í
¿ÉÒÔ°ÑÊý¾ÝÏȵ¼Èëµ½Ò»¸öÁÙʱ±íÖУ¬È»ºóɾ³ýÔ±íµÄÊý¾Ý£¬ÔÙ°ÑÊý¾Ýµ¼»ØÔ±í£¬SQLÓï¾äÈçÏ£º
creat table tbl_tmp (select distinct* from tb ......
´ó¼ÒÔÚÓ¦ÓÃORACLEµÄʱºò¿ÉÄÜ»áÓöµ½ºÜ¶à¿´ÆðÀ´²»ÄѵÄÎÊÌâ, ÌØ±ð¶ÔÐÂÊÖÀ´Ëµ, ½ñÌìÎÒ¼òµ¥°ÑËü×ܽáÒ»ÏÂ, ·¢²¼¸ø´ó¼Ò, Ï£Íû¶Ô´ó¼ÒÓаïÖú! ºÍ´ó¼ÒÒ»Æð̽ÌÖ, ¹²Í¬½ø²½!
¶ÔORACLE¸ßÊÖÀ´ËµÊDz»Óÿ´µÄ¡£
1. Oracle°²×°Íê³ÉºóµÄ³õʼ¿ÚÁî?
¡¡¡¡internal/oracle
¡¡¡¡sys/change_on_install
¡¡¡¡system/manager
¡¡¡¡scott/tiger
¡ ......
C#ÖвÙ×÷OracleʱµÄSQLÓï¾ä²ÎÊýµÄÓ÷¨
OracleTransaction myTrans ;
conn.Open();
myTrans =conn.BeginTransaction(IsolationLevel.ReadCommitted) ......
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Óï¾ä²éѯ»òÐ޸ĵÄÐÐÊý ......
oracleÀïµÄextendµÄÒâ˼
À©Õ¹ÒÑÖªµÄÊý×é¿Õ¼ä£¬Àý£º
DECLARE
TYPE CourseList IS TABLE OF VARCHAR2(10);
courses CourseList;
BEGIN
-- ³õʼ»¯Êý×éÔªËØ£¬´óСΪ3
courses := CourseList( 'Biol 4412 ', 'Psyc 3112 ', 'Anth 3001 ');
-- ΪÊý×éÔö¼ÓÒ»¸öÔªËØ£¬Êý×é´óСΪ4£¬Ä©Î²µÄÔªËØÎªNULL
courses.EXTEN ......