Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

oracle %type

1¡¢Ê¹ÓÃ%TYPE
ÔÚÐí¶àÇé¿öÏ£¬PL/SQL±äÁ¿¿ÉÒÔÓÃÀ´´æ´¢ÔÚÊý¾Ý¿â±íÖеÄÊý¾Ý¡£ÔÚÕâÖÖÇé¿öÏ£¬±äÁ¿Ó¦¸ÃÓµÓÐÓë±íÁÐÏàͬµÄÀàÐÍ¡£ÀýÈ磬students±íµÄfirst_nameÁеÄÀàÐÍΪVARCHAR2(20),ÎÒÃÇ¿ÉÒÔ°´ÕÕÏÂÊö·½Ê½ÉùÃ÷Ò»¸ö±äÁ¿
DECLARE
v_FirstName VARCHAR2(20);
µ«ÊÇÈç¹ûfirst_nameÁеĶ¨Òå¸Ä±äÁ˻ᷢÉúʲô£¨±ÈÈç˵±í¸Ä±äÁË£¬first_nameÏÖÔÚµÄÀàÐͱäΪVARCHAR2(25)£©£¿ÄǾͻᵼÖÂËù ÓÐʹÓÃÕâ¸öÁеÄPL/SQL´úÂ붼±ØÐë½øÐÐÐ޸ġ£Èç¹ûÄãÓкܶàµÄPL/SQL´úÂ룬ÕâÖÖ´¦Àí¿ÉÄÜÊÇÊ®·ÖºÄʱºÍÈÝÒ׳ö´íµÄ¡£
Õâʱ£¬Äã¿ÉÒÔʹÓÔ%TYPE”ÊôÐÔ¶ø²»Êǽ«±äÁ¿ÀàÐÍÓ²ÐÔ±àÂë¡£
ÀýÈ磺
DECLARE
v_FirstName students.first_name%TYPE;
ͨ¹ýʹÓÃ%TYPE,v_FirstName±äÁ¿½«Í¬students±íµÄfirst_nameÁеÄÀàÐÍÏàͬ£¨¿ÉÒÔÀí½âΪ½«Á½Õ߰ÆðÀ´£©¡£
ÿ´ÎÄäÃû¿é»òÃüÃû¿éÔËÐиÃÓï¾ä¿éÒÔ¼°±àÒë´æ´¢¶ÔÏ󣨹ý³Ì¡¢º¯Êý¡¢°ü¡¢¶ÔÏóÀàºÍ´¥·¢Æ÷£©Ê±£¬¾Í»áÈ·¶¨¸ÃÀàÐÍ¡£
ʹÓÃ%TYPEÊǷdz£ºÃµÄ±à³Ì·ç¸ñ£¬ÒòΪËüʹµÃPL/SQL¸ü¼ÓÁé»î£¬¸ü¼ÓÊÊÓ¦ÓÚ¶ÔÊý¾Ý¿â¶¨ÒåµÄ¸üС£
ÀýÈ磺
declare
v_id hr.jobs.job_id%type;
v_title hr.jobs.job_title%type;
begin
select job_id,job_title into v_id,v_title
from hr.jobs
where job_id ='&aa';
dbms_output.put_line('ÐòºÅ'||v_id );
dbms_output.put_line('Ãû³Æ'||v_title);
end;
Ö´ÐУ¬ÎÒÃÇÊäÈëaa±äÁ¿µÄÖµ£ºAD_VP
Êä³ö½á¹ûΪ£º
ÐòºÅAD_VP
Ãû³ÆAdministration Vice President
2 ʹÓÃ%ROWTYPE  (Ï൱ÓÚ¶¨ÒåÒ»¸östruct À´½øÐдæ·Å£¬ÒÔ¶ÔÏóÀ´¿´¶ÔÊý¾Ý£©
ÔÚPL/SQLÖн«Ò»¸ö¼Ç¼ÉùÃ÷Ϊ¾ßÓÐÏàͬÀàÐ͵ÄÊý¾Ý¿âÐеÄ×÷·¨ÊǺܳ£¼ûµÄ¡£PL/SQLÌṩÁË%ROWTYPEÔËËã·û£¬Ê¹µÃÕâÑùµÄ²Ù×÷¸üΪ·½±ã¡£
ÀýÈ磺
DECLARE
v_StudentRecord students%ROWTYPE;
½«¶¨ÒåÒ»¸ö¼Ç¼£¬¸Ã¼Ç¼ÖеÄ×ֶν«Óëstudents±íÖеÄÁÐÏà¶ÔÓ¦¡£
ÀýÈ磺
declare
v_jobs hr.jobs%rowtype;
begin
select * into v_jobs
from hr.jobs
where job_id ='&aa';
dbms_output.put_line('ÐòºÅ'||v_jobs.job_id );
dbms_output.put_line('Ãû³Æ'||v_jobs.job_title);
end;
Ö´ÐУ¬ÎÒÃÇÊäÈëaa±äÁ¿µÄÖµ£ºAD_VP
Êä³ö½á¹ûΪ£º
ÐòºÅAD_VP
Ãû³ÆAdministration Vice President
×÷Õߣºtshfang
À´Ô´: ÄàÅßÎÄÕÂд×÷ http://www.nipei.com Ô­ÎĵØÖ·£º http://www.nipei.com/article/2384


Ïà¹ØÎĵµ£º

oracleÊ÷Ðνṹ²éѯ

select dm_id, father_id, dm_name from gy_dmcode t
where level  <= 2    --²ã¼¶
start with t.dm_id = '0' --¸ù½Úµã
connect by prior t.dm_id = t.father_id;  --¶¨Òå¹Øϵ£¬prior ±íʾÓÅÏȼ¶ ......

oracleÔÚlinuxÏÂÆô¶¯Ïà¹ØÃüÁî

1¡¢´ÓrootÓû§Çл»µ½oracleÓû§
#su - oracle
2¡¢ÀûÓÃnologÑ¡ÏîÆô¶¯sql*plus¹¤¾ß³ÌÐò
$slqplus /nolog
3¡¢ÀûÓÃsysdbaÉí·ÝÆô¶¯oracleÊý¾Ý¿â
sql>connect / as sysdba
sql>startup
4¡¢Æô¶¯Êý¾Ý¿âµÄ¼àÌýÆ÷listener
$lsnrctl start
»ò
$lsnrctl
lsnrctl>start
5¡¢¹Ø±ÕoracleÊý¾Ý¿â¼àÌý
$lsnrctl stop
6¡ ......

oracle online documentation

oracle 9i online documentation:
http://www.oracle.com/pls/db92/db92.docindex?remark=homepage
oracle 10g online documentation:
http://www.oracle.com/pls/db102/homepage
oracle 11g online documentation:
http://www.oracle.com/pls/db111/homepage ......

OracleËÀËø

OracleËÀËø
1¡¢Ê²Ã´ÊÇËÀËø
¡¡¡¡ËÀËøÊÇÖ¸ÔÚÒ»×é½ø³ÌÖеĸ÷¸ö½ø³Ì¾ùÕ¼Óв»»áÊͷŵÄ×ÊÔ´£¬µ«Òò»¥ÏàÉêÇë±»ÆäËû½ø³ÌËùÕ¾Óò»»áÊͷŵÄ×ÊÔ´¶ø´¦ÓÚµÄÒ»ÖÖÓÀ¾ÃµÈ´ý״̬¡£ËÀËø²úÉúÓÐËĸö±ØÒªµÄÌõ¼þ£º»¥³âÌõ¼þ£¬²»¿É°þ¶áÌõ¼þ£¬²¿·Ö·ÖÅ䣬ѭ»·µÈ´ý£¬ÕâËĸöÌõ¼þ²»Êdzä·ÖÌõ¼þ£¬¼´Ê¹ÕâËĸöÌõ¼þͬʱ´æÔÚ£¬ÏµÍ³Ò²²»Ò»¶¨·¢ÉúËÀËø£¬µ«ÏµÍ³Ò»µ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ