#!/bin/sh sqlplus -s user/[email protected] <<END SET serveroutput ON; BEGIN MERGE INTO TESTA t USING TESTA_TEMP s ON ( t.WAFER_ID = s.WAFER_ID ) WHEN MATCHED THEN UPDATE SET t.bin1 = s.bin1 WHEN NOT MATCHED THEN INSERT ( id, bin1, wafer_id ) VALUES ( s.id, s.bin1, s.wafer_id ); END; / END