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.

I am using ultralitej database on android application and i need to delete rows with negative ID that exists in the same table with positive ID and same Code column. This sql executes without error in MSSql server but raises an error here: Syntax error near FROM at offset 10

DELETE r FROM Remote as r, Remote as r1 WHERE r.ID < 0 AND r.Code = r1.Code AND r1.ID > 0

Is there anything specific about delete with join in ultrealitej ? I tried with a subquery but got another error: Row has changed since last read -- operation canceled

DELETE FROM Remote WHERE  ID < 0 AND  
EXISTS (SELECT * FROM Remote rReal WHERE  rReal.ID > 0 AND rReal.Code = Remote.Code)

asked 05 Dec '13, 06:56

katalun4o's gravatar image

katalun4o
331121521
accept rate: 85%

edited 05 Dec '13, 06:57


The subquery worked.. i cannot explain why that error appeard, but now is working

permanent link

answered 05 Dec '13, 08:20

katalun4o's gravatar image

katalun4o
331121521
accept rate: 85%

Can't tell why the EXISTS subquery does not work as expected, however, the "DELETE with a table-list syntax" seems unsupported by UltraLite.

That's easily noticable if you compare the DELETE syntax for SQL Anywhere (confine synax 2 which does allow a table-list, just like MS SQL) and for UltraLite.

permanent link

answered 05 Dec '13, 07:12

Volker%20Barth's gravatar image

Volker Barth
40.2k361550822
accept rate: 34%

Your answer
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:

×72
×13

question asked: 05 Dec '13, 06:56

question was seen: 3,054 times

last updated: 05 Dec '13, 09:02