-- SET @pbi_datetime = '2018-01-01 10:00:10'

insert into `dim_order_state`
(state_name, `inserted_at`)
select state, @db_date_time as inserted_at
from bim_stg_order_state ss
  left join dim_order_state ds
    on ds.state_name = ss.state
where ds.state_name is NULL
GROUP BY state
ORDER BY state;

-- {{IF_ANALYZE}}dim_order_state{{/IF_ANALYZE}}