I found in sa 11 isql, it's a lot easier to use exec dba.procname parmlist then the call ( parmlist) just curious why should on use call instead of exec besides the possibliility of use some expression in call parmlist. of course in sub query in call unless sa 16
asked 22 May '14, 20:40
What exactly makes the EXEC statement a lot easier to use then a CALL statement (except that you don't need the brackets...)?
Note, CALL is a standard SQL feature and is used within the Watcom-SQL dialect whereas EXECUTE is T-SQL style. I strongly prefer the CALL variant, possibly because it's parameter list just looks like that of most classic programming languages (and that is true for most parts of the Watcom-SQL dialect...).
IMHO, the sytax to get a return value looks more convenient with CALL:
But apparently, that's more or less a personal choice. Unless you have to be portable to T-SQL, I'd recommend the Watcom-SQL dialect as SQL Anywhere's "native dialect".
answered 23 May '14, 03:24
The missing ';' aspect of this has more to do with the SQL Dialect differences than it does have with this being a stored procedure call (uh 'exec').
the SQL parsers involved sees the 'EXEC' token and identifies the SQL dialect as being Transact-SQL. From that point on the parser must determine the "end of statement" boundaries based solely by the T/SQL dialect-specific syntax of the statement types involved.
Transact-SQL is different in many aspects from Standard SQL (and SQL Anywhere specifically) but for this question it does not require the use of semi-colons. And the is the sole source of the
So, in short, it is not a case of one being better than the other. The two uses belong to different SQL dialects and those just have different syntactical requirements.
The use of ';' as a statement delimiter is normal with SQL Anywhere and an easy convention to follow once adopted. You can avoid it if you restrict yourself to just T/SQL valid statements, and that only provides a sub-set of functionality.
Beyond this simple explanation this topic does overlap the concept of SQL Batches which I will not go into here but you should probably visit the topic to flesh out the concepts there for yourself.
answered 23 May '14, 12:03
Nick Elson S...