Oracle´æ´¢¹ý³Ì×ܽá
1¡¢´´½¨´æ´¢¹ý³Ì
create or replace procedure test(var_name_1 in type,var_name_2 out type) as
--ÉùÃ÷±äÁ¿(±äÁ¿Ãû ±äÁ¿ÀàÐÍ)
begin
--´æ´¢¹ý³ÌµÄÖ´ÐÐÌå
end test;
´òÓ¡³öÊäÈëµÄʱ¼äÐÅÏ¢
E.g:
create or replace procedure test(workDate in Date) is
begin
dbms_output.putline('The input date is:'||to_date(workDate,'yyyy-mm-dd'));
end test;
2¡¢±äÁ¿¸³Öµ
±äÁ¿Ãû := Öµ;
E.g£º
create or replace procedure test(workDate in Date) is
x number(4,2);
begin
x := 1;
end test;
3¡¢ÅжÏÓï¾ä:
if ±È½Ïʽ then begin end; end if;
E.g
create or replace procedure test(x in number) is
begin
if x >0 then
begin
x := 0 - x;
end;
end if;
if x = 0 then
begin
x: = 1;
end;
end if;
end test;
4¡¢For Ñ»·
For ... in ... LOOP
--Ö´ÐÐÓï¾ä
end LOOP;
(1)Ñ»·±éÀúÓαê
create or replace procedure test() as
Cursor cursor is select name from student; name varchar(20);
begin
for name in cursor LOOP
begin
dbms_output.putline(name);
end;
end LOOP;
end test;
(2)Ñ»·±éÀúÊý×é
create or replace procedure test(varArray in myPackage.TestArray) as
--(ÊäÈë²ÎÊývarArray ÊÇ×Ô¶¨ÒåµÄÊý×éÀàÐÍ£¬¶¨Ò巽ʽ¼û±êÌâ6)
i number;
begin
i := 1; --´æ´¢¹ý³ÌÊý×éÊÇÆðʼλÖÃÊÇ´Ó1¿ªÊ¼µÄ£¬Óëjava¡¢C¡¢C++µÈÓïÑÔ²»Í¬¡£ÒòΪÔÚOracleÖб¾ÊÇûÓÐÊý×éµÄ¸ÅÄîµÄ£¬Êý×éÆäʵ¾ÍÊÇÒ»ÕÅ
--±í(Table),ÿ¸öÊý×éÔªËØ¾ÍÊDZíÖеÄÒ»¸ö¼Ç¼£¬ËùÒÔ±éÀúÊý×éʱ¾ÍÏ൱ÓÚ´Ó±íÖеĵÚÒ»Ìõ¼Ç¼¿ªÊ¼±éÀú
for i in 1..varArray.count LOOP
dbms_output.putline('The No.'|| i || 'record in varArray is:'||varArray(i));
end LOOP;
end test;
5¡¢While Ñ»·
whi
Ïà¹ØÎĵµ£º
½üÀ´½ÓÁ˸ö¼òµ¥µÄϵͳ×ö£¬Íâ°üµÄ£¬ÓõÄÊý¾Ý¿âÊÇoracle8i,
Ò»¿ªÊ¼ÎÒʹÓà ojdbc6.jarÀ´×öÁ¬½Ó£¬Á¬²»ÉÏ£¬ÕÒÒ»·¬£¬ÔÀ´¹Ù·½oracle8i³öµÄÇý¶¯Ö»ÓÐ class12.jar ºÍclass14.jar ,×îÒªÃüµÄÊDz»Ö§³Öjdk1.4¼°1.4ÒÔÉϵ쬹¤×÷Á¿ÂíÉϾÍÉÏÀ´ÁË¡£²»¸ÊÐİ¡¡£
×îºóÊÔÁËÏ£¬ÄÜÓõÄÖ»ÓÐojadb14.jar £¬Á¬ÉÏÁË£¬²»¹ýͨ¹ýhibernateÉú³ÉµÄsqlÊµÔ ......
TkprofÊÇÒ»¸öÓÃÓÚ·ÖÎöOracle¸ú×ÙÎļþ²¢ÇÒ²úÉúÒ»¸ö¸ü¼ÓÇåÎúºÏÀíµÄÊä³ö½á¹ûµÄ¿ÉÖ´Ðй¤¾ß¡£Èç¹ûÒ»¸öϵͳµÄÖ´ÐÐЧÂʱȽϵͣ¬Ò»¸ö±È½ÏºÃµÄ·½·¨ÊÇͨ¹ý¸ú×ÙÓû§µÄ»á»°²¢ÇÒʹÓÃTkprof¹¤¾ßʹÓÃÅÅÐò¹¦Äܸñʽ»¯Êä³ö£¬´Ó¶øÕÒ³öÓÐÎÊÌâµÄSQLÓï¾ä¡£
Ò». TKPROF ÃüÁîÓï·¨£º
TKPROF filename1, filename2  ......
1£®top
topÃüÁî¿ÉʵʱµØÏÔʾLinuxϵͳµÄ½ø³Ì¡¢CPU¡¢ÄÚ´æ¡¢¸ºÔصȵÄÐÅÏ¢¡£ËüÊÇÎÒÃÇÁ˽âϵͳÕûÌå״̬×îºÃµÄ¹¤¾ß¡£
topÃüÁîµÄÔËÐÐ״̬ÊÇÒ»¸öʵʱµÄÏÔʾ¹ý³Ì£¬ÎÒÃÇ¿ÉÔÚÕâ¸ö½çÃæ¼à¿ØÏµÍ³ÔËÐÐÇé¿ö¡£ÎÒÃÇ¿Éͨ¹ý¼¸¸ö°´¼üÀ´¿ØÖÆtopÃüÁÈç°´q¿ÉÍ˳ötopÃüÁî״̬£¬°´s¿ÉÊäÈëÐÅÏ¢µÄ¸üÐÂÆµÂʵȡ£ÕâЩÃüÁî¿É°´h°ïÖú¼ü²éѯ¡£
2£®Ps ......
[oracle@dba01 dbs]$ orapwd file=/oracle/app/oracle/product/10.2.0/db_1/dbs/orapworcl password=oracle entries=20 force=y
[oracle@dba01 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Sat May 29 13:07:10 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Con ......
oracle ÖÁ½ñûÓÐÍÆ³öÕë¶Ôwin7µÄ°æ±¾£¬ÎÞÄÎ֮ϲéÑ¯ÍøÂç£¬ÍøÉÏ´óϺ±íʾÐÞ¸Ärefhost.xmlÎļþ¼´¿É¡£
½øÈë×Ô¼ºÊµÕ½½×¶Î£¬´Óoracle¹Ù·½ÏÂÔØoracle 10g for vista and windows2K8 x86°æ(for windowsÊÇÖ§³ÖvistaÄں˵ģ¬win7µÄÄÚºËÓë2008ÒÔ¼°vistaµÄÄÚºËÊÇÒ»Ñù)¡£
Ïȵã»÷°²×°£¬ÔÚ°²×°µÄ°æ±¾¼ì²âʱÌáʾĿǰoracle²»Ö§³ÖversionΪ6 ......