Page 1 of 1

LiteScript don't create trigger

Posted: Thu 16 Aug 2012 14:56
by Tarifer
Hello!
I have the script:

Code: Select all

CREATE TRIGGER TR_DETAIL_FILES
AFTER UPDATE OF PERIOD_DATE_STAMP, IS_ACTIVE ON DETAIL_FILES
FOR EACH ROW
BEGIN
	UPDATE CALLS 
	SET DETAIL_FILE_IS_ACTIVE=NEW.IS_ACTIVE,
		DETAIL_FILE_PERIOD_DATE_STAMP=NEW.PERIOD_DATE_STAMP
	WHERE DETAIL_FILE_ID=NEW.DETAIL_FILE_ID;
END;
When I run it in LiteScript, it execute only part of trigger (as DBMonitor shows):

Code: Select all

CREATE TRIGGER TR_DETAIL_FILES
AFTER UPDATE OF PERIOD_DATE_STAMP, IS_ACTIVE ON DETAIL_FILES
FOR EACH ROW
BEGIN
	UPDATE CALLS 
	SET DETAIL_FILE_IS_ACTIVE=NEW.IS_ACTIVE,
		DETAIL_FILE_PERIOD_DATE_STAMP=NEW.PERIOD_DATE_STAMP
	WHERE DETAIL_FILE_ID=NEW.DETAIL_FILE_ID
Please fix it.

Thanks,
Dmitry Ukolov.

Re: LiteScript don't create trigger

Posted: Fri 17 Aug 2012 06:56
by ZEuS
The TLiteScript component is intended for executing multiple SQL-statements. Each statement in the script is separated by the delimiter that is defined in the TLiteScript.Delimiter property. By default, the TLiteScript.Delimiter property is set to a semicolon character.
So, in your example the TLiteScript component treats the SQL-statement as two separate statements and tries to execute them in consecutive order.
In order to execute multiple SQL-statements that contain a semicolon, you should set the TLiteScript.Delimiter property to a value, other than a semicolon, for example to a slash character (/), and separate SQL-statements in a script using this delimiter.
Also, to obtain more information about using the TLiteScript component, please refer to the LiteDAC documentation.

Re: LiteScript don't create trigger

Posted: Fri 17 Aug 2012 09:20
by Tarifer
Thanks, it works.