oracleÖжÔÏó±í£¬ref¼°derefµÄÒ»¸öʵÀý¡£
ORACLEÔÚ¹ØϵÊý¾Ý¿âÍ⣬ÈÚÈëÁËÃæÏò¶ÔÏóµÄÔªËØ£¬±ÈÈç¿ÉÒÔ´´½¨type£¬typeÖ®¼ä¿ÉÒԼ̳У¬type¿ÉÒÔ´ø¹¹Ô캯Êý¡¢ÅÅÐòº¯Êý¡¢¸÷ÖÖ¸÷ÑùµÄ³ÉÔ±º¯Êý¡¢´æ´¢¹ý³ÌµÈµÈ¡£
¶ÔÏó±íÊÇÖ¸¸Ã±íµÄÒ»ÐоÍÊÇÒ»¸ö¶ÔÏó£¬ÓÐÒ»¸öOID(object ID)£¬¶ÔÏó±íÖ®¼äûÓÐÖ÷Íâ¼ü¹ØÁªµÄ¸ÅÄΪÁËÌåÏÖÕâ²ã¹Øϵ£¬oracleÖÐÓÃÁËref¶ÔÏóÀ´ÊµÏÖ¡£
ÏÂÃæÀý×Ó£¬´´½¨Ò»¸öµØÖ·ÀàÐÍ£¬Ò»¸öÈËÔ±ÀàÐÍ£¬ÈËÔ±ÓеØÖ·ÊôÐÔ£¬ËùÒÔÔÚÈËÔ±ÀàÐÍÖÐÉèÖÃÒ»¸öref addressÀ´È·¶¨Ö¸ÏòËûËùÔÚµØÖ·µÄÖ¸Õë¡£
--´´½¨µØÖ·ÀàÐÍ
create type address as object(
street varchar2(35),
city varchar2(15),
state char(2),
zip_code integer
);
create table addresses of address; --´´½¨µØÖ·¶ÔÏó±í
--´´½¨ÈËÔ±ÀàÐÍ
create type person as object(
first_name varchar2(15),
last_name varchar2(15),
birthday date,
home_address ref address, --Ö¸Ïò¶ÔÓ¦µÄµØÖ·£¬¸ÃµØÖ·Ó¦¸ÃÔÚÁíÍâÒ»¸ö¶ÔÏó±íÖеÄÒ»ÐÐ
phone_number varchar2(15)
);
CREATE TABLE persons of person; --´´½¨ÈËÔ±¶ÔÏó±í
--²åÈëÒ»¸öµØÖ·
insert into addresses values(address('nanhai','shenzhen','gd','518054'));
insert into addresses values(address('shennan','shenzhen','gd','518057'));
--²åÈëÒ»¸öÈËÔ±£¬×¢ÒâÕâÀïµÄhome_address²¿·ÖÊÇÈçºÎ²åÈëÒ»¸öref addressµÄ¡£
insert into persons values(person('shitou','haha',to_date('1982-07-05','yyyy-mm-dd'),
(select ref(a) from addresses a where street='nanhai'),
'1355555555'));
--Ò²¿ÉÒÔÓÃÏÂÃæµÄ¹ý³ÌÀ´²åÈëÒ»¸öÈËÔ±¼Ç¼
declare
addref ref address ;
begin
select ref(a) into addref from addresses a where street='nanhai';
insert into persons
values (person('shitou','haha',to_date('1982-07-05','yyyy-mm-dd'),
addref,'1355555555'));
commit;
end;
--²éѯijÈ˵ĵØÖ·ÐÅÏ¢
select first_name,deref(home_address) from persons;
--Ð޸ĵØÖ·
update persons set home_address=(select ref(a) from addresses a where street='shennan');
--ɾ³ýij¸
Ïà¹ØÎĵµ£º
--¶¨ÒåÊý¾Ý¿âÁ¬½Ó·Ö·¢Æ÷
alter system set dispatchers='(PROTOCOL=TCP)(SERVICE=imapdb)(DISPATCHERS=5)(PROTOCOL=IPC)(DISPATCHERS=5)' scope=spfile;
--¶¨Òå¹²Ïí·þÎñÊý
alter system set shared_servers=20 scope=spfile;
--¶¨Òå¹²Ïí·þÎñµÄsessionÊý
alter system set shared_server_sessions=1024 scope=spfile;
......
Êý¾Ý×Öµädict×ÜÊÇÊôÓÚOracleÓû§sysµÄ¡£
¡¡¡¡1¡¢Óû§£º
¡¡¡¡¡¡select username from dba_users;
¡¡¡¡¸Ä¿ÚÁî
¡¡¡¡¡¡alter user spgroup identified by spgtest;
¡¡¡¡2¡¢±í¿Õ¼ä£º
¡¡¡¡¡¡select * from dba_data_files;
¡¡¡¡¡¡select * from dba_tablespaces;//±í¿Õ¼ä
¡¡¡¡¡¡select tablespace_name,sum(bytes), sum(b ......
Ò»¡£²é¿´oracleÊý¾Ý¿âÊÇ·ñΪ¹éµµÄ£Ê½£º[1]
¡¡¡¡1.select name,log_mode from v$database;
¡¡¡¡NAME LOG_MODE
¡¡¡¡------------------ ------------------------
¡¡¡¡QUERY NOARCHIVELOG
¡¡¡¡2.ʹ ......
ÓÃoracleÊý¾Ý¿âµÄ´æ´¢¹ý³ÌʵÏÖ·µ»Ø½á¹û¼¯²¢ÊµÏÖ·ÖÒ³µÄ¹¦ÄÜ¡£
Óû§´«Èë²ÎÊý
Ò»ÏÂÊÇת±ðÈ˵ĴúÂë
--°üÉùÃ÷
create or replace package p_page is
-- Author : PHARAOHS
-- Created : 2006-4-30 14:14:14
-- Purpose : ·ÖÒ³¹ý³Ì
TYPE type_cur IS REF CURSOR; &n ......
OracleÖÐÓÃRowid²éÕÒºÍɾ³ýÖظ´¼Ç¼
¡¡¡¡Æ½Ê±¹¤×÷ÖпÉÄÜ»áÅöµ½µ±ÊÔͼ¶Ô¿â±íÖеÄijһÁлò¼¸Áд´½¨Î¨Ò»Ë÷Òýʱ£¬ÏµÍ³Ìáʾ ORA-01452 £º²»ÄÜ´´½¨Î¨Ò»Ë÷Òý£¬·¢ÏÖÖظ´¼Ç¼¡£
¡¡¡¡ÏÂÃæ×ܽáһϼ¸ÖÖ²éÕÒºÍɾ³ýÖظ´¼Ç¼µÄ·½·¨£¨ÒÔ±íCZΪÀý£©£º
¡¡¡¡±íCZµÄ½á¹¹ÈçÏ£º
¡¡¡¡SQL> desc cz
¡¡¡¡Name Null? Type
¡¡¡¡---------- ......