Error Class 38: External Function Exception

Error Class 38: External Function Exception
SQLSTATE Message Text
38000 The exception '<exception>' was thrown while evaluating an expression.
38001 The external routine is not allowed to execute SQL statements.
38002 The routine attempted to modify data, but the routine was not defined as MODIFIES SQL DATA.
38004 The routine attempted to read data, but the routine was not defined as READS SQL DATA.