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

oracle´æ´¢¹ý³ÌÓ÷¨

  ´æ´¢¹ý³ÌÔÚ·þÎñÆ÷¶ËÔçÒѱ༭ִÐйýµÄ´úÂë¡£Óû§Òª×öµÄÖ»Êǵ÷ÓúͽÓÊÕ´æ´¢¹ý·µ»ØµÄ½á¹û¡£ËùÒÔµ÷Óô洢¹ý³Ì±ÈÆÕͨµÄÓòéѯÓï¾ä·µ»ØÖµÒª¿ìµÃ¶à,´æ´¢¹ý³ÌµÄÖ´ÐÐËٶȸü¿ì,´æ ´¢¹ý³ÌÊDZ£´æÆðÀ´µÄ¿ÉÒÔ½ÓÊܺͷµ»ØÓû§ÌṩµÄ²ÎÊýµÄ Transact-SQL Óï¾äµÄ¼¯ºÏ¡£¿ÉÒÔ´´½¨Ò»¸ö¹ý³Ì¹©ÓÀ¾ÃʹÓ㬻òÔÚÒ»¸ö»á»°ÖÐÁÙʱʹÓ㨾ֲ¿ÁÙʱ¹ý³Ì£©£¬»òÔÚËùÓлỰÖÐÁÙʱʹÓã¨È«¾ÖÁÙʱ¹ý³Ì£©¡£
oracle ´æ´¢¹ý³ÌµÄ»ù±¾Óï·¨ ¼°×¢ÒâÊÂÏî
1.»ù±¾½á¹¹
CREATE OR REPLACE PROCEDURE ´æ´¢¹ý³ÌÃû×Ö
(
    ²ÎÊý1 IN NUMBER,
    ²ÎÊý2 IN NUMBER
) IS
±äÁ¿1 INTEGER :=0;
±äÁ¿2 DATE;
BEGIN
END ´æ´¢¹ý³ÌÃû×Ö
   1¡¢isºÍasûÓÐÇø±ð£»
   2¡¢²ÎÊýÊÇ´Ó´æ´¢¹ý³ÌÍâÃæ´«ÈëµÄÖµ£»¶ø±äÁ¿ÊÇÔÚ´æ´¢¹ý³ÌÀïÃ涨ÒåµÄ¡£
2.SELECT INTO STATEMENT
½«select²éѯµÄ½á¹û´æÈëµ½±äÁ¿ÖУ¬¿ÉÒÔͬʱ½«¶à¸öÁд洢¶à¸ö±äÁ¿ÖУ¬±ØÐëÓÐÒ»Ìõ
¼Ç¼£¬·ñÔòÅ׳öÒì³£(Èç¹ûûÓмǼÅ׳öNO_DATA_FOUND)
Àý×Ó£º
BEGIN
SELECT col1,col2 into ±äÁ¿1,±äÁ¿2 from typestruct where xxx;
EXCEPTION
WHEN NO_DATA_FOUND THEN
     xxxx;
END;
...
3¡¢±äÁ¿¸³Öµ
±äÁ¿Ãû := Öµ;
E.g£º
create or replace procedure test(workDate in Date) is
x number(4,2);
begin
x := 1;
end test;
4¡¢ÅжÏÓï¾ä:
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;
5¡¢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)


Ïà¹ØÎĵµ£º

ORACLE PL/SQL ¶ÔÏó(object)ѧϰ±Ê¼Ç(¶þ)

4¡¢¶ÔÏóÒÀÀµÐÔ
 
CREATE OR REPLACE TYPE Obj1 AS OBJECT (
f1 NUMBER,
f2 VARCHAR2(10),
f3 DATE
);
/

CREATE OR REPLACE TYPE Obj2 AS OBJECT (
f1 DATE,
f2 CHAR(1)
);
/

CREATE OR REPLACE TYPE Obj3 AS OBJECT (
a Obj1,
b Obj2
);
/
  
 
OBJ3ÒÀÀµÓÚOBJ ......

ORACLE PL/SQL ¶ÔÏó(object)ѧϰ±Ê¼Ç(Èý)

7¡¢¶ÔÏóÀàÐͼ̳Ð
 
¶ÔÏóÀàÐÍʵÏÖÔÊÐíÎÒÃÇ´´½¨Ò»¸ö»ùÀàÐÍ£¬»ò½Ð¸¸ÀàÐÍ£¬ÕâÖÖÀàÐ͵ÄÊôÐÔ»ò·½·¨¿ÉÒÔ±»ÁíÒ»¸ö¶ÔÏóÀàÐͼ̳С£È»ºó¿ÉÒÔ´´½¨Ò»¸ö×ÓÀàÐÍ£¬»ò½Ðº¢×ÓÀàÐÍ£¬Ö±½ÓʹÓü̳йýÀ´µÄÊôÐÔ»ò·½·¨£¬»òÕßÓÃ×Ô¼ºµÄÊôÐԺͷ½·¨ÖØд¸¸ÀàÐ͵ÄÊôÐÔ»ò·½·¨¡£
 
INSTANTIABLE¹Ø¼ü×Ö±íʾÎÒÃÇ¿ÉÒÔ´Ó¸ÃÀàÐÍÖÐʵÀý»¯»òÕß´´½¨¶ÔÏ ......

OracleÓÃÓαê·Ö½âºÅÂë´ÎÊý

drop table tb_wjf_xh_dg100_50_tmp4 purge; 
create table tb_wjf_xh_dg100_50_tmp4
 (
 servnumber varchar(11)
 )
;
  
declare
      vv_cusor_servnumber  varchar2(32);
      vv_cusor_lost_cnt  & ......

Oracle ֪ʶ

ORACLEÏà¹ØÓï·¨ ÊÕ²Ø
Ò»¡¢OracleÈëÃÅ
  ÀíÂÛ֪ʶ£º
    OracleµÄÎïÀí×é¼þÓÐÈý¸ö£º
      (1)Êý¾ÝÎļþ     Êý¾ÝÎļþÊÇÓÃÓÚ´æ´¢Êý¾Ý¿âÊý¾ÝµÄÎļþ£¬Èç±í¡¢Ë÷ÒýÊý¾Ý¡£Ã¿¸öOracleÊý¾Ý¿âÓÐÒ»¸ö»ò¶à¸öÎïÀíÊý¾ÝÎļþ£¬
     &nbs ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ