Oracle Insert via Select from multiple tables where one table may not have a row

前端 未结 6 1697
野性不改
野性不改 2020-12-25 08:56

I have a number of code value tables that contain a code and a description with a Long id.

I now want to create an entry for an Account Type that references a number

6条回答
  •  清酒与你
    2020-12-25 09:46

    insert into account_type_standard (account_type_Standard_id, tax_status_id, recipient_id)
    select account_type_standard_seq.nextval,
       ts.tax_status_id, 
       ( select r.recipient_id
         from recipient r
         where r.recipient_code = ?
       )
    from tax_status ts
    where ts.tax_status_code = ?
    

提交回复
热议问题