±±´óÇàÄñoracleѧϰ±Ê¼Ç31
pl/sql ±í
ÔÚpl/sql¿éÖÐÁÙʱʹÓá¢ÏñÊý×éÒ»ÑùµÄ¶ÔÏó
°üº¬Ò»ÁкÍÒ»¸öÖ÷¼ü
²»ÄܶÔÁкÍÖ÷¼ü½øÐÐÃüÃû
ÁпÉÒÔÊÇÈκαêÁ¿Êý¾ÝÀàÐÍ
Ö÷¼ü±ØÐëÊÇbinary_integerÀàÐÍ
´óСûÓÐÏÞÖÆ
ÉùÃ÷pl/sql±í
¶¨Òå±íµÄÀàÐÍ
type ÀàÐÍÃû is table of ÁÐÀàÐÍ|±äÁ¿Êý¾ÝÀàÐÍ index by binary_integer;
ÉùÃ÷±í±äÁ¿
±íÃû ÀàÐÍÃû;
ÒýÓÃpl/sql±í
±íÃû(ϱê)
¸³Öµ
±íÃû(ϱê):=±í´ïʽ;
ÊôÐÔ·½·¨:
count --·µ»Øpl/sql±íµÄ×ÜÐÐÊý£»
delect --ɾ³ýpl/sql±íµÄËùÓÐÄÚÈÝ£»
delect(ÐÐÊý) --ɾ³ýpl/sql±íµÄÖ¸¶¨µÄÐУ»
delct(¿ªÊ¼ÐУ¬½áÊøÐÐ) --ɾ³ýpl/sql±íµÄ¶àÐУ»
first --·µ»Ø±íµÄµÚÒ»¸öINDEX;
next(ÐÐÊý) --Õâ¸öÐÐÊýµÄÏÂÒ»ÌõµÄINDEX;
last --·µ»Ø±íµÄ×îºóÒ»¸öINDEX;
declare
Type stuNameTableType is table of student.stu_name%type index by binary_integer;
stuNameTable stuNameTableType;
begin
for i in 1..10
loop
stunametable(i):='student'||i;
end loop;
for i in 1..stunametable.count
loop
dbms_output.put_line('µÚ'||i||'¸öÔªËØ£º'||stunametable(i));
end loop;
end;
±íÀàÐÍÐèҪʹÓÃbulk collectÅúÁ¿°ó¶¨½øÐÐselect¸³Öµ£¬bulk collect×Ó¾äÒ²¿ÉÓÃÓÚFetch bulk collect into ×Ó¾äÖÐ
declare
TYPE studentTableType is table of student%rowtype index by binary_integer;
studentTable studentTableType;
begin
select * bulk collect into studentTable from student order by stu_id;
for i in 1..studentTable.count loop
dbms_output.put_line(studentTable(i).stu_id);
dbms_output.put_line(studentTable(i).stu_name);
dbms_output.put_line(studentTable(i).stu_sex);
dbms_output.put_line(studentTable(i).stu_birthday);
end loop;
end;
RecordÀàÐÍ
ÉùÃ÷
type ¼Ç¼ÀàÐÍÃû is record (
×Ö¶Î1 ÀàÐÍ[not null[:=±í´ïʽ]]
×Ö¶În ÀàÐ
Ïà¹ØÎĵµ£º
LinuxÏÂÆô¶¯oracle10gµÄemºÍisqlplusµÄ·½·¨:
×¢:$ORACLE_HOMEΪoracleµÄ°²×°Â·¾¶
1,ʹÓÃEM(enterprise managment)
1.1Æô¶¯EM
$ORACLE_HOME/bin/emctl start dbconsole
Èç¹û³öÏÖÏÂÃæÏà¹ØÐÅÏ¢,˵Ã÷·þÎñÆô¶¯
Z set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.1.0.3.0
Copyright (c) 1996, 200 ......
ʱ¼ä: 2006-06-15 À´×Ô£ºCSDN
< type="text/javascript"><!--
google_ad_client = "pub-0103898066674568";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text";
google_ad_channel = "";
google_color_ ......
ÏÖÔÚÔÚWEB Ó¦ÓÃÖÐʹÓ÷ÖÒ³¼¼ÊõÔ½À´Ô½ÆÕ±éÁË£¬ÆäÖÐÀûÓÃÊý¾Ý¿â²éѯ·ÖÒ³ÊÇÒ»ÖÖЧÂʱȽϸߵķ½·¨£¬
ÏÂÃæÁгöÁËOracle, DB2 ¼° MySQL ·ÖÒ³²éѯд·¨¡£
Ò»£ºOracle
select * from (select rownum,name from table where rownum <=endIndex )
where rownum > startIndex
¶þ£ºDB2
DB2·ÖÒ³²éѯ
SELECT * ......
Ò»¡¢Óï·¨
´óÖÂд·¨£ºselect * from some_table [where Ìõ¼þ1] connect by [Ìõ¼þ2] start with [Ìõ¼þ3];
ÆäÖÐ connect by Óë start with Óï¾ä°Ú·ÅµÄÏȺó˳Ðò²»Ó°Ïì²éѯµÄ½á¹û£¬[where Ìõ¼þ1]¿ÉÒÔ²»ÐèÒª¡£
[where Ìõ¼þ1]¡¢[Ìõ¼þ2]¡¢[Ìõ¼þ3]¸÷×Ô×÷Óõķ¶Î§¶¼²»Ïàͬ£º
[where Ìõ¼þ1]ÊÇÔÚ¸ù¾Ý“connect by [Ìõ¼þ2] ......
1.
¸ÅÄͬ£º
Á¬½ÓÊÇÖ¸ÎïÀíµÄ¿Í
»§¶Ëµ½oracle·þÎñ¶ËµÄÁ¬½Ó¡£Ò»°ãÊÇͨ¹ýÒ»¸öÍøÂçµÄÁ¬½Ó¡£
ÔÚÒѽ¨Á¢µÄÁ¬½Ó
ÉÏ£¬½¨Á¢¿Í»§¶ËÓëoracle
µÄ»á»°£¬ÒÔºó¿Í
»§¶ËÓëoracle
µÄ½»»¥¶¼ÔÚÒ»¸ö»á»°»·¾³ÖÐ
½øÐС£
2.
¹ØϵÊǶà¶Ô¶à£º[ͬÒâÍøÓѵÄÒâ¼û£¬Ó¦¸ÃÊÇ1¶Ô
¶à¡£Ò»¸ö»á»°ÒªÃ´ ......