Added missing primary key constraints.
Clean some query syntax that cause issues in oracle
Change to oracle
Forked from agro-upass-ws r:47