JDBC增删改查,以增为例
有张表pl_policys,字段很多
第一步,在PL/SQL中直接将表拖入到空白处,选插入会自动产生以下语句
insert into pl_policys (policy_id, fly_type_did, policy_type_did, air_com_dcd, from_city_dcd, to_city_dcd, trans_city_dcds, is_team, psgr_multi_type_did, flight_no, match_flight_type_did, rtn_flight_no, match_rtn_flight_type_did, weekday_limit, rtn_weekday_limit, match_cabin, rebate_point, rebate_cashback, rtn_rebate_value, sale_start_date, sale_end_date, travel_start_date, travel_end_date, rtn_start_date, rtn_end_date, ticket_type_codes, is_auto_ticket, is_shared, is_chg_pnr, is_support_inf, ticket_office_no, pnr, receipt_type_did, support_cert_type_did, earliest_ticket_days, latest_ticket_days, except_dates, return_except_dates, depart_time, arrive_time, rtn_depart_time, rtn_arrive_time, special_cmd_code, other_cmd_code, is_allow_adv_pmt, p_office_no, is_round_discount, discard_desc, cabin_desc, avbl_seat_num, is_valid, auditor_id, audit_date, audit_stat_did, optr_stat_dcd, optr_user_id, optr_date, is_tempus, is_batch_created, salechnl_codes, fare_range_type_did, fare_range_min, fare_range_max, k_type_did, k_method_did, k_discount_point, ticket_fare, autoscan_interval_secs, autoscan_duration_secs, policy_file_id, is_allow_view, suspend_stat_did, suspend_batch_no, is_corp_only, is_allow_exchange, ei_item, remark, creator_id, create_date, supplier_id, is_national, is_mon_policy, rtn_mon_rebate_value, order_office_no, sale_start_time, sale_end_time) values (v_policy_id, v_fly_type_did, v_policy_type_did, v_air_com_dcd, v_from_city_dcd, v_to_city_dcd, v_trans_city_dcds, v_is_team, v_psgr_multi_type_did, v_flight_no, v_match_flight_type_did, v_rtn_flight_no, v_match_rtn_flight_type_did, v_weekday_limit, v_rtn_weekday_limit, v_match_cabin, v_rebate_point, v_rebate_cashback, v_rtn_rebate_value, v_sale_start_date, v_sale_end_date, v_travel_start_date, v_travel_end_date, v_rtn_start_date, v_rtn_end_date, v_ticket_type_codes, v_is_auto_ticket, v_is_shared, v_is_chg_pnr, v_is_support_inf, v_ticket_office_no, v_pnr, v_receipt_type_did, v_support_cert_type_did, v_earliest_ticket_days, v_latest_ticket_days, v_except_dates, v_return_except_dates, v_depart_time, v_arrive_time, v_rtn_depart_time, v_rtn_arrive_time, v_special_cmd_code, v_other_cmd_code, v_is_allow_adv_pmt, v_p_office_no, v_is_round_discount, v_discard_desc, v_cabin_desc, v_avbl_seat_num, v_is_valid, v_auditor_id, v_audit_date, v_audit_stat_did, v_optr_stat_dcd, v_optr_user_id, v_optr_date, v_is_tempus, v_is_batch_created, v_salechnl_codes, v_fare_range_type_did, v_fare_range_min, v_fare_range_max, v_k_type_did, v_k_method_did, v_k_discount_point, v_ticket_fare, v_autoscan_interval_secs, v_autoscan_duration_secs, v_policy_file_id, v_is_allow_view, v_suspend_stat_did, v_suspend_batch_no, v_is_corp_only, v_is_allow_exchange, v_ei_item, v_remark, v_creator_id, v_create_date, v_supplier_id, v_is_national, v_is_mon_policy, v_rtn_mon_rebate_value, v_order_office_no, v_sale_start_time, v_sale_end_time);
第二步,将上面的代码复制到UE中执行正则表达式查找和替换 查找v_[^,)]* 替换成?
我们要的SQL语句出来了,将其拷贝到 PL /SQL中,全部选中后,右键,专用复制 java ,此时就可以把它赋值给 String sql= 这个地方了。
第三步,给?号赋值 将所有字段选中,注意只保留字段在UE中,形式如下
policy_id, fly_type_did, policy_type_did, air_com_dcd, from_city_dcd, to_city_dcd, trans_city_dcds, is_team, psgr_multi_type_did, flight_no, match_flight_type_did, rtn_flight_no, match_rtn_flight_type_did, weekday_limit, rtn_weekday_limit, match_cabin, rebate_point, rebate_cashback, rtn_rebate_value, sale_start_date, sale_end_date, travel_start_date, travel_end_date, rtn_start_date, rtn_end_date, ticket_type_codes, is_auto_ticket, is_shared, is_chg_pnr, is_support_inf, ticket_office_no, pnr, receipt_type_did, support_cert_type_did, earliest_ticket_days, latest_ticket_days, except_dates, return_except_dates, depart_time, arrive_time, rtn_depart_time, rtn_arrive_time, special_cmd_code, other_cmd_code, is_allow_ad?, p_office_no, is_round_discount, discard_desc, cabin_desc, avbl_seat_num, is_valid, auditor_id, audit_date, audit_stat_did, optr_stat_dcd, optr_user_id, optr_date, is_tempus, is_batch_created, salechnl_codes, fare_range_type_did, fare_range_min, fare_range_max, k_type_did, k_method_did, k_discount_point, ticket_fare, autoscan_interval_secs, autoscan_duration_secs, policy_file_id, is_allow_view, suspend_stat_did, suspend_batch_no, is_corp_only, is_allow_exchange, ei_item, remark, creator_id, create_date, supplier_id, is_national, is_mon_policy, rtn_mon_rebate_value, order_office_no, sale_start_time, sale_end_time
执行正则表达式替换 ,\s+ --》 \r\n 如下图,行变列
再次执行正则表达式替换
最后将UE中整理好的代码拷贝到JAVA中,利用eclise的 Alt+/ 自动完成功能,完成代码。
这种利用工具的好处是 快速,准确!