Explanation
The CREATE INDEX command contains a function which has at least one SQL command. This is not allowed.
User Response
Remove the SQL commands from the function.