我想在Oracle数据库中插入一个新行。
INSERT INTO xx_vms.es_supplier_process_steps (process_step_id, supplier_process_id, supplier_step_id,
mapped_item_type, mapped_subinventory_code, mapped_subinventory_type, mapped_operation_code, mapping_notes)
VALUES (xx_vms.seq_es_supplier_proc_step_id.NEXTVAL, xx_vms.seq_es_supplier_proc_id.CURRVAL,
xx_vms.seq_es_supplier_step_id.CURRVAL, 'ASY', null, 'IN', null, null);
使用xx_vms.seq_es_supplier_proc_id.CURRVAL列是以下查询的结果。示例:122:
select supplier_process_id from xx_vms.es_supplier_processes where supplier_code='TEST'and name='FINAL TEST';
但我不知道该怎么做。请帮我!感谢。
答案 0 :(得分:0)
您将要使用子查询来插入
INSERT INTO xx_vms.es_supplier_process_steps
(process_step_id,
supplier_process_id,
supplier_step_id,
mapped_item_type,
mapped_subinventory_code,
mapped_subinventory_type,
mapped_operation_code,
mapping_notes)
SELECT x_vms.seq_es_supplier_proc_step_id.NEXTVAL,
(select supplier_process_id
from xx_vms.es_supplier_processes
where supplier_code='TEST'and
name='FINAL TEST'),
xx_vms.seq_es_supplier_step_id.CURRVAL,
'ASY',
null,
'IN',
null,
null
FROM DUAL);