首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

ORACLE存储过程的有关问题

2013-03-26 
ORACLE存储过程的问题我现在写了段存储过程,代码如下:create or replace procedure kehu isbeginMERGE INT

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.myexception.cn/oracle-develop/177537.html
[解决办法]
call kehu();
exec kehu();
都试试
[解决办法]

SQL code
begin  kehu;end;
[解决办法]
直接在存储过程中右键选择"test"后,再执行就可以了
[解决办法]
直接EXECUTE kehu;

热点排行