php - Oracle INSERT ALL with from select result -


ok has been hurting brain last few hours. can not use insert select in oracle?

here's got , tells me sql command not ended

   insert              environment (name, id, description, start_date, end_date) values(:name, :eid, :description, :sdate, :edate)             environment#url (id, environment_id, url, url_type_id) select 600, :eid, :url, url_type.id url_type url_type.type :urltype             environment#contact (id, environment_id, contact_id) select 600, :eid, contact.id contact contact.name :contactname     select * dual 

this run using php thats why there's no semicolon. works if it's run 3 different insert statements needs 1 query. how else might this?

i think have remove insert keywords after insert all part, this:

insert              environment (name, id, description, start_date, end_date) values(:name, :eid, :description, :sdate, :edate)             environment#url (id, environment_id, url, url_type_id) select 600, :eid, :url, url_type.id url_type url_type.type :urltype             environment#contact (id, environment_id, contact_id) select 600, :eid, contact.id contact contact.name :contactname select * dual 

edit

you know, i'm looking @ more, see have other select statements last 2 into clauses. don't think insert all syntax allows that. think have use values clauses.

personally, instead of using insert all, try wrapping 3 normal insert statements inside anonymous pl/sql block (not sure how works php, telling oracle's perspective, 1 statement , works fine):

begin   insert environment (name, id, description, start_date, end_date) values(:name, :eid, :description, :sdate, :edate);   insert environment#url (id, environment_id, url, url_type_id) (select 600, :eid, :url, url_type.id url_type url_type.type :urltype);   insert environment#contact (id, environment_id, contact_id) (select 600, :eid, contact.id contact contact.name :contactname); end; 

Comments