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

Hello, is there any way to use a variable (of type time) in the statement of creating an event?

begin

set @time = '09:00';

create event myevent schedule start time @time every 5 minutes handler begin end;

end

I tried even with execute immediate without success!!

asked 24 Sep '19, 07:26

Baron's gravatar image

Baron
2.2k144152180
accept rate: 48%

edited 24 Sep '19, 07:32


This should work with EXECUTE IMMEDIATE when specifying the variable as a literal value, AFAIK. What exactly have you tried?

permanent link

answered 24 Sep '19, 08:14

Volker%20Barth's gravatar image

Volker Barth
40.4k365554826
accept rate: 34%

converted 26 Sep '19, 03:40

I am trying to execute this block:

begin

declare @time1 time;

set @time1 = '09:00';

execute immediate ('create event SyncPrAtH schedule start time ''' + convert(varchar(5), @time1) + ''' every 3 minutes handler');

begin

select * from dummy;

end;

end;
(25 Sep '19, 08:52) Baron
Replies hidden

You have to include the whole CREATE EVENT statement including the handler block as argument to EXECUTE IMMEDIATE.

(25 Sep '19, 09:16) Volker Barth

Oh, Sorry!! I dont know why I was so fast to post it here before looking more closely into my code.

Thank you

(25 Sep '19, 10:01) Baron

So does it work now?

(25 Sep '19, 10:37) Volker Barth

Yes, it worked!

(25 Sep '19, 15:58) Baron
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:

×41
×6

question asked: 24 Sep '19, 07:26

question was seen: 956 times

last updated: 25 Sep '19, 15:58