sql - Porting join from Oracle to Postgres -
insert mission_objective( msn_int_id, mo_int_id, mo_msn_class_nm, mo_msn_class_cd, mo_msn_type, mo_priority, mo_comment, mo_start_dt, mo_end_dt, asp_airspace_nm, mo_obj_location, mo_alo_leg_id, mo_alo_arrive_loc) select '1025', '1', 'airdrop', 'adp', 'lapes', null, coalesce( null, ' '), to_timestamp( '1002260900', 'yymmddhh24mi'), to_timestamp( '1002260915', 'yymmddhh24mi'), 'transit alpha', 'transit alpha', '1', 'transit alpha' airspace asp, apsmain .mission_class mc asp.asp_airspace_nm(+)= 'transit alpha' , mc.mcs_mission_class_name= 'airdrop' , 'transit alpha' not null
the part confusing me asp.asp_airspace_nm being right joined constant.
how can port use normal right join?
tidied formatting bit.
insert mission_objective ( msn_int_id, mo_int_id, mo_msn_class_nm, mo_msn_class_cd, mo_msn_type, mo_priority, mo_comment, mo_start_dt, mo_end_dt, asp_airspace_nm, mo_obj_location, mo_alo_leg_id, mo_alo_arrive_loc ) select '1025', '1', 'airdrop', 'adp', 'lapes', null, coalesce( null, ' '), to_timestamp( '1002260900', 'yymmddhh24mi'), to_timestamp( '1002260915', 'yymmddhh24mi'), 'transit alpha', 'transit alpha', '1', 'transit alpha' airspace asp, apsmain .mission_class mc asp.asp_airspace_nm(+) = 'transit alpha' , mc.mcs_mission_class_name= 'airdrop'
observations:
the select list consists of constants.
there no join condition between airspace , apsmain.mission_class
the mission_class filtered 'airdrop' predicate. if there no airdrop rows, no rows inserted.
the airspace table apparently filtered transit alpha predicate. outer join, return @ least 1 row, may return multiple rows.
it insert 1 row each airdrop row if there 0 or 1 transit alpha rows if there multiple transit alpha rows, number of rows inserted multipleid. example, 3 airdrop rows , 2 transit alpha rows result in 6 rows being inserted.
Comments
Post a Comment