Hello, i am working on transferring the events package data model
Michael Steigman has been working on in oracle, to postgresql - we
hope to present it to CVS here once it is more mature. I am stuck on
two bits of oracle code... and am completely at a loss on how to
transfer these things to postgresql...
create or replace trigger event_ship_date_trigger
before insert or update on events_registrations
for each row
when (old.reg_state <> 'shipped' and new.reg_state = 'shipped')
begin
:new.shipped_date := sysdate;
end;
/
show errors
I don't know how to change this and what is wrong with it, it just
doesn't work
create or replace view events_orders_states
as
select o.*,
o_states.order_state
from events_orders o,
(select
order_id,
decode (floor(avg (decode (reg_state,
'canceled', 0,
'waiting', 1,
'pending', 2,
'shipped', 3,
0))),
0, 'canceled',
1, 'incomplete',
2, 'incomplete',
3, 'fulfilled',
'void') as order_state
from events_registrations
group by order_id) o_states
where o_states.order_id = o.order_id;
For the following there is a problem at or near "("
create view events_organizers
as
select eor.*, eom.user_id, eorem.event_id
from events_organizer_roles eor,
events_organizers_map eom,
events_org_role_event_map eorem
where eor.role_id=eom.role_id(+)
and eorem.role_id = eor.role_id;
Also, there is a function that 25 arguments, however there are only
16 allowed by postgresql, is there a common fix for this, or does it
just mean that we need to split up this function?
if anybody could help it would be greatly appreaciated.