Çë½ÌÒ»¸öoracle´æ´¢¹ý³ÌµÄÎÊÌâ - Oracle / »ù´¡ºÍ¹ÜÀí
´úÂëÈçÏ£º
create procedure putdraw
(ID char,money number)
as
vbalance number,vname char;
begin
select Bmoney,name into vbalance,vname from bankcheck
where CIN=ID;
if(vname is null) then
raise_application_error(-20000,'please create a zhanghao');
end if;
update bankcheck set Bmoney=Bmoney+money
where CIN=ID;
end;
/
ҪʵÏÖ¶Ôbankcheck´æÇ®£¬Èç¹ûûÓÐÕË»§¾ÍÐèÒªÖØпªÐÂÕË»§£¬ÉÏÃæ³ö´í²»ÖªÔõô´¦Àí£¬Íû¸÷λ¸ßÊÖÖ¸µãÏÂ
ûÈË£¬×Ô¼º¶¥¶¥ÏÈ
if Äã¼ÓÀ¨ºÅÁË¡£
vname char;
¸Ä³ÉVARCHAR2(5)
½¨ÒéÓÃmerge
merge into tablea
using tableb
on (conditions)
when matched then
update
set ...
when not matched then
insert into
values (...)
¹Ø¼ü´íÎóÔÚÓÚÄ㶨ÒåµÄÁ½¸ö±äÁ¿Ö®¼ä²»ÄÜÓöººÅ·Ö¸ô¡£
SQL code:
SQL> create procedure putdraw
2 (ID char,money number)
3 as
4 vbalance number;
5 vname char;
6 begin
7 select Bmoney,name into vbalance,vname from bankcheck
8 where CIN=ID;
9 if(vname is null) then
10 raise_application_error(-20000,'please create a zhanghao');
11 end if;
12 update bankcheck set Bmoney=Bmoney+money
13 where CIN=ID;
14 end;
15 /
Procedure created
SQL> select * from bankcheck;
BMONEY NAME CIN
---------- -----
Ïà¹ØÎÊ´ð£º
ÎÒÊÇÓÃÔ¶³Ì×ÀÃæÁ¬²Ù×÷·þÎñÆ÷ÉϵÄÊý¾Ý¿â¡£
ÔÚ´´½¨Ò»¸öÓû§Ö®ºó£¬ÔÙÓÃPLSQLµÇ¼£¬ÔòPLSQLËÀµôÁË¡£
ÎҹصôPLSQLÖ®ºó£¬ÓÃÆäËûÓû§Ò²²»ÄܵǼ¡£
ÎÒ°ÑoracleµÄ·þÎñÍ£Ö¹£¬½á¹û¾ÍÊÇoracleµÄ·þÎñ״̬¾ÍÍ£ÁôÔÚ¡°Í ......
ÔÚÖ´ÐаüµÄʱºòÒýÓÃoracle spatial¿Õ¼äº¯Êý³ö´í£¬³ö´íÇé¿öÈçÏÂ
Errors in file
/user/oracle/app/oracle/admin/grid/udump/grid1_ora_143768.trc: ORA-29902:
error in executing ODCIIndexStart() routine ORA-0 ......
ÎҵĴ¦ÀíÊÇÕâÑùµÄ£º
ÎÒÓÐÒ»¸öºÜ´óµÄÊý¾Ý¼¯ºÏ£¬´¦ÓÚÐÔÄÜ·½ÃæµÄ¿¼ÂÇÐèҪʹÓÃÁÙʱ±í¹ý¶É£¬²¢ÇÒʹÓ÷ÖÒ³µÄ·½Ê½ÏòÁÙʱ±íÖвåÈëÊý¾Ý£¬Êý¾ÝʹÓÃÍê±Ïºó£¬É¾³ýÁÙʱ±íµÄÊý¾Ý¡£
³öÏÖµÄÏÖÏ󣺵±OracleÖØÐÂÆô¶¯ºó£¬µÚÒ»Ò³²åÈëµÄ ......
ORACLEÅàѵ(OCA)ÈÏÖ¤½éÉÜ
Oracle10g Certified Associate (OCA) Oracle ÈÏ֤רԱ¡£
¿¼ÊԳɼ¨Í¨¹ýÄÜ»ñµÃOracle¹«Ë¾ÎªÄú°ä·¢µÄÈ«ÇòÈÏÖ¤µÄÓ¢ÎÄOCAÖ¤Êé¡£OCAÓÉOracle¹«Ë¾³öÌâ¡£
¸ÃÖ¤Êé¿É×÷Ϊ¸÷ÆóÊÂÒµµ¥Î»Êý¾Ý¿ ......
oracleº¯ÊýÈçÏ£º
create or replace function P_WEB_GETCITYID
(
p_mobileNumber in VARCHAR2,
p_cityid out NUMBER
) Return NUMBER
IS
p_areacode varc ......