¹ØÓÚORACLE PLSQL¶ÁÎļþ
ת×Ô£ºhttp://www.oracle.com/technology/obe/obe9ir2/obe-cnt/plsql/plsql.htm
¶¼Ëµ¶ÁÊé²»ÇóÉõ½âº¦ËÀÈË£¬Ò»µãÒ²²»´í£¬×î½üÎÒ´ÓÍøÉÏÌÔµ½¹ØÓÚORACLEÈçºÎ´ÓÊý¾Ý¿âĿ¼Ï¶ÁÎļþ£¬ÓÚÊǾÍÓÃÓÚÉú²úÁË£¬½á¹ûÉÏÁËÉú²ú£¬³ÌÐòËÀ»î¾ÍÊÇÅܲ»³öÀ´£¬ÔÒòÊÇÎÒÃǵķþÎñÆ÷×öÁËREC£¬Èç¹ûÔÚÁ½Ì¨»úÆ÷ÉÏÕÒÒ»¸öÄ¿Â¼ÄØ£¬ÒÔÇ°ÄØÔÚ×Ô¼ºµÄ³ÌÐòÀï°Ñ·¾¶Ð´ËÀÁË£¬ÔÚÒ»°ã·þÎñÆ÷ÉÏÑé֤ҲûÓÐÎÊÌ⣬¿ÉÊÇÈç¹ûÊÇË«»úÄØ£¿¾Í²»ÐÐÁË£¬ÄÇÎÒÃÇÖ»ºÃͨ¹ý¹²ÏíĿ¼À´ÊµÏÖ£¬¿ÉÊÇÓÐÁËĿ¼£¬³ÌÐò»¹ÊÇÕÒ²»µ½¾ø¶Ô·¾¶£¬Ôõô°ìÄØ£¬¿´ÏÂÃæµÄ³ÌÐò£¬Ëü¶¼ÊÇÔÚÊý¾Ý¿âÀï´´½¨ÁËÒ»¸öDIRECTORY£¬Ð޸ijÉËü£¬ÎÊÌâÓÈжø½â¡£
ͨ¹ýÏÂÃæµÄÀý×Ó£¬ºÃºÃÑо¿Ò»ÏÂORACLEÌṩ¸øÎÒÃǵŦÄܰɣ¡
Using New PL/SQL Features to Enhance Applications
Module Objectives
Purpose
This module describes how to utilize some of the latest PL/SQL capabilities to optimize performance and increase the efficiency of your PL/SQL applications..
Objectives
Upon completion of this module, you should be able to:
Use an Associative Array
Use the UTL_FILE package to manage access to directories, handle raw data, and copy, rename and delete files
Use Bulk binding in native dynamic SQL
Use PL/SQL RECORDs to access and manipulate changes to the database
Prerequisites
The prerequisites for this lesson are:
Completed the Preinstallation Tasks module
Completed the Installing the Oracle9i Database module
Download and unzip plsql.zip into your working directory
Reference Material
The following list represents some useful reference material should you need additional information on the topics in this module:
Documentation: PL/SQL User's Guide and Reference
Documentation: Supplied PL/SQL Packages and Types Reference
PL/SQL Whitepapers and Code Examples on OTN
Overview
The features you will explore in this lesson are:
1.
Using Associative Arrays
2.
Using the UTL_FILE Package
3.
Using Bulk Binding in Native Dynamic SQL
4.
Using PL/SQL Records
Using Associative Arrays
Back to List
In Oracle9i Database Release 2, PL/SQL index-by tables, now known as associative arrays, have been extended to allo
Ïà¹ØÎĵµ£º
OracleûÓÐ×Ô¶¯Ôö³¤µÄÊý¾ÝÀàÐÍ£¬ÎÒÃÇÐèÒª½¨Á¢Ò»¸ö×Ô¶¯Ôö³¤µÄÐòÁкţ¬²åÈë¼Ç¼ʱҪ°ÑÐòÁкŵÄÏÂÒ»¸öÖµ¸³ÓÚ´Ë×ֶΣ¡
create sequence type_id increment by 1 start with 1;
Õâ¾äÖУ¬type_idΪÐòÁкŵÄÃû³Æ£¬Ã¿´ÎÔö³¤Îª1£¬ÆðʼÐòºÅΪ1¡£
Èç¹ûҪɾ³ýÐòÁУ¬ÓÃdrop sequence ÐòÁÐÃû¾Í¿ÉÒÔÁË£¡£¡
ÐòÁпÉÒÔ±£Ö¤¶à¸öÓû§¶ÔÍ¬Ò»Õ ......
Oracle 9i±È8i¶àÁËÄÄЩÐÂÌØÐÔ£¿
¼òҪ˵£º
9i¸üÒ×ÓÚ¹ÜÀí¡£
Ïêϸ˵£º
²¢·¢¼¯Èº£¬8i OPSÉý¼¶Îª9i RAC£¬8i½áµã¼äÓÃÓ²Å̽»»»ÐÅÏ¢£¬9i½áµã¼ä²ÉÓøßËÙÍøÏߵĻº´æÈÛºÏ(Cache Fusion)¼¼Êõ½»»»ÐÅÏ¢£¬½»»»ËÙ¶ÈÌá¸ß100±¶ÒÔÉÏ¡£
9i¿ÉÒÔÔÚÏßÐÞ¸ÄÄں˲ÎÊýºÍÄÚ´æ·ÖÅä£ ......
--single line method
select ascii('A') Big_A from dual;
select chr(65) A, chr(122) z, chr(223) ch3 from dual;
select concat('sigo','way') from dual;
select initcap('sigoway') from dual;
select instr('ababab','a',-1,2), instr('ababab','a',1,3) from dual;
select instrb('ababab','a',1,3) from dua ......
¸Ãº¯ÊýÓÃÀ´·µ»ØÒ»¸öËÄÉáÎåÈëºóµÄÖµ
SELECT ROUND( number, [ decimalplaces ] ) from DUAL
參數:
±ØÌîÏnumber : Òª´¦ÀíµÄÊýÖµ(ÊýÖµ±í´ïʽ)
¿ÉÑ¡Ïdecimalplaces : ËÄÉáÎåÈëʱȡµÄСÊýµÄλÊý£¬²»ÌîÔò·µ»ØÕûÊý
Sample :
select round(123.456) from dual;& ......
1.´´½¨±í¿Õ¼ä
create tablespace test datafile'c:\test.dbf' size 10m; //Ãû×Ö²»ÒªÎªÊý×Ö
2.´´½¨Óû§
create user userName identified by password; //²»ÒªÎªÊý×Ö
3.¸øÓû§ÊÚȨ
grant dba to userName; --ÊÚÓèDBAȨÏÞ
grant unlimited tablespace to userName;--ÊÚÓè²»ÏÞÖÆµÄ±í¿Õ¼ä
grant sele ......