¹ØÓÚplsqlÖеÄdefine±äÁ¿ÒÔ¼°Oracle±äÁ¿·ÖÀàС½á
¹ØÓÚplsqlÖеÄdefine±äÁ¿ÒÔ¼°Oracle±äÁ¿·ÖÀàС½á
2009-07-29 15:18
ÏȼÇÔظÕÀ§ÈÅÎÒµÄÒ»¸öÎÊÌ⣬×î½üѧϰplsql£¬ÓÉÓÚËùÓÃѧϰÊé¼®ºóÃæÌṩÌâÄ¿³£Óõ½define±äÁ¿£¬µ«ÓÉÓÚÕâÒ»±äÁ¿µÄʹÓÃÌØÊâÐÔ£¬×Ô¼º±ãѰ˼ÕâÒ»±äÁ¿ËùÊéÀà±ð£¬OracleÌṩµÄ±äÁ¿·ÖÀ๲ÓÐËÄÀࣺ
1£©±êÁ¿£¨scalar£©ÀàÐÍ
2£©¸´ºÏ£¨composite£©ÀàÐÍ
3£©²ÎÕÕ£¨reference£©ÀàÐÍ
4£©LOB£¨large object£©ÀàÐÍ
ÕâËÄÀàÖв¢Ã»ÓÐÓëֻƥÅäµÄ·ÖÀ࣬ÔÚÍøÂçÉϲéÕҲŷ¢ÏÖËüÊôÓÚµÚÎåÀࣨÁíÀࣺ£©£©——·ÇplsqlÀà±äÁ¿¡£
define±äÁ¿£ºÖ÷ÒªÓ¦ÓÃÓÚSQL*plsÒÔ¼°ÀàËÆÓÚsql*plusµÄ¿ª·¢¹¤¾ßÖУ¬Ö÷ÒªÓÃÓÚÓÚÓû§½»»¥¡£
¶¨Òå¸ñʽ£º
define p_variable_name = 500 -- ´Ëʱֱ½Ó½«500 assign¸øp_variable_name£¬²»»áµ¯³ö¶Ô»°¿òÌáʾÓû§ÊäÈë
define p_variable_name -- ±äÁ¿Î´¸³Öµ£¬µ¯³ö¶Ô»°¿òÌáʾÓû§ÊäÈëÖµ
ʹÓøñʽ£º
select department_id into v_dept from emp where employee_id=& p_variable_name;
ÏÖ½«ÍøÉÏһƪ¹ØÓÚ±äÁ¿·ÖÀàµÄ×ܽáÎÄÕÂתÌûÈçÏ¡£
ÔÌù³ö´¦£ºhttp://superman-chenzs.itpub.net/post/29327/272479
1¡¢±êÁ¿ÀàÐÍ£º
£ Ö»ÄÜ´æ·Åµ¥¸öÊýÖµµÄ±äÁ¿
£ ¶¨Òåʱ£¬±ØÐëÒªÖ¸¶¨±êÁ¿µÄÊý¾ÝÀàÐÍ
1.1³£ÓñêÁ¿ÀàÐÍ
£¨1£©VARCHAR2(n)
¶¨Òå¿É±ä³¤¶ÈµÄ×Ö·û´®
nÖ¸¶¨×Ö·û´®×î´ó³¤¶È
n×î´óÖµÊÇ32767×Ö½Ú
ʹÓÃʱ±ØÐëÖ¸¶¨³¤¶È
µ±ÔÚPLSQL¿éÖÓʹÓøÃÊý¾ÝÀàÐͲÙ×ÝVARCHAR2±íÁÐʱ£¬ÆðÊýÖµ³¤¶È²»Ó¦³¬¹ý4000×Ö½Ú
£¨2£©CHAR(n)
¶¨Òå¹Ì¶¨³¤¶È×Ö·û´®
nÖ¸¶¨×Ö·û´®µÄ×î´ó³¤¶È
n×î´óÖµÊÇ32767×Ô¼º
ʹÓÃʱָ¶¨³¤¶È£¬Èôûָ¶¨£¬ÔòʹÓÃĬÈÏÖµ1
µ±ÔÚPLSQL¿éÖÓʹÓøÃÊý¾ÝÀàÐͲÙ×ÝCHAR2±íÁÐʱ£¬ÆðÊýÖµ³¤¶È²»Ó¦³¬¹ý2000×Ö½Ú
£¨3£©NUMBER(p£¬s)
¶¨Òå¹Ì¶¨³¤¶ÈµÄÕûÊýºÍ¸¡µãÊý
p±íʾ¾«¶È£¬ÓÃÓÚÖ¸¶¨Êý×ÖµÄ×ÜλÊý
s±íʾ±ê¶È£¬ÓÃÓÚÖ¸¶¨Ð¡ÊýµãºóµÄÊý×ÖλÊý
£¨4£©DATE
¶¨ÒåÈÕÆÚºÍÊý¾ÝÊý¾Ý
£¨5£©BOOLEAN
¶¨Òå²¼¶û±äÁ¿
ֵΪ£ºTRUE¡¢FALSE¡¢NULL
ΪPLSQL¶ÀÓÐÊý¾ÝÀàÐÍ£¬±íÁв»ÄܲÉÓøÃÊý¾ÝÀàÐÍ
NULL±íʾmissing¡¢inapplicable»òÕßunknown
£¨6£©LONGºÍLONG ROW
long£ºÊý¾ÝÀàÐÍÓÃÓÚ¶¨Òå±ä³¤×Ö·û´®£¬ÀàËÆÓÚVARCHAR2Êý¾ÝÀàÐÍ£¬µ«Æä×Ö·û´®µÄ×î´ó³¤¶ÈΪ32760×Ö½Ú
long row£ºÊý¾ÝÀàÐÍÓÃÓÚ¶¨Òå±ä³¤µÄ¶þ½øÖÆÊý¾Ý£¬ÆäÊý¾Ý×î´ó³¤¶ÈΪ32760×Ö½Ú
£¨7£©BINARY_INTEGER
¶¨ÒåÕûÊý
ÊýÖµ·¶Î§-2147483647ºÍ2174483647Ö®¼ä
£¨8£©BINARY_FLOATºÍBINARY_DOUBLE
BINARY_FLOAT¶¨Òåµ¥¾«¶È¸¡µãÊý£¨oracle 10gÐÂÔö¼Ó£©
BINAR
Ïà¹ØÎĵµ£º
Ê×ÏÈÈ¥http://metalink.oracle.com ÏÂÔØÏà¹ØµÄ²¹¶¡°ü,ÒòΪÊÇ64λfor windowsµÄ°üÊÇp6810189_10204_MSWIN-x86-64.zip,ÏÂÔصØÖ·:
ftp://updates.oracle.com/6810189/p6810189_10204_MSWIN-x86-64.zip
²Ù×÷ÈçÏÂ.
(1) OracleÍƼöÔÚÉý¼¶Ö®Ç°ÏÈ×öÒ»¸öÈ«¿âµÄ±¸·Ý£»
(2) Í£Ö¹ËùÓеÄOracle·þÎñ
emctl stop dbconsole
isqlplusc ......
×Ó³ÌÐò ÃüÃûµÄpl/sql¿é
create procedure ¹ý³ÌÃû [²ÎÊý1 in|out|in out¡]
¾Ö²¿±äÁ¿ÉùÃ÷
Ö´ÐÐÓï¾ä
in
out
in out
¹ý³ÌÃû(²ÎÊýÀï±í); create or replace
procedure add123 as
i integer;
j integer;
begin
i:=1;
j:=2;
dbms_output.put_l ......
2010-03-12 21:21:26
sqlplusµÇ½¶ÌÏûÏ¢oracleÊý¾Ý¿âʱÌáʾ“ORA-28000: Õʺű»Ëø¶¨”¡£
תÌù£ºhttp://blog.csdn.net/shongyu/archive/2009/06/01/4233260.aspx
È·¶¨ÊÇÓÉÓÚoracle11gÖÐĬÈÏÔÚdefault¸ÅÒªÎļþÖÐÉèÖÃÁË“FAILED_LOGIN_ATTEMPTS=10´Î”£¬µ±ÊäÈëÃÜÂë´íÎó´ÎÊý´ïµ½ÉèÖÃÖµ½«µ¼Ö´ËÎÊÌâ¡£
° ......
ÔÁ´½Ó£ºhttp://www.oracle.com/webapps/dialogue/dlgpage.jsp?p_ext=Y&p_dlg_id=7731619&src=6817982&Act=4&sckw=APACMK09050910MPP005.GCM.8074.110
ÄÜ·ñÔÚµÚһʱ¼ä
»ñµÃÐÂÕ½ÂԵķ´À¡Òâ¼û£¿
ÄÜ·ñͨ¹ý¹ÜÀíÄ£ÐÍ
À´Ô¤²âÒµÎñÊý¾Ý£¿
......
1. ÔÚ´ò¿ªEnterprise Manager Consolʱ±¨´í: "ÕÒ²»µ½Ä¿±êÖ÷»ú";
¡¾½â¾ö·½°¸¡¿¸ÃÎÊÌâÔÚʹÓÃGhostÖÆ×÷µÄϵͳÖг£¼û, ³ö´íÔÒòÊÇOracleÖÐÅäÖõÄÖ÷»úÃû
ºÍʵ¼ÊµÄÖ÷»úÃû²»Ò»ÖÂ. ½â¾ö·½·¨ÈçÏÂ:
(1) Enterprise Manager Consol -> ¹¤¾ß²Ëµ¥ ->·þÎñ¹ÜÀí -> Oracle Net Manager;
(2) ½«"±¾µØ ......