1. Declare all
variables before anything else in the code
2. Use a ';' (semicolon) after each declaration.
3. Use a ';' (semicolon) to separate the
declarations from the rest of
the code.
A new record is inserted with the name 'My name' in the name field and the value 100 in the value field.
ttsBegin; myTable.name = 'My name'; myTable.value = 100; myTable.doInsert(); ttsCommit;
Following example inserts a new record into the MyTable table, with the AccountNum set to 1000 and the Name set to MyName (other fields in the record will be blank).
MyTable MyTable ; ttsBegin; select MyTable ;
MyTable.AccountNum = '1000'; MyTable.Name = 'MyName'; MyTable.insert(); ttsCommit;
Following example updates the record in the MyTable table with the AccountNum 1000 ,AccountNum set 1000 to "100012" and the Name set MyName to NewNameMyTable MyTable ; ttsBegin; select forUpdate MyTable where MyTable.AccountNum = "1000";
;
MyTable.AccountNum = '100012'; MyTable.Name = 'NewName'; MyTable.update(); ttsCommit;
For example selects the table myTable for update. Any records with the name equal to 'my name' are updated. The AmountMST field has 100 added to its current value, and the AccountNum field is changed to account number 1050.
tsBegin;
select forUpdate myTable where myTable.Name=='My name'; myTable.AmountMST += 100; myTable.AccountNum = 1050; MyTable.update(); ttsCommit;