Skip to Content
0

START TIME clause

Oct 14, 2016 at 01:38 PM

78

avatar image

http://dcx.sap.com/index.html#1200/en/dbreference/create-event-statement.html

CREATE EVENT statement

START TIME clause The first scheduled time for each day on which the event is scheduled.
The start-time parameter is a string, and cannot be a variable or an expression such as NOW().

Given above constraint , is there any way to vary the start-time dynamically ?

Example : A user selects a specific time via en external program which in turn can call CREATE Event with that selected time .

Thanks,

Mahesh.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Nick Elson
Oct 14, 2016 at 03:38 PM
0

The method most often used to dynamically generate SQL would be to build the statement as a string
and submit the statement using the EXECUTE IMMEDIATE statement.

Share
10 |10000 characters needed characters left characters exceeded
Mahesh Venkatesh Oct 14, 2016 at 10:18 PM
0

So in below example

CREATE EVENT DailyBackup
SCHEDULE daily_backup
START TIME '1:00AM' EVERY 24 HOURS
HANDLER
BEGIN
BACKUP DATABASE TO '\\\\.\\tape0'
ATTENDED OFF
END;

Is there no option to pass in just START TIME as a parameter or even read it from a column instead of specifying it as a string literal ?

Thanks,

,

So in below example :

CREATE EVENT DailyBackup
SCHEDULE daily_backup
START TIME '1:00AM' EVERY 24 HOURS
HANDLER
BEGIN
BACKUP DATABASE TO '\\\\.\\tape0'
ATTENDED OFF
END;

Is there no option to pass in just START TIME as parameter to vary it dynamically , or even read it from a column value in a table instead of specifying a string literal like '1:00 AM'?

Thanks,

Share
10 |10000 characters needed characters left characters exceeded
Nick Elson
Oct 14, 2016 at 10:34 PM
0

The START TIME in version 12 will only accept a string constants.
This is also true of version 16. Only once you upgrade to version 17
will you be allowed to use a character variable for this.

This change was captured in the version 17 documentation by the
addition of this sentence "You can specify a variable name for start-time."
and was just one part of much larger change

"Support added for variables in some statements"

Share
10 |10000 characters needed characters left characters exceeded
Mahesh Venkatesh Oct 17, 2016 at 03:43 PM
0

Nick,

Thanks very much for the response. Will try it when upgrading to version 17 . Thanks, Mahesh.

Share
10 |10000 characters needed characters left characters exceeded