NO AA BB CC
1 November 111
2 22 222
3 33 333
To achieve the purpose of:
Calculation of the CC column (cc1=aa1 + bb3, cc2=aa2 + bb2, cc3=aa3 + bb2)
NO AA BB CC
1, 11, 111, 344
2 22 222 244
3, 33, 333, 144
I wrote a cycle, the code below
DECLARE
NO_count number (30) :=3;
The BEGIN
For I in 1.. NO_count loop
The update myschema. Temp_test_20191028 set CC=
. ((select AA from myschema temp_test_20191028 where NO=I) + (select BB from myschema. Temp_test_20191028 where NO=(4 - I)))
Where NO=I;
END loop;
COMMIT;
The END;
Code can run normally under navicat IDE
But in the kettle "execute SQL script module", using the above script complains, error is as follows:
PLS - 00103: a symbol "end - of - file" when need to be one of the following:
* & amp;=- +; >
The at is in mod remainder not rem & lt; An exponent (* *) & gt;
<> The or!=the or ~=& gt;=<=<> And the or the like like2 like4 likec between
Bosses give directions,
Thank you big!
CodePudding user response:
Finally a single line:/
CodePudding user response:
Is ok in theory, or in the stored procedure execution