<?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: Inexplicable syntax error in function declaration (SA17) in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/inexplicable-syntax-error-in-function-declaration-sa17/qaa-p/13820486#M4851329</link>
    <description>&lt;P&gt;Nope ... doesn't seem to be that ... maybe if we had a full function definition that fails ...&lt;/P&gt;</description>
    <pubDate>Tue, 22 Sep 2015 09:54:24 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2015-09-22T09:54:24Z</dc:date>
    <item>
      <title>Inexplicable syntax error in function declaration (SA17)</title>
      <link>https://community.sap.com/t5/technology-q-a/inexplicable-syntax-error-in-function-declaration-sa17/qaq-p/13820484</link>
      <description>&lt;P&gt;Some skripts we've used for year with SA11 up to SA16 start throwing errors when used with SA17, complaining about Transact Syntax in a Watcom function.&lt;/P&gt;
&lt;P&gt;Example:
 &lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Inexplicable syntax error in function declaration SA17"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/189468iC3A6BD3A60E865B7/image-size/large?v=v2&amp;amp;px=999" role="button" title="Inexplicable syntax error in function declaration SA17" alt="Inexplicable syntax error in function declaration SA17" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I'd suppose SA would be able to differentiate between a Watcom FUNCTION and the TRANSACT style (which doesn't support the IN keyword in the parameter list, according to the docs, but uses AS before the statement block). &lt;/P&gt;
&lt;P&gt;What can I do to fix this? Have I overlooked anything?&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;E D I T&lt;/STRONG&gt; -&lt;BR /&gt;&lt;BR /&gt;
I've stripped down one of the functions down to a few lines.&lt;BR /&gt;
&lt;PRE&gt;create or replace function FuncTest (@charVal char(30), @intVal integer= null)
returns integer
begin
  return @intVal;
end
&lt;/PRE&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;which throws the (german) error message:&lt;BR /&gt;
Anweisung konnte nicht ausgeführt werden.
Syntaxfehler bei ';' in Zeile 5 (Transact-SQL)
SQLCODE=-131, ODBC 3-Status="42000"
Zeile 1, Spalte 1&lt;/P&gt;
&lt;P&gt;That exposed the actual source of the problem: because the function contains nearly no code, the parser must be tripping over the assignment of a default value via the operator "=" instead of using DEFAULT (as defined by the syntax description).&lt;BR /&gt;&lt;BR /&gt;
We got a pack of SPs defined that way, since we started using default values for procedures / functions starting IIRC with ASA9. Ever since no one bothered to write DEFAULT, if "=" would do the trick.&lt;BR /&gt;&lt;BR /&gt;
I'v checked that the sample above is accepted and works correctly with ASA9, SA11, SA12 and SA16.&lt;BR /&gt;&lt;BR /&gt;
So the question should rather be converted to an &lt;STRONG&gt;Enhancement Request&lt;/STRONG&gt; :&lt;BR /&gt;
Extend the syntax for the parameter definition part [ DEFAULT expression ] to [ {DEFAULT | = } expression ] (or sth. like that).&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2015 11:39:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/inexplicable-syntax-error-in-function-declaration-sa17/qaq-p/13820484</guid>
      <dc:creator>reimer_pods</dc:creator>
      <dc:date>2015-09-22T11:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Inexplicable syntax error in function declaration (SA17)</title>
      <link>https://community.sap.com/t5/technology-q-a/inexplicable-syntax-error-in-function-declaration-sa17/qaa-p/13820485#M4851328</link>
      <description>&lt;P&gt;Is this happening if the action is a REPLACE and not a CREATE?
If so, it may be picking it's que up from the pre-existing function language type.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2015 09:49:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/inexplicable-syntax-error-in-function-declaration-sa17/qaa-p/13820485#M4851328</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-09-22T09:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: Inexplicable syntax error in function declaration (SA17)</title>
      <link>https://community.sap.com/t5/technology-q-a/inexplicable-syntax-error-in-function-declaration-sa17/qaa-p/13820486#M4851329</link>
      <description>&lt;P&gt;Nope ... doesn't seem to be that ... maybe if we had a full function definition that fails ...&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2015 09:54:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/inexplicable-syntax-error-in-function-declaration-sa17/qaa-p/13820486#M4851329</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-09-22T09:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: Inexplicable syntax error in function declaration (SA17)</title>
      <link>https://community.sap.com/t5/technology-q-a/inexplicable-syntax-error-in-function-declaration-sa17/qaa-p/13820487#M4851330</link>
      <description>&lt;P&gt;Sometimes (historically) a later usage of a declared variable will confuse the parser and it will flag a syntax error on the declare for that variable. Try looking for uses of @vorposID lower down.&lt;/P&gt;
&lt;P&gt;Otherwise I would need to see this happening ... ?test case?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2015 10:07:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/inexplicable-syntax-error-in-function-declaration-sa17/qaa-p/13820487#M4851330</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-09-22T10:07:42Z</dc:date>
    </item>
  </channel>
</rss>

