<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: difference in exec vs call storeproc? in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/difference-in-exec-vs-call-storeproc/qaa-p/13840736#M4871579</link>
    <description>&lt;P&gt;thx.
I originally preferred the call statement but I found there situation that exec i helps me to debug the called stored procedure better - I did not understand the message from call.&lt;/P&gt;
&lt;P&gt;for example&lt;/P&gt;
&lt;PRE&gt; 
exec dba.pf_daily_holdg_detl_variance_deflt_Dt_Dif @valuation_dt, @acct_grp_id, @subAcct_ID, @fi_securitySymOrNameOrShortDescCriteria, @valuation_dt_dif, @msg
    select @acct_grp_id, @subAcct_ID,@subAcct_ID, @valuation_dt, @valuation_dt_dif, @fi_securitySymOrNameOrShortDescCriteria, @msg
&lt;/PRE&gt;

&lt;P&gt;can be exec w/o error while&lt;/P&gt;
&lt;PRE&gt; 
 call dba.pf_daily_holdg_detl_variance_deflt_Dt_Dif (@valuation_dt, @acct_grp_id, @subAcct_ID, @fi_securitySymOrNameOrShortDescCriteria, @valuation_dt_dif, @msg
    select @acct_grp_id, @subAcct_ID,@subAcct_ID, @valuation_dt, @valuation_dt_dif, @fi_securitySymOrNameOrShortDescCriteria, @msg)
&lt;/PRE&gt;

&lt;P&gt;will lead to&lt;/P&gt;
&lt;P&gt;Could not execute statement syntax error near call on line 16
sqlcode=-131, odbc 3 state='42000'
line 1 column 1&lt;/P&gt;
&lt;P&gt;when I forgot to end the statement with ;
most of the time except for call statement omitting the ; will lead to a quick easy under error of syntax error near,,,,&lt;/P&gt;</description>
    <pubDate>Fri, 23 May 2014 11:22:31 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2014-05-23T11:22:31Z</dc:date>
    <item>
      <title>difference in exec vs call storeproc?</title>
      <link>https://community.sap.com/t5/technology-q-a/difference-in-exec-vs-call-storeproc/qaq-p/13840733</link>
      <description>&lt;P&gt;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&lt;/P&gt;</description>
      <pubDate>Thu, 22 May 2014 20:40:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/difference-in-exec-vs-call-storeproc/qaq-p/13840733</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-22T20:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: difference in exec vs call storeproc?</title>
      <link>https://community.sap.com/t5/technology-q-a/difference-in-exec-vs-call-storeproc/qaa-p/13840734#M4871577</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;I found in sa 11 isql, it's a lot easier to use exec dba.procname parmlist then the call ( parmlist)&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What exactly makes the EXEC statement a lot easier to use then a CALL statement (except that you don't need the brackets...)?&lt;/P&gt;
&lt;P&gt;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...).&lt;/P&gt;
&lt;P&gt;IMHO, the sytax to get a return value looks more convenient with CALL:&lt;/P&gt;
&lt;PRE class="codehilite"&gt;&lt;CODE class="language-sql"&gt;retcode = CALL MyProc(myParam1, myParam2)
--vs.
EXEC retcode = MyProc myParam1, myParam2


&lt;P&gt;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".&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 May 2014 03:24:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/difference-in-exec-vs-call-storeproc/qaa-p/13840734#M4871577</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2014-05-23T03:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: difference in exec vs call storeproc?</title>
      <link>https://community.sap.com/t5/technology-q-a/difference-in-exec-vs-call-storeproc/qaa-p/13840736#M4871579</link>
      <description>&lt;P&gt;thx.
I originally preferred the call statement but I found there situation that exec i helps me to debug the called stored procedure better - I did not understand the message from call.&lt;/P&gt;
&lt;P&gt;for example&lt;/P&gt;
&lt;PRE&gt; 
exec dba.pf_daily_holdg_detl_variance_deflt_Dt_Dif @valuation_dt, @acct_grp_id, @subAcct_ID, @fi_securitySymOrNameOrShortDescCriteria, @valuation_dt_dif, @msg
    select @acct_grp_id, @subAcct_ID,@subAcct_ID, @valuation_dt, @valuation_dt_dif, @fi_securitySymOrNameOrShortDescCriteria, @msg
&lt;/PRE&gt;

&lt;P&gt;can be exec w/o error while&lt;/P&gt;
&lt;PRE&gt; 
 call dba.pf_daily_holdg_detl_variance_deflt_Dt_Dif (@valuation_dt, @acct_grp_id, @subAcct_ID, @fi_securitySymOrNameOrShortDescCriteria, @valuation_dt_dif, @msg
    select @acct_grp_id, @subAcct_ID,@subAcct_ID, @valuation_dt, @valuation_dt_dif, @fi_securitySymOrNameOrShortDescCriteria, @msg)
&lt;/PRE&gt;

&lt;P&gt;will lead to&lt;/P&gt;
&lt;P&gt;Could not execute statement syntax error near call on line 16
sqlcode=-131, odbc 3 state='42000'
line 1 column 1&lt;/P&gt;
&lt;P&gt;when I forgot to end the statement with ;
most of the time except for call statement omitting the ; will lead to a quick easy under error of syntax error near,,,,&lt;/P&gt;</description>
      <pubDate>Fri, 23 May 2014 11:22:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/difference-in-exec-vs-call-storeproc/qaa-p/13840736#M4871579</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-23T11:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: difference in exec vs call storeproc?</title>
      <link>https://community.sap.com/t5/technology-q-a/difference-in-exec-vs-call-storeproc/qaa-p/13840735#M4871578</link>
      <description>&lt;P&gt;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 &lt;EM&gt;(uh 'exec')&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;By using &lt;/P&gt;
&lt;PRE class="codehilite"&gt;&lt;CODE&gt;   EXEC &amp;lt;sproc_name&amp;gt;  . . . .


&lt;P&gt;the SQL parsers involved sees the 'EXEC' token and identifies the SQL dialect as being &lt;A href="http://dcx.sybase.com/index.html#sa160/en/dbusage/tsos.html"&gt;Transact-SQL&lt;/A&gt;.  From that point on the parser must determine the &lt;STRONG&gt;&lt;EM&gt;"end of statement"&lt;/EM&gt;&lt;/STRONG&gt; boundaries based solely by the T/SQL dialect-specific syntax of the statement types involved.&lt;/P&gt;
&lt;P&gt;Transact-SQL is different in many aspects from Standard SQL &lt;EM&gt;(and SQL Anywhere specifically)&lt;/EM&gt; but for this question it does not require the use of semi-colons.  And the is the sole source of the 
perceived &lt;CODE&gt;*'easy of use'*&lt;/CODE&gt; you mention.&lt;/P&gt;
&lt;P&gt;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. &lt;/P&gt;
&lt;P&gt;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. &lt;/P&gt;
&lt;P&gt;Beyond this simple explanation this topic does overlap the concept of &lt;A href="http://dcx.sybase.com/index.html#sa160/en/dbusage/ptib.html"&gt;SQL Batches&lt;/A&gt; which I will not go into here but you should probably visit the topic to flesh out the concepts there for yourself.&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 May 2014 12:03:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/difference-in-exec-vs-call-storeproc/qaa-p/13840735#M4871578</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-23T12:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: difference in exec vs call storeproc?</title>
      <link>https://community.sap.com/t5/technology-q-a/difference-in-exec-vs-call-storeproc/qaa-p/13840737#M4871580</link>
      <description>&lt;P&gt;Nick,
surely a better message of missing ; delimiter for the call statement would be a lot more desireable.
I know watcom sql dialect has a lot more features than t_sql like if then else instead of
if....
begin
 ...
end
else
.........&lt;/P&gt;</description>
      <pubDate>Fri, 23 May 2014 18:18:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/difference-in-exec-vs-call-storeproc/qaa-p/13840737#M4871580</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-05-23T18:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: difference in exec vs call storeproc?</title>
      <link>https://community.sap.com/t5/technology-q-a/difference-in-exec-vs-call-storeproc/qaa-p/13840738#M4871581</link>
      <description>&lt;P&gt;use of ; is not much of problem for using sa but then we will be locked in sa by making migration more difficult. with the sap, we don't seem to valued as we don't buy anything directly ourselves from sap although we help our client to buy licenses.&lt;/P&gt;
&lt;P&gt;our sybase developer accounts have not been migrated to sap and seem to be stuck in a limbo.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2014 16:09:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/difference-in-exec-vs-call-storeproc/qaa-p/13840738#M4871581</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-08-20T16:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: difference in exec vs call storeproc?</title>
      <link>https://community.sap.com/t5/technology-q-a/difference-in-exec-vs-call-storeproc/qaa-p/13840739#M4871582</link>
      <description>&lt;P&gt;Are you expecting the call and select to be two statements? You have put the ( parentheses ) around both statements.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2014 18:44:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/difference-in-exec-vs-call-storeproc/qaa-p/13840739#M4871582</guid>
      <dc:creator>Breck_Carter</dc:creator>
      <dc:date>2014-08-20T18:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: difference in exec vs call storeproc?</title>
      <link>https://community.sap.com/t5/technology-q-a/difference-in-exec-vs-call-storeproc/qaa-p/13840740#M4871583</link>
      <description>&lt;P&gt;Your experienced problems with the Sybase/SAP migration (which certainly are not uncommon, sadly) seem not to be related to that question so I would recommend to ask that as a different question (or perhaps better: to call your sales rep...).&lt;/P&gt;</description>
      <pubDate>Thu, 21 Aug 2014 03:37:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/difference-in-exec-vs-call-storeproc/qaa-p/13840740#M4871583</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2014-08-21T03:37:52Z</dc:date>
    </item>
  </channel>
</rss>

