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

Oracle¶ÔÏóÀàÐÍÏê½â

³éÏóÊý¾ÝÀàÐÍ
1¡¢´´½¨ÀàÐÍ
--µØÖ·ÀàÐÍ
CREATE OR REPLACE TYPE AddressType AS OBJECT
(
Country varchar2(15),
City varchar2(20),
Street varchar2(30)
);
2¡¢ÀàÐÍǶÌ×
--´´½¨»ùÓÚÇ°Ò»¸öÀàÐ͵ÄеijéÏóÊý¾ÝÀàÐÍ£º¾ÞÐÇÀàÐÍ
CREATE OR REPLACE TYPE SuperStarType AS OBJECT
(
StarName varchar2(30),
Address AddressType
);
3¡¢»ùÓÚ³éÏóÀàÐÍ´´½¨¹Øϵ±í
CREATE TABLE SuperStar
(
StarID varchar(10),
Star SuperStarType
);
4¡¢»ùÓÚ³éÏóÀàÐÍ´´½¨¶ÔÏó±í
CREATE TABLE SuperStarObj of SuperStarType;
5¡¢Ê¹Óù¹Ôì·½·¨ÔÚ±íÖвåÈë¼Ç¼
INSERT INTO SuperStar VALUES(''001'',SuperStarType(''Zidane'',AddressType(''France'',''Paris'',''People Street NO.1'')));
6¡¢²éѯ±íÖмǼ
£¨1£©SQL> SELECT * from SuperStar;
STARID
----------
STAR(STARNAME, ADDRESS(COUNTRY, CITY, STREET))
--------------------------------------------------------------------------------
001
SUPERSTARTYPE(''Zidane'', ADDRESSTYPE(''France'', ''Paris'', ''People Street NO.1''))
£¨2£©
SELECT s.StarID,s.Star.StarName,s.Star.Address.Country,s.Star.Address.City,s.Star.Address.Street from SuperStar s
STARID STAR.STARNAME STAR.ADDRESS.CO STAR.ADDRESS.CITY STAR.ADDRESS.STREET
---------- ------------------------------ --------------- -------------------- ---------------------
001 Zidane France Paris People Street NO.1
7¡¢³éÏóÊý¾ÝÀàÐ͵ļ̳Ð
£¨1£©´´½¨Ò»¸öÀàÐÍ
CREATE OR REPLACE TYPE PersonType AS OBJECT
(
PersonName varchar(10),
PersonSex varchar(2),
PersonBirth date
) not final;
(2)ÅÉÉúÒ»¸öÀàÐÍ
CREATE OR REPLACE TYPE StudentType UNDER PersonType
(
StudentNO int,
StudentScore int
);
(3)²é¿´Êý¾Ý×Öµä
SQL> DESC StudentType
StudentType extends SYS.PERSONTYPE
Name
------------------------------------------------------------------------------
PERSONNAME
PERSONSEX
PERSONBIRTH
STUDENTNO
STUDENTSCORE
(4)´´½¨¶ÔÏó±í
CREATE TABLE student OF StudentType;
(5)Ïò¶ÔÏó±íÖвåÈëÊý¾Ý
INSERT INTO student VALUES(''Rose'',''nv'',to_date(''1983-05-02'',''yyyy-mm-dd''),1001,98);
(6) ²éѯÊý¾Ý
SQL> SELECT * f


Ïà¹ØÎĵµ£º

Oracle¹éµµÈÕÖ¾¹ÜÀí


²é¿´µ±Ç°Êý¾Ý¿â¹éµµÈÕÖ¾²Ù×÷ģʽ:
select name,log_mode from v$database;
²é¿´¹éµµÈÕ־λÖÃ:
show parameter log_archive_dest; µÚÒ»¸ö¹éµµÎ»ÖÃ
show parameter log_archive_duplex_dest; µÚ¶þ¸ö¹éµµÎ»ÖÃ
ÏȹرÕÊý¾Ý¿â,È»ºó×°ÔØÊý¾Ý¿â:
shutdown immediate;
startup mount;
Ð޸Ĺ鵵ÈÕÖ¾²Ù×÷ģʽ,È»ºó´ò¿ªÊý¾Ý¿â ......

OracleµÄÓû§¹ÜÀí ORA

ÅäÖÃÉí·ÝÑéÖ¤
OracleΪÓû§ÕË»§ÌṩÈýÖÖÉí·ÝÑéÖ¤·½·¨£º
(1)ÃÜÂëÑéÖ¤
µ±Ò»¸öʹÓÃÃÜÂëÑéÖ¤»úÖƵÄÓû§ÊÔͼÁ¬½Óµ½Êý¾Ý¿âʱ£¬Êý¾Ý¿â»áºËʵÓû§ÃûÊÇ·ñÊÇÒ»¸öÓÐЧµØÊý¾Ý¿âÓû§£¬²¢ÇÒÌṩÓë¸ÃÓû§ÔÚÊý¾Ý¿âÖд洢µÄÃÜÂëÏàÆ¥ÅäµÄÃÜÂë¡£
(2)ÍⲿÑéÖ¤
µ±Ò»¸öÍⲿÑé֤ʽÓû§ÊÔͼÁ¬½Óµ½Êý¾Ý¿âʱ£¬Êý¾Ý¿â»áºËʵÓû§ÃûÊÇ·ñÊÇÒ»¸öÓÐЧµÄ ......

¹ØÓÚOracleÖÐtnsnames.oraµÄÅäÖÃ


ÿ´Îͨ¹ýÐÞ¸Ätnsnames.oraÅäÖñ¾µØNET·þÎñÃû¶¼³öÏÖ´íÎó“ORA-12154:TNS£¬ÎÞ·¨´¦Àí·þÎñÃû”£¬×ܵÃÓôÃÆ°ëÌì~
Õâ¸ö´íÎó£¬Í¨³£ÊÇÒòΪoracle±¾µØNET·þÎñÃûÅäÖÃtnsnames.oraÎļþÓÐÑϸñµÄ¸ñʽҪÇó¡£
ÀýÈ磺
mstrdw =
  (DESCRIPTION =
    (ADDRESS_LIST =
      ......

OracleÖеÄdecode

ÉÏһƪÎÄÕÂдÁËÒ»¸öoracleµÄÒ»¸öÐÐתÁеÄÀý×Ó£¬ÀïÃæÓõ½ÁËoracleÖÐÖØÒªµÄº¯Êý decode,ÕâƪÎÄÕ¾ÍÀ´¼òµ¥µÄѧϰÕâ¸öº¯Êý
DECODEº¯ÊýºÍÎÒÃÇÓïÑԽṹÖеÄÌõ¼þÓï¾ä£¨IF£©ÏàËÆ¡£Ëü½«ÊäÈëÊýÖµÓ뺯ÊýÖеIJÎÊýÁбíÏà±È½Ï£¬¸ù¾ÝÊäÈëÖµ·µ»ØÒ»¸ö¶ÔÓ¦Öµ¡£
DECODEº¯ÊýÏ൱ÓÚÒ»Ìõ¼þÓï¾ä(IF).Ëü½«ÊäÈëÊýÖµÓ뺯ÊýÖеIJÎÊýÁбíÏà±È½Ï£¬¸ù¾ÝÊ ......

Àí½âoracleÖÐÁ¬½ÓºÍ»á»°

Àí½âoracleÖÐÁ¬½ÓºÍ»á»° 1. ¸ÅÄͬ£º¸ÅÄͬ£º
Á¬½ÓÊÇÖ¸ÎïÀíµÄÍøÂçÁ¬½Ó¡£
ÔÚÒѽ¨Á¢µÄÁ¬½ÓÉÏ£¬½¨Á¢¿Í»§¶ËÓëoracleµÄ»á»°£¬ÒÔºó¿Í»§¶ËÓëoracleµÄ½»»¥¶¼ÔÚÒ»¸ö»á»°»·¾³ÖнøÐС£
2. ¹ØϵÊǶà¶Ô¶à£º
Ò»¸öÁ¬½ÓÉÏ¿ÉÒÔ½¨Á¢0¸ö£¬1¸ö£¬2¸ö£¬¶à¸ö»á»°¡£
OracleÔÊÐí´æÔÚÕâÑùµÄ»á»°£¬¾ÍÊÇʧȥÁËÎïÀíÁ¬½ÓµÄ»á»°¡£
3. ¸ÅÄîÓ¦Ó㺸 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ