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
Ïà¹ØÎĵµ£º
TkprofÊÇÒ»¸öÓÃÓÚ·ÖÎöOracle¸ú×ÙÎļþ²¢ÇÒ²úÉúÒ»¸ö¸ü¼ÓÇåÎúºÏÀíµÄÊä³ö½á¹ûµÄ¿ÉÖ´Ðй¤¾ß¡£Èç¹ûÒ»¸öϵͳµÄÖ´ÐÐЧÂʱȽϵͣ¬Ò»¸ö±È½ÏºÃµÄ·½·¨ÊÇͨ¹ý¸ú×ÙÓû§µÄ»á»°²¢ÇÒʹÓÃTkprof¹¤¾ßʹÓÃÅÅÐò¹¦Äܸñʽ»¯Êä³ö£¬´Ó¶øÕÒ³öÓÐÎÊÌâµÄSQLÓï¾ä¡£
Ò». TKPROF ÃüÁîÓï·¨£º
TKPROF filename1, filename2  ......
oracle ÖÁ½ñûÓÐÍƳöÕë¶Ôwin7µÄ°æ±¾£¬ÎÞÄÎ֮ϲéѯÍøÂ磬ÍøÉÏ´óϺ±íʾÐÞ¸Ärefhost.xmlÎļþ¼´¿É¡£
½øÈë×Ô¼ºÊµÕ½½×¶Î£¬´Óoracle¹Ù·½ÏÂÔØoracle 10g for vista and windows2K8 x86°æ(for windowsÊÇÖ§³ÖvistaÄں˵ģ¬win7µÄÄÚºËÓë2008ÒÔ¼°vistaµÄÄÚºËÊÇÒ»Ñù)¡£
Ïȵã»÷°²×°£¬ÔÚ°²×°µÄ°æ±¾¼ì²âʱÌáʾĿǰoracle²»Ö§³ÖversionΪ6 ......
רÓÐģʽ£º
ÔÚרÓзþÎñÆ÷ÅäÖÃÖУ¬OracleΪÿ¸öÁ¬½Óµ½·þÎñÆ÷µÃ¿Í»§»úÆô¶¯Ò»¸öרÓ÷þÎñÆ÷½ø³Ì¡£Ò»¸ö¿Í»§»úµÄרÓ÷þÎñÆ÷½ø³ÌֻΪ´Ë¿Í»§»ú¹¤×÷¡£¸÷רÓ÷þÎñÆ÷½ø³ÌÍêÈ«¶ÀÁ¢£¬ÎÞÐè¹²ÏíÊý¾Ý¡£ÔÚÓû§»á»°´æÔÚµÄÕû¸ö¹ý³ÌÖУ¬ÏàÓ¦µÄרÓ÷þÎñÆ÷½ø³ÌÒ»Ö±´æÔÚ£¬²»ÂÛÓû§ÊÇ·ñ»î¶¯¡£Ö±µ½Óû§»á»°ÖÕÖ¹ºó£¬¸ÃÓ¦ÓõÄרÓ÷þÎñÆ÷½ø³Ì²ÅÖÕÖ¹¡£ÔÚ ......
OracleÓû§¡¢È¨ÏÞ¡¢½ÇÉ«¹ÜÀí
Oracle ȨÏÞÉèÖÃ
Ò»¡¢È¨ÏÞ·ÖÀࣺ
ϵͳȨÏÞ£ºÏµÍ³¹æ¶¨Óû§Ê¹ÓÃÊý¾Ý¿âµÄȨÏÞ¡££¨ÏµÍ³È¨ÏÞÊǶÔÓû§¶øÑÔ)¡£
ʵÌåȨÏÞ£ºÄ³ÖÖȨÏÞÓû§¶ÔÆäËüÓû§µÄ±í»òÊÓͼµÄ´æȡȨÏÞ¡££¨ÊÇÕë¶Ô±í»òÊÓͼ¶øÑԵģ©¡£
¶þ¡¢ÏµÍ³È¨ÏÞ¹ÜÀí£º
1¡¢ÏµÍ³È¨ÏÞ·ÖÀࣺ
DBA: ÓµÓÐÈ«²¿ÌØȨ£¬ÊÇϵͳ×î¸ßȨÏÞ£¬Ö»ÓÐDBA²Å¿ÉÒÔ´´ ......
·½Ê½Ò».
Ö´ÐÐÒÔÏÂsqlÓï¾ä´´½¨database link
create database link test_link --Á´½ÓÃû
connect to Óû§Ãû identified by ÃÜÂë
using '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = Êý¾Ý¿â·þÎ ......