玩java,玩sql

public static void exeCmd(String commandStr) {
    BufferedReader br = null;
    try {
        Process p = Runtime.getRuntime().exec(commandStr);
        br = new BufferedReader(new InputStreamReader(p.getInputStream()));
        String line = null;
        StringBuilder sb = new StringBuilder();
        
        while ((line = br.readLine()) != null) {
            sb.append(line + "\n");
        }
        System.out.println(sb.toString());
    } catch (Exception e) {
        e.printStackTrace();
    }
    finally
    {
        if (br != null)
        {
            try {
                br.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
MERGE INTO YUNHU.ZTO_CRM_FACTURER d USING (
    select B.SITE_CODE,B.CENTER_CODE
    from YUNHU.ZTO_CRM_FACTURER A JOIN YUNHU.SITE_BASE_MAP B
        on A.EQUIPMENTNO = B.SITE_CODE
    where A.CENTER_CODE = ' '
) c on (c.SITE_CODE = d.EQUIPMENTNO)
WHEN matched THEN
UPDATE SET d.CENTER_CODE = c.CENTER_CODE;

你可能感兴趣的:(note)