日期:2014-05-17  浏览次数:20845 次

ORACLE存储过程的问题
我现在写了段存储过程,代码如下:
create or replace procedure kehu is
begin

 MERGE INTO tbl_customer_temp B
USING (
  SELECT ID,
  name,
  phone,
  mobile,
  address,
  buyMachineType,
  buyDate,
  buyAddress,
  buyPrice,
  customerType,
  vipCard,
  content,
  email,
  area_id,
  area_code,
  area_name,
  importDirection
  FROM tbl_customer_amt_temp A
  WHERE A.IMPORTDIRECTION=1
)A
ON (B.ID=A.ID)
WHEN MATCHED THEN UPDATE SET 
  B.name=A.name,
  B.phone=A.phone,
  B.mobile=A.mobile,
  B.address=A.address,
  B.buyMachineType=A.buyMachineType,
  B.buyDate=A.buyDate,
  B.buyAddress=A.buyAddress,
  B.buyPrice=A.buyPrice,
  B.customerType=A.customerType,
  B.vipCard=A.vipCard,
  B.content=A.content,
  B.email=A.email,
  B.area_id=A.area_id,
  B.area_code=A.area_code,
  B.area_name=A.area_name,
  B.importDirection=A.importDirection
WHEN NOT MATCHED THEN INSERT (B.ID,
  B.name,
  B.phone,
  B.mobile,
  B.address,
  B.buyMachineType,
  B.buyDate,
  B.buyAddress,
  B.buyPrice,
  B.customerType,
  B.vipCard,
  B.content,
  B.email,
  B.area_id,
  B.area_code,
  B.area_name,
  B.importDirection)
values (A.ID,A.name,A.phone,A.mobile,A.address,A.buyMachineType,
A.buyDate,A.buyAddress,A.buyPrice,A.customerType,A.vipCard,A.content,A.email,A.area_id,A.area_code,
A.area_name,A.importDirection);
  

  UPDATE tbl_customer_amt_temp A
  SET IMPORTDIRECTION = 3
  where A.Importdirection = 1; end kehu;

想问下用PLSQL Developer怎么执行?


------解决方案--------------------
我的异常网推荐解决方案:oracle存储过程,http://www.aiyiweb.com/oracle-develop/177537.html
------解决方案--------------------
call kehu();
exec kehu();
都试试
------解决方案--------------------
SQL code
begin
  kehu;
end;

------解决方案--------------------
直接在存储过程中右键选择"test"后,再执行就可以了
------解决方案--------------------
直接EXECUTE kehu;