Skip to Content
avatar image
Former Member

START TIME clause

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Oct 14, 2016 at 03:38 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 14, 2016 at 10:18 PM

    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,

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 14, 2016 at 10:34 PM

    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"

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 17, 2016 at 03:43 PM

    Nick,

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

    Add comment
    10|10000 characters needed characters exceeded