Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

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.

Example: alt text

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).

What can I do to fix this? Have I overlooked anything?

  • E D I T -

    I've stripped down one of the functions down to a few lines.
    create or replace function FuncTest (@charVal char(30), @intVal integer= null)
    returns integer
    begin
      return @intVal;
    end
    

which throws the (german) error message:
Anweisung konnte nicht ausgeführt werden. Syntaxfehler bei ';' in Zeile 5 (Transact-SQL) SQLCODE=-131, ODBC 3-Status="42000" Zeile 1, Spalte 1

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).

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.

I'v checked that the sample above is accepted and works correctly with ASA9, SA11, SA12 and SA16.

So the question should rather be converted to an Enhancement Request :
Extend the syntax for the parameter definition part [ DEFAULT expression ] to [ {DEFAULT | = } expression ] (or sth. like that).

asked 22 Sep '15, 09:39

Reimer%20Pods's gravatar image

Reimer Pods
4.5k384891
accept rate: 11%

edited 23 Sep '15, 07:53

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.

(22 Sep '15, 09:49) Nick Elson S...

Nope ... doesn't seem to be that ... maybe if we had a full function definition that fails ...

(22 Sep '15, 09:54) Nick Elson S...

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.

Otherwise I would need to see this happening ... ?test case?

(22 Sep '15, 10:07) Nick Elson S...
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×246
×28
×19

question asked: 22 Sep '15, 09:39

question was seen: 2,378 times

last updated: 23 Sep '15, 07:53