Created
March 1, 2010 08:14
-
-
Save qichunren/318193 to your computer and use it in GitHub Desktop.
oracle存储过程
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--搜索关键字的记录 | |
CREATE OR REPLACE PROCEDURE P_NEWKEYWORD( | |
p_keyword VARCHAR | |
)IS | |
v_keyword_id number; | |
v_now date:=sysdate; | |
BEGIN | |
BEGIN | |
SELECT ID INTO v_keyword_id FROM KEYWORDS WHERE keyword=p_keyword AND ROWNUM=1; | |
UPDATE KEYWORDS | |
SET COUNTS=COUNTS+1 | |
WHERE ID=v_keyword_id; | |
EXCEPTION | |
WHEN NO_DATA_FOUND THEN | |
SELECT KEYWORDS_SEQ.NEXTVAL INTO v_keyword_id FROM DUAL; | |
INSERT INTO KEYWORDS | |
(ID,keyword,spell,counts,state,created_at,updated_at) | |
values | |
(v_keyword_id,p_keyword,'','0','0',v_now,v_now); | |
END; | |
END P_NEWKEYWORD; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment