When we remove the ";" in our SQL statements we don't have this error.
My question is how the above function execute a SQL statement in the DB.
I know that in SQL*Plus you can't run a SQL statement with a ";"
typically in any database when using libraries to connect and run statements you never need the semicolon. in client programs like sqlplus, it needs to know when you're done typing and the statement is done. the libraries are executing one pre-prepared statement so you don't have to terminate it with the semicolon.