ORACLE PL/SQL ¼¯ºÏAPI ×ܽá
ORACLE 10GµÄ¼¯ºÏAPI
¼¯ºÏAPI·½·¨×îÔçÊÇÔÚORACLE 8IÖÐÒýÈëµÄ¡£¼¯ºÏAPIÌṩÁ˼ò»¯·ÃÎʼ¯ºÏµÄ·½·¨¡£ÔÚORACLE 10GÒÔÇ°£¬ÕâЩ·½·¨È·Êµ¼ò»¯Á˶Լ¯ºÏµÄ·ÃÎÊ¡£µ«ÊÇ£¬²¢²»ÊÇ·ÇÒªÇóÕÆÎÕÕâЩ·½·¨²»¿É¡£´ÓORACLE 9IµÄINDEX-BY±íµ½ORACLE 10GµÄÁªºÏÊý×éµÄת»»£¬Ê¹ËüÃdzÉΪ±ØÐëÕÆÎյķ½·¨¡£
ÏÂÃæÊÇÎÒ´ÓÊéÉÏժ¼ÏµÄһЩ¼¯ºÏAPI£¬ÀÛËÀÎÒÁË……ÏëÉÏÍøÕÒ¸öͼ»¹Ã»ÓС£
·½·¨Ãû³Æ
˵Ã÷
·µ»ØÖµµÄÀàÐÍ
ËùÖ§³Ö¼¯ºÏµÄÀàÐÍ
COUNT
COUNT·½·¨·µ»ØµÄÊÇVARRAYºÍǶÌ×±íÖÐÒѾ·ÖÅäÁË´æ´¢¿Õ¼äµÄÔªËصÄÊýÄ¿¡£ÔÚÁªºÏÊý×éÉÏʹÓÃÕâ¸ö·½·¨Ê±£¬Ëü·µ»ØÁªºÏÊý×éÖÐÔªËصÄÊýÄ¿¡£COUNT·½·¨¿ÉÄÜ»á±ÈVARRAYµÄLIMIT·½·¨ÒªÐ¡¡£
PLS_INTEGER
ËùÓм¯ºÏÀàÐÍ
DELETE(n)
DELETE·½·¨´øÓÐÒ»¸öÖØÔصÄÐÎʽ²ÎÊý£¬ÐÎʽ²ÎÊýµÄÀàÐÍΪPLS_INTEGER¡¢VARCHAR2»òLONGÀàÐÍ¡£Õâ¸öÐÎʽ²ÎÊý¶ÔÓ¦µÄÊǼ¯ºÏÖÐÔªËصÄϱꡣËüÊÇÒ»¸ö¹ý³Ì£¬Ã»Óзµ»ØÖµ¡£
ÎÞ·µ»ØÖµ
ËùÓм¯ºÏÀàÐÍ
DELETE(n,m)
DELETE·½·¨´øÓÐÒ»¸öÖØÔصÄÐÎʽ²ÎÊý£¬ÐÎʽ²ÎÊýµÄÀàÐÍΪPLS_INTEGER¡¢VARCHAR2»òLONGÀàÐÍ¡£ÕâÁ½¸öÐÎʽ²ÎÊý·Ö±ð¶ÔÓ¦µÄÊÇ×îСºÍ×î´óϱꡣÕâÁ½¸ö²ÎÊýÉ趨Á˼¯ºÏÖÐÔªËصİüº¬·¶Î§¡£ËüÊÇÒ»¸ö¹ý³Ì£¬Ã»Óзµ»ØÖµ¡£
ÎÞ·µ»ØÖµ
ËùÓм¯ºÏÀàÐÍ
EXISTS(n)
EXISTS·½·¨ÅжÏij¸öÔªËØÊÇ·ñ´æÔÚÓÚ¼¯ºÏÖС£Ëü´øÓÐÒ»¸öÖØÔصÄÐÎʽ²ÎÊý£¬ÐÎʽ²ÎÊýµÄÊý¾ÝÀàÐÍΪPLS_INTEGER¡¢VARCHAR2»òLONGÀàÐÍ¡£Õâ¸öÐÎʽ²ÎÊý¶ÔÓ¦µÄÊǼ¯ºÏÖÐÔªËصÄϱꡣ¼´Ê¹Õâ¸ö¼¯ºÏÊÇÒ»¸ö¿ÕÔªËؼ¯ºÏ£¬µ÷ÓÃEXISTS·½·¨Ò²²»»áÒý·¢COLLECTION_IS_NULLÒì³£
TRUE»òFALSE
ËùÓм¯ºÏÀàÐÍ
EXTEND
EXTEND·½·¨Îª¼¯ºÏÖеÄÐÂÔªËØ·ÖÅä´æ´¢¿Õ¼ä¡£ËüÓÃÔÚÏò¼¯ºÏÌí¼ÓÖµÒÔÇ°£¬Îª¸ÃÖµ·ÖÅä´æ´¢¿Õ¼ä¡£Èç¹ûÊÔͼ·ÖÅä¿Õ¼äµÄÔªËس¬¹ýÁËVARRAYµÄLIMIT·µ»ØÖµ£¬¸Ã·½·¨¾Í»áʧ°Ü¡£
ûÓзµ»ØÖµ
VARRAY»òǶÌ×±í
EXTEND(n)
EXTEND·½·¨Îª¼¯ºÏÖеĶà¸öÐÂÔªËØ·ÖÅä´æ´¢¿Õ¼ä¡£Ëü´øÓÐÒ»¸öÐÎʽ²ÎÊý£¬ÐÎʽ²ÎÊýµÄÊý¾ÝÀàÐÍΪPLS_INTEGERÀàÐÍ¡£ËüÓÃÔÚÏò¼¯ºÏÌí¼ÓÖµÒÔÇ°£¬Îª¸ÃÖµ·ÖÅä´æ´¢¿Õ¼ä¡£Èç¹ûÊÔͼ·ÖÅä¿Õ¼äµÄÔªËس¬¹ýÁËVARRAYµÄLIMIT·µ»ØÖµ£¬¸Ã·½·¨¾Í»áʧ°Ü¡£
ûÓзµ»ØÖµ
VARRAY»òǶÌ×±í
EXTEND(n,i)
EXTEND·½·¨Îª¼¯ºÏÖеĶà¸öÐÂÔªËØ·ÖÅä´æ´¢¿Õ¼ä¡£Ëü´øÓÐÁ½¸öÐÎʽ²ÎÊý£¬ÕâÁ½¸öÐÎʽ²ÎÊýÀàÐ;ùΪPLS_INTEGERÀàÐÍ¡£µÚÒ»¸ö²ÎÊý±íʾҪÌí¼Ó¶àÉÙ¸öÐÂÔªËØ£¬µÚ¶þ¸ö²ÎÊýÊÇÒýÓü¯ºÏÖÐÒÑÓеÄÔªËØ£¬¸ÃÔªËػᱻ¸´ÖƵ½ÐÂÔªËØÉÏ¡£Èç¹ûÊÔͼ·ÖÅä¿Õ¼äµÄÔªËس¬¹ýÁËVARRAYµÄLIMIT·µ»ØÖµ£¬¸Ã·½·¨¾Í»áʧ°Ü¡£
Ïà¹ØÎĵµ£º
¡¡¡¡oracle% sqlplus /nolog
¡¡¡¡SQL> conn / as sysdba
¡¡¡¡Êý¾Ý¿âµÄÎïÀíÎļþ
¡¡¡¡Êý¾ÝÎļþ
¡¡¡¡select file_name from dba_data_files;
¡¡¡¡¿ØÖÆÎļþ
¡¡¡¡select name from v$controlfile;
¡¡¡¡ÈÕÖ¾Îļþ
¡¡¡¡select member from v$logfile;
¡¡¡¡---------------------------------------------------------
......
µÚÒ»²½¡¢¼ì²é²Ù×÷ϵͳ»·¾³
rpm -q gcc make binutils openmotif glibc setarch compat-db compat-gcc-34 openmotif compat-gcc-34-c++ compat-libstdc++-33
Èç¹û¼ì²âµ½Äĸö°üûÓÐ×°£¬Ôò·Ö±ðÔÚISO¾µÏñÎļþÖÐÕÒµ½½øÐа²×°
¹ÒÔØ6ÕÅ»ò7ÕÅISOÎļþ£¬
±ÈÈç˵£ºrpm -ivh /mnt/iso/3/CentOS/openmotif*
Ö»ÒªÊÇûÓÐ×°µÄ¶¼Òª½øÐа ......
½¨±í
create table users(
id number(4) primary key,
username varchar2(10),
password varchar2(10)
)
²éѯ±í²¢½âËø±í(¼´¿ÉÒÔµã»÷ÊäÈë¿òÏÂÃæµÄ"Ëø"ͼ±ê¹¤¾ß, ¼´"Edit data")
select * from users for update
ɾ³ý±íÖжàÓàµÄÁÐ
alter table mobilephone drop column mobiletype
תÔØ
------------------- ......
Èý¡¢Ç¶Ì×±íµÄʹÓ÷½·¨
1¡¢½«Ç¶Ì×±í¶¨ÒåΪPL/SQLµÄ³ÌÐò¹¹Ôì¿é
TYPE type_name IS TABLE OF element_type[NOT NULL];
ÈçÏÂÀýËùʾ£º
DECLARE
-- Define a nested table of variable length strings.
TYPE card_table IS TABLE OF VARCHAR2(5 CHAR);
-- Declare and initialize a n ......