dazu gibt es die skalare Funktion IDENTITY_VAL_LOCAL ()
versuch einfach mal:
EXEC SQL SET :hostvar = IDENTITY_VAL_LOCAL() ;