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.

What are the main differences between EXECUTE and EXECUTE IMMEDITATE statements?

For example with this dynamic SQL:

EXECUTE ('SELECT * FROM ' || sometable ||' ORDER BY somecol');

EXECUTE IMMEDITATE ('SELECT * FROM ' || sometable ||' ORDER BY somecol');

asked 15 Jan '14, 15:49

BlueMark's gravatar image

BlueMark
316131827
accept rate: 66%


The basic difference between the two is that EXECUTE IMMEDIATE is WATCOM SQL and EXECUTE is TSQL. Both statements will parse a string and execute the statement(s) contained within. Each statement has different options - see the documentation for details - but other than that they are the same. Which one you use is likely more dependent on whether you are writing your procedural code using WATCOM SQL dialect or TSQL dialect.

permanent link

answered 15 Jan '14, 15:55

Mark%20Culp's gravatar image

Mark Culp
24.9k10141297
accept rate: 41%

2

To help with understanding syntax that is Watcom vs TSQL, the documentation provides statement applicability indicators to identify where a statement can be used. See the following for additional information:

http://dcx.sybase.com/index.html#sa160/en/dbreference/statement-applicabilityusing-wsqlstmt.html

(15 Jan '14, 16:10) Chris Keating
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:

×438
×108
×12
×9

question asked: 15 Jan '14, 15:49

question was seen: 8,731 times

last updated: 15 Jan '14, 16:10