Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Trigger Works Fine in EdbMngr (Local) but ERRORS when run on EdbSvr (Remote)
Wed, May 17 2017 8:47 PMPermanent Link

Andrew Hill

CREATE TRIGGER "QueueRefSet" AFTER INSERT ON "CallRecords"
WHEN LENGTH(NewRow.QueueRef) < 1
BEGIN
 DECLARE ID INTEGER;
 DECLARE CallID INTEGER;
 DECLARE QueueRef VARCHAR;
 DECLARE tmp VARCHAR;
 DECLARE tmp2 VARCHAR;
 DECLARE CallsCursor CURSOR FOR Stmt;
 SET ID = NewRow.ID;
 SET CallID = NewRow.CallID;
 SET tmp = 'SELECT QueueRef FROM CallRecords WHERE LENGTH(QueueRef) > 1 AND CallID = '+CAST(CallID AS VARCHAR)+' ORDER BY CallRecordTimeStamp ';
 PREPARE Stmt FROM tmp;
 OPEN CallsCursor;
 FETCH FIRST FROM CallsCursor ('QueueRef') INTO QueueRef;
 WHILE NOT EOF(CallsCursor) DO
   FETCH NEXT FROM CallsCursor ('QueueRef') INTO QueueRef;
 END WHILE;
 CLOSE CallsCursor;
 SET tmp2 = 'UPDATE CallRecords SET QueueRef = '+QUOTEDSTR(QueueRef)+' WHERE ID = '+CAST(ID AS VARCHAR);
 EXECUTE IMMEDIATE tmp2;
END

EDBSVR ERROR
Locate, Update, Insert CallRecords Failed ElevateDB Error #700 An error was found in the statement at line 20 and column 21 (Missing SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, GRANT, REVOKE, BACKUP, RESTORE, COMPARE, SET BACKUPS, MIGRATE, REPAIR, VERIFY, OPTIMIZE, IMPORT, EXPORT, DISCONNECT, REMOVE, PUBLISH, UNPUBLISH, SAVE, LOAD, SET UPDATES, COPY FILE, RENAME FILE, DELETE FILE)

Please advise - thanks in advance - Andy
Fri, May 19 2017 2:22 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Andrew,

Any time that you are building a SQL statement dynamically and you encounter a MISSING SELECT, etc. error message, it means that one or more of the parameters or variables that you're using to build the SQL statement are NULL.  NULL concatenated with any other string will produce a NULL, which means that you will try to execute a NULL SQL statement.

Tim Young
Elevate Software
www.elevatesoft.com
Image