Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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ÆóÒµ¹ÜÀíÆ÷11g£¨¶þ£©

¼¯³ÉʽӦÓÃÈí¼þÖÁ´ÅÅ̹ÜÀí£¬¼ò»¯¹ÜÀí»·¾³£¬Ìá¸ßͶ×ʻر¨ÂÊ
¡¡¡¡È«Ãæ¹ÜÀíOracleµÄ²úÆ·£¬°üÀ¨Äܹ»¹ÜÀíOracleÓ¦ÓÃÈí¼þ¡¢OracleÈÚºÏÖмä¼þ¡¢OracleÊý¾Ý¿â¡¢Oracle Solaris¡¢OracleÆóÒµ¼¶Linux¡¢Oracle VMºÍOracle Sun·þÎñÆ÷µÄ¹¤¾ß¡£ÕâʹµÃITÄܹ»¿ìËÙÈ·¶¨ÎÊÌâµÄ¸ù±¾Ô­Òò£¬¶øÇÒÔںܶàÇé¿öÏ£¬»¹ÄÜ×Ô¶¯µØ½â¾öÎÊÌâ¡£
¡¡¡¡ÁíÍ⣬Õâ ......

Oracle´´½¨±í¿Õ¼ä¡¢´´½¨Óû§ÒÔ¼°ÊÚȨ¡¢²é¿´È¨ÏÞ

´´½¨ÁÙʱ±í¿Õ¼ä
CREATE   TEMPORARY  TABLESPACE test_temp
TEMPFILE  ' C:\oracle\product\10.1.0\oradata\orcl\test_temp01.dbf '
SIZE 32M
AUTOEXTEND  ON
NEXT  32M MAXSIZE 2048M
EXTENT MANAGEMENT LOCAL;
´´½¨Óû§±í¿Õ¼ä
CREATE  TABLESPACE test_data
LOGGING
DATAFI ......

OracleÖжà±í²éѯÔÙ°´Ê±¼äµ¹Ðò

ÎÒÔÚ¹¤×÷ÖÐÔÚOracleÖжà±í²éѯÔÙ°´Ê±¼äµ¹Ðòʱ£¬ÓÃorder by ±íÃû.datatime desc ×ÜÊÇʵÏÖ²»ÁË¡£
²»¹ý×îºóÎÊÑî¾é×îºóºÍÎÒ˵¿ÉÒÔ°ÑÎÒÃDzéѯµÄ×ܸösqlÓï¾ä×öΪһ¸ö±íÀ´ÅÅÐò£º
select rownum,aa.* from (....  order by ±íÃû.datatime desc ) aa ......

OracleÖеÄdecode

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

´´½¨oracle dblink

create database link user_auth
¡¡¡¡ connect to user_auth identified by user_auth
¡¡¡¡ using  '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.236)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=develop1)))'; ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ