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 know that it is possible to create a procedure without defining the result of it, but this is true only if I dont execute the select statement within an execute immediate.

create procedure myproc()

begin

select 'ss' from dummy; -- this works

execute immediate ('select ''ss'' from dummy'); -- this does not work

end;

Any Ideas?

asked 03 Oct '19, 11:32

Baron's gravatar image

Baron
2.1k136149177
accept rate: 48%

Comment Text Removed

Does it work when you add the WITH RESULT SET ON clause, see here...? By default, EXECUTE IMMEDIATE is not supposed to return a result set.

permanent link

answered 03 Oct '19, 14:42

Volker%20Barth's gravatar image

Volker Barth
40.2k361550822
accept rate: 34%

converted 04 Oct '19, 05:29

1

Besides that, there may be ways to parameterize your statement that do not require dynamic SQL, say by using connection-specific variables...

(03 Oct '19, 14:44) Volker Barth

Thank you very much! it has worked with (WITH RESULT SET ON)

(04 Oct '19, 04:18) Baron
Replies hidden

...so don't forget to check-mark the answer :)

(04 Oct '19, 08:40) Breck Carter
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:

×34
×7

question asked: 03 Oct '19, 11:32

question was seen: 859 times

last updated: 04 Oct '19, 08:40