You can use a procedure language in Teiid to call foreign procedures and define virtual procedures and triggers.