日期:2014-05-16  浏览次数:20406 次

oracle merge语法使用,以及参数设定

"MERGE INTO MERCURY_VRM_CACHE cache
USING (
? SELECT :1 reg, :2 colour, :3 fuel, :4 transmission, :5 regDate, :6 doors, :7 capId, :8 capCode, :9 bodyType, :10 previous
? FROM DUAL) incoming
ON (cache.registration = incoming.reg)
WHEN MATCHED THEN
? UPDATE SET cache.colour = incoming.colour, cache.fuel = incoming.fuel, cache.transmission = incoming.transmission,
???????????? cache.date_of_registration = incoming.regDate, cache.doors = incoming.doors, cache.cap_id = incoming.capId, cache.cap_code = incoming.capCode,
??? ??? ??? ?cache.body_type = incoming.bodyType, cache.previous_owners = incoming.previous
WHEN NOT MATCHED THEN
? INSERT (cache.REGISTRATION, cache.COLOUR, cache.FUEL, cache.TRANSMISSION, cache.DATE_OF_REGISTRATION, cache.DOORS, cache.CAP_ID, cache.CAP_CODE, cache.BODY_TYPE, cache.PREVIOUS_OWNERS)
? VALUES (incoming.reg, incoming.colour, incoming.fuel, incoming.transmission, incoming.regDate, incoming.doors, incoming.capId, incoming.capCode, incoming.bodyType, incoming.previous)"

?

select *? from stockinf where stockcode = :1