oracle 定义临时变量,并使用分支判断
Posted 幸福安康
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle 定义临时变量,并使用分支判断相关的知识,希望对你有一定的参考价值。
declare tempCount int; tempID VARCHAR2(8); begin select count(*) into tempCount from CUSTOMER_PROFILE where id=:CUSTOMER_ID; if tempCount>0 then update CUSTOMER_PROFILE set name=:CUSTOMER_NAME,address=:CUSTOMER_ADDRESS,phone=:CUSTOMER_PHONE,description=:CUSTOMER_DESCRIPTION,update_user_id=:USER_ID,update_date=sysdate; else begin select ID into tempID from ID_POOL where status=0 and rownum=1; insert into CUSTOMER_PROFILE(id,name,address,phone,description,create_user_id) values(tempID,:CUSTOMER_NAME,:CUSTOMER_ADDRESS,:CUSTOMER_PHONE,:CUSTOMER_DESCRIPTION,:USER_ID); update ID_POOL set STATUS=1 where id=tempID; end; end if; end;
以上是关于oracle 定义临时变量,并使用分支判断的主要内容,如果未能解决你的问题,请参考以下文章