How to use optimistic locking within procedure?
up vote
1
down vote
favorite
I implemented an optimistic lock with a trigger, how can I do it without a trigger within procedure?
I reading this post Implementic Optimistic Locking
But I do not understand how I will implement it in the procedure.
I tried this, but I don't get what I expected
SQL> CREATE OR REPLACE PACKAGE BODY account_api AS
2 PROCEDURE upd_account
3 (p_acc_id accounts.acc_id%type
4 , p_acc_name accounts.acc_name%type
5 , p_acc_amount accounts.acc_amount%type
6 , p_acc_date accounts.acc_date%type
7 , p_acc_version accounts.acc_version%type
8 )
9 IS
10 BEGIN
11 UPDATE accounts
12 set acc_name = acc_name
13 , acc_amount = acc_amount
14 , acc_date = acc_date
15 , acc_version = acc_version + 1
16 where acc_id = p_acc_id
17 and acc_version = p_acc_version;
18 if(SQL%ROWCOUNT = 0)
19 THEN
20 RAISE_APPLICATION_ERROR( -20001, 'Oops, the row has changed since you read it.' );
21 END IF;
22 END;
23 end account_api;
24 /
SQL> begin
2 account_api.upd_account(1, 'user12', 1200, sysdate, '11-NOV-18 06.10.01.660948 AM');
3 end;
4 /
PL/SQL procedure successfully completed.
I'm trying the code with the same timestamp and it's done now
SQL> begin
2 account_api.upd_account(1, 'user1', 1200, sysdate, '11-NOV-18 06.10.01.660948 AM');
3 end;
4 /
PL/SQL procedure successfully completed.
oracle plsql
|
show 8 more comments
up vote
1
down vote
favorite
I implemented an optimistic lock with a trigger, how can I do it without a trigger within procedure?
I reading this post Implementic Optimistic Locking
But I do not understand how I will implement it in the procedure.
I tried this, but I don't get what I expected
SQL> CREATE OR REPLACE PACKAGE BODY account_api AS
2 PROCEDURE upd_account
3 (p_acc_id accounts.acc_id%type
4 , p_acc_name accounts.acc_name%type
5 , p_acc_amount accounts.acc_amount%type
6 , p_acc_date accounts.acc_date%type
7 , p_acc_version accounts.acc_version%type
8 )
9 IS
10 BEGIN
11 UPDATE accounts
12 set acc_name = acc_name
13 , acc_amount = acc_amount
14 , acc_date = acc_date
15 , acc_version = acc_version + 1
16 where acc_id = p_acc_id
17 and acc_version = p_acc_version;
18 if(SQL%ROWCOUNT = 0)
19 THEN
20 RAISE_APPLICATION_ERROR( -20001, 'Oops, the row has changed since you read it.' );
21 END IF;
22 END;
23 end account_api;
24 /
SQL> begin
2 account_api.upd_account(1, 'user12', 1200, sysdate, '11-NOV-18 06.10.01.660948 AM');
3 end;
4 /
PL/SQL procedure successfully completed.
I'm trying the code with the same timestamp and it's done now
SQL> begin
2 account_api.upd_account(1, 'user1', 1200, sysdate, '11-NOV-18 06.10.01.660948 AM');
3 end;
4 /
PL/SQL procedure successfully completed.
oracle plsql
I don't get what I expected": it would be useful if you specify what you do get, and how that is different from what you expected.
– trincot
Nov 11 at 14:18
I've edited the question
– petar
Nov 11 at 20:14
You are supposed to pass a number as last argument, not a date string.
– trincot
Nov 11 at 20:16
Column version is a timestamp data type, how should i forward the number?
– petar
Nov 11 at 20:36
It should not be a timestamp data type, but a plain number. You'll have to alter the data type. The idea is that it functions as an incremental version number: 1, 2, 3 ... reflecting the number of updates that record has received.
– trincot
Nov 11 at 20:37
|
show 8 more comments
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I implemented an optimistic lock with a trigger, how can I do it without a trigger within procedure?
I reading this post Implementic Optimistic Locking
But I do not understand how I will implement it in the procedure.
I tried this, but I don't get what I expected
SQL> CREATE OR REPLACE PACKAGE BODY account_api AS
2 PROCEDURE upd_account
3 (p_acc_id accounts.acc_id%type
4 , p_acc_name accounts.acc_name%type
5 , p_acc_amount accounts.acc_amount%type
6 , p_acc_date accounts.acc_date%type
7 , p_acc_version accounts.acc_version%type
8 )
9 IS
10 BEGIN
11 UPDATE accounts
12 set acc_name = acc_name
13 , acc_amount = acc_amount
14 , acc_date = acc_date
15 , acc_version = acc_version + 1
16 where acc_id = p_acc_id
17 and acc_version = p_acc_version;
18 if(SQL%ROWCOUNT = 0)
19 THEN
20 RAISE_APPLICATION_ERROR( -20001, 'Oops, the row has changed since you read it.' );
21 END IF;
22 END;
23 end account_api;
24 /
SQL> begin
2 account_api.upd_account(1, 'user12', 1200, sysdate, '11-NOV-18 06.10.01.660948 AM');
3 end;
4 /
PL/SQL procedure successfully completed.
I'm trying the code with the same timestamp and it's done now
SQL> begin
2 account_api.upd_account(1, 'user1', 1200, sysdate, '11-NOV-18 06.10.01.660948 AM');
3 end;
4 /
PL/SQL procedure successfully completed.
oracle plsql
I implemented an optimistic lock with a trigger, how can I do it without a trigger within procedure?
I reading this post Implementic Optimistic Locking
But I do not understand how I will implement it in the procedure.
I tried this, but I don't get what I expected
SQL> CREATE OR REPLACE PACKAGE BODY account_api AS
2 PROCEDURE upd_account
3 (p_acc_id accounts.acc_id%type
4 , p_acc_name accounts.acc_name%type
5 , p_acc_amount accounts.acc_amount%type
6 , p_acc_date accounts.acc_date%type
7 , p_acc_version accounts.acc_version%type
8 )
9 IS
10 BEGIN
11 UPDATE accounts
12 set acc_name = acc_name
13 , acc_amount = acc_amount
14 , acc_date = acc_date
15 , acc_version = acc_version + 1
16 where acc_id = p_acc_id
17 and acc_version = p_acc_version;
18 if(SQL%ROWCOUNT = 0)
19 THEN
20 RAISE_APPLICATION_ERROR( -20001, 'Oops, the row has changed since you read it.' );
21 END IF;
22 END;
23 end account_api;
24 /
SQL> begin
2 account_api.upd_account(1, 'user12', 1200, sysdate, '11-NOV-18 06.10.01.660948 AM');
3 end;
4 /
PL/SQL procedure successfully completed.
I'm trying the code with the same timestamp and it's done now
SQL> begin
2 account_api.upd_account(1, 'user1', 1200, sysdate, '11-NOV-18 06.10.01.660948 AM');
3 end;
4 /
PL/SQL procedure successfully completed.
oracle plsql
oracle plsql
edited Nov 11 at 19:24
asked Nov 11 at 13:59
petar
435
435
I don't get what I expected": it would be useful if you specify what you do get, and how that is different from what you expected.
– trincot
Nov 11 at 14:18
I've edited the question
– petar
Nov 11 at 20:14
You are supposed to pass a number as last argument, not a date string.
– trincot
Nov 11 at 20:16
Column version is a timestamp data type, how should i forward the number?
– petar
Nov 11 at 20:36
It should not be a timestamp data type, but a plain number. You'll have to alter the data type. The idea is that it functions as an incremental version number: 1, 2, 3 ... reflecting the number of updates that record has received.
– trincot
Nov 11 at 20:37
|
show 8 more comments
I don't get what I expected": it would be useful if you specify what you do get, and how that is different from what you expected.
– trincot
Nov 11 at 14:18
I've edited the question
– petar
Nov 11 at 20:14
You are supposed to pass a number as last argument, not a date string.
– trincot
Nov 11 at 20:16
Column version is a timestamp data type, how should i forward the number?
– petar
Nov 11 at 20:36
It should not be a timestamp data type, but a plain number. You'll have to alter the data type. The idea is that it functions as an incremental version number: 1, 2, 3 ... reflecting the number of updates that record has received.
– trincot
Nov 11 at 20:37
I don't get what I expected": it would be useful if you specify what you do get, and how that is different from what you expected.
– trincot
Nov 11 at 14:18
I don't get what I expected": it would be useful if you specify what you do get, and how that is different from what you expected.
– trincot
Nov 11 at 14:18
I've edited the question
– petar
Nov 11 at 20:14
I've edited the question
– petar
Nov 11 at 20:14
You are supposed to pass a number as last argument, not a date string.
– trincot
Nov 11 at 20:16
You are supposed to pass a number as last argument, not a date string.
– trincot
Nov 11 at 20:16
Column version is a timestamp data type, how should i forward the number?
– petar
Nov 11 at 20:36
Column version is a timestamp data type, how should i forward the number?
– petar
Nov 11 at 20:36
It should not be a timestamp data type, but a plain number. You'll have to alter the data type. The idea is that it functions as an incremental version number: 1, 2, 3 ... reflecting the number of updates that record has received.
– trincot
Nov 11 at 20:37
It should not be a timestamp data type, but a plain number. You'll have to alter the data type. The idea is that it functions as an incremental version number: 1, 2, 3 ... reflecting the number of updates that record has received.
– trincot
Nov 11 at 20:37
|
show 8 more comments
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
The idea is that you would have first selected a record (through a select
query) and then decide to update it. The procedure you quoted is correct. It requires that you pass it the value of acc_version
as last argument. You have that value from the record you queried.
This is a kind of contract you have to follow: you need to query that acc_version
and then pass it to the procedure for the update you want to make. After each update, you have to re-query what the current value of acc_version
is if you still need to make more updates.
The app_version
field needs to be a number (not a date). It is intended to reflect the version of the record, like version 1, 2, 3, ... which can be seen as the number of updates that have been done on that particular record.
The procedure will make the update on the condition that this value in the record was not updated in the mean time (by some other update). It uses a simple where
clause for that check.
If the update does not update anything, then it means the record did not satisfy this condition any more (and was altered). In that case the exception is raised.
But if the acc_version
is still as you passed it to the procedure, the update
statement will indeed update the targeted record. At the same time the update
statement increments acc_version
. This will prevent other clients who had already queried this record before this update, to make updates. They will need to re-query the record to get the right value of acc_version
, and try again.
The problem is because the result is always execute, I'm gonna set up the code now
– petar
Nov 11 at 19:21
add a comment |
up vote
0
down vote
This is what I wanted to achieve
PROCEDURE upd_account
( p_acc_id accounts.acc_id%type
, p_acc_name accounts.acc_name%type
, p_acc_amount accounts.acc_amount%type
, p_acc_date accounts.acc_date%type
, p_version accounts.version%type
)
IS
BEGIN
UPDATE accounts
set acc_name = p_acc_name
, acc_amount = p_acc_amount
, acc_date = p_acc_date
, version = p_version + 1
where acc_id = p_acc_id
and version = p_version;
DBMS_OUTPUT.PUT_LINE ('Number of updated records: ' || TO_CHAR(SQL%ROWCOUNT));
if(SQL%ROWCOUNT = 0)
THEN
RAISE_APPLICATION_ERROR( -20001, 'Oops, the row has changed since you read it.' );
END IF;
END;
1
Warning! Here you did not put theid
check in thewhere
clause. This is NOT correct. You need to make sure the update only happens to the intended record (with a certain ID value). The way you have it now you risk to update multiple records when by coincidence they share the sameversion
value.
– trincot
Nov 12 at 16:54
For the version I use DBMS_UTILITY.GET_TIME, but you're right, is it okay now?
– petar
Nov 12 at 17:06
Yes, it is OK now.
– trincot
Nov 12 at 17:11
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
The idea is that you would have first selected a record (through a select
query) and then decide to update it. The procedure you quoted is correct. It requires that you pass it the value of acc_version
as last argument. You have that value from the record you queried.
This is a kind of contract you have to follow: you need to query that acc_version
and then pass it to the procedure for the update you want to make. After each update, you have to re-query what the current value of acc_version
is if you still need to make more updates.
The app_version
field needs to be a number (not a date). It is intended to reflect the version of the record, like version 1, 2, 3, ... which can be seen as the number of updates that have been done on that particular record.
The procedure will make the update on the condition that this value in the record was not updated in the mean time (by some other update). It uses a simple where
clause for that check.
If the update does not update anything, then it means the record did not satisfy this condition any more (and was altered). In that case the exception is raised.
But if the acc_version
is still as you passed it to the procedure, the update
statement will indeed update the targeted record. At the same time the update
statement increments acc_version
. This will prevent other clients who had already queried this record before this update, to make updates. They will need to re-query the record to get the right value of acc_version
, and try again.
The problem is because the result is always execute, I'm gonna set up the code now
– petar
Nov 11 at 19:21
add a comment |
up vote
2
down vote
accepted
The idea is that you would have first selected a record (through a select
query) and then decide to update it. The procedure you quoted is correct. It requires that you pass it the value of acc_version
as last argument. You have that value from the record you queried.
This is a kind of contract you have to follow: you need to query that acc_version
and then pass it to the procedure for the update you want to make. After each update, you have to re-query what the current value of acc_version
is if you still need to make more updates.
The app_version
field needs to be a number (not a date). It is intended to reflect the version of the record, like version 1, 2, 3, ... which can be seen as the number of updates that have been done on that particular record.
The procedure will make the update on the condition that this value in the record was not updated in the mean time (by some other update). It uses a simple where
clause for that check.
If the update does not update anything, then it means the record did not satisfy this condition any more (and was altered). In that case the exception is raised.
But if the acc_version
is still as you passed it to the procedure, the update
statement will indeed update the targeted record. At the same time the update
statement increments acc_version
. This will prevent other clients who had already queried this record before this update, to make updates. They will need to re-query the record to get the right value of acc_version
, and try again.
The problem is because the result is always execute, I'm gonna set up the code now
– petar
Nov 11 at 19:21
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
The idea is that you would have first selected a record (through a select
query) and then decide to update it. The procedure you quoted is correct. It requires that you pass it the value of acc_version
as last argument. You have that value from the record you queried.
This is a kind of contract you have to follow: you need to query that acc_version
and then pass it to the procedure for the update you want to make. After each update, you have to re-query what the current value of acc_version
is if you still need to make more updates.
The app_version
field needs to be a number (not a date). It is intended to reflect the version of the record, like version 1, 2, 3, ... which can be seen as the number of updates that have been done on that particular record.
The procedure will make the update on the condition that this value in the record was not updated in the mean time (by some other update). It uses a simple where
clause for that check.
If the update does not update anything, then it means the record did not satisfy this condition any more (and was altered). In that case the exception is raised.
But if the acc_version
is still as you passed it to the procedure, the update
statement will indeed update the targeted record. At the same time the update
statement increments acc_version
. This will prevent other clients who had already queried this record before this update, to make updates. They will need to re-query the record to get the right value of acc_version
, and try again.
The idea is that you would have first selected a record (through a select
query) and then decide to update it. The procedure you quoted is correct. It requires that you pass it the value of acc_version
as last argument. You have that value from the record you queried.
This is a kind of contract you have to follow: you need to query that acc_version
and then pass it to the procedure for the update you want to make. After each update, you have to re-query what the current value of acc_version
is if you still need to make more updates.
The app_version
field needs to be a number (not a date). It is intended to reflect the version of the record, like version 1, 2, 3, ... which can be seen as the number of updates that have been done on that particular record.
The procedure will make the update on the condition that this value in the record was not updated in the mean time (by some other update). It uses a simple where
clause for that check.
If the update does not update anything, then it means the record did not satisfy this condition any more (and was altered). In that case the exception is raised.
But if the acc_version
is still as you passed it to the procedure, the update
statement will indeed update the targeted record. At the same time the update
statement increments acc_version
. This will prevent other clients who had already queried this record before this update, to make updates. They will need to re-query the record to get the right value of acc_version
, and try again.
edited Nov 11 at 21:28
answered Nov 11 at 14:11
trincot
114k1477109
114k1477109
The problem is because the result is always execute, I'm gonna set up the code now
– petar
Nov 11 at 19:21
add a comment |
The problem is because the result is always execute, I'm gonna set up the code now
– petar
Nov 11 at 19:21
The problem is because the result is always execute, I'm gonna set up the code now
– petar
Nov 11 at 19:21
The problem is because the result is always execute, I'm gonna set up the code now
– petar
Nov 11 at 19:21
add a comment |
up vote
0
down vote
This is what I wanted to achieve
PROCEDURE upd_account
( p_acc_id accounts.acc_id%type
, p_acc_name accounts.acc_name%type
, p_acc_amount accounts.acc_amount%type
, p_acc_date accounts.acc_date%type
, p_version accounts.version%type
)
IS
BEGIN
UPDATE accounts
set acc_name = p_acc_name
, acc_amount = p_acc_amount
, acc_date = p_acc_date
, version = p_version + 1
where acc_id = p_acc_id
and version = p_version;
DBMS_OUTPUT.PUT_LINE ('Number of updated records: ' || TO_CHAR(SQL%ROWCOUNT));
if(SQL%ROWCOUNT = 0)
THEN
RAISE_APPLICATION_ERROR( -20001, 'Oops, the row has changed since you read it.' );
END IF;
END;
1
Warning! Here you did not put theid
check in thewhere
clause. This is NOT correct. You need to make sure the update only happens to the intended record (with a certain ID value). The way you have it now you risk to update multiple records when by coincidence they share the sameversion
value.
– trincot
Nov 12 at 16:54
For the version I use DBMS_UTILITY.GET_TIME, but you're right, is it okay now?
– petar
Nov 12 at 17:06
Yes, it is OK now.
– trincot
Nov 12 at 17:11
add a comment |
up vote
0
down vote
This is what I wanted to achieve
PROCEDURE upd_account
( p_acc_id accounts.acc_id%type
, p_acc_name accounts.acc_name%type
, p_acc_amount accounts.acc_amount%type
, p_acc_date accounts.acc_date%type
, p_version accounts.version%type
)
IS
BEGIN
UPDATE accounts
set acc_name = p_acc_name
, acc_amount = p_acc_amount
, acc_date = p_acc_date
, version = p_version + 1
where acc_id = p_acc_id
and version = p_version;
DBMS_OUTPUT.PUT_LINE ('Number of updated records: ' || TO_CHAR(SQL%ROWCOUNT));
if(SQL%ROWCOUNT = 0)
THEN
RAISE_APPLICATION_ERROR( -20001, 'Oops, the row has changed since you read it.' );
END IF;
END;
1
Warning! Here you did not put theid
check in thewhere
clause. This is NOT correct. You need to make sure the update only happens to the intended record (with a certain ID value). The way you have it now you risk to update multiple records when by coincidence they share the sameversion
value.
– trincot
Nov 12 at 16:54
For the version I use DBMS_UTILITY.GET_TIME, but you're right, is it okay now?
– petar
Nov 12 at 17:06
Yes, it is OK now.
– trincot
Nov 12 at 17:11
add a comment |
up vote
0
down vote
up vote
0
down vote
This is what I wanted to achieve
PROCEDURE upd_account
( p_acc_id accounts.acc_id%type
, p_acc_name accounts.acc_name%type
, p_acc_amount accounts.acc_amount%type
, p_acc_date accounts.acc_date%type
, p_version accounts.version%type
)
IS
BEGIN
UPDATE accounts
set acc_name = p_acc_name
, acc_amount = p_acc_amount
, acc_date = p_acc_date
, version = p_version + 1
where acc_id = p_acc_id
and version = p_version;
DBMS_OUTPUT.PUT_LINE ('Number of updated records: ' || TO_CHAR(SQL%ROWCOUNT));
if(SQL%ROWCOUNT = 0)
THEN
RAISE_APPLICATION_ERROR( -20001, 'Oops, the row has changed since you read it.' );
END IF;
END;
This is what I wanted to achieve
PROCEDURE upd_account
( p_acc_id accounts.acc_id%type
, p_acc_name accounts.acc_name%type
, p_acc_amount accounts.acc_amount%type
, p_acc_date accounts.acc_date%type
, p_version accounts.version%type
)
IS
BEGIN
UPDATE accounts
set acc_name = p_acc_name
, acc_amount = p_acc_amount
, acc_date = p_acc_date
, version = p_version + 1
where acc_id = p_acc_id
and version = p_version;
DBMS_OUTPUT.PUT_LINE ('Number of updated records: ' || TO_CHAR(SQL%ROWCOUNT));
if(SQL%ROWCOUNT = 0)
THEN
RAISE_APPLICATION_ERROR( -20001, 'Oops, the row has changed since you read it.' );
END IF;
END;
edited Nov 12 at 17:07
answered Nov 12 at 16:35
petar
435
435
1
Warning! Here you did not put theid
check in thewhere
clause. This is NOT correct. You need to make sure the update only happens to the intended record (with a certain ID value). The way you have it now you risk to update multiple records when by coincidence they share the sameversion
value.
– trincot
Nov 12 at 16:54
For the version I use DBMS_UTILITY.GET_TIME, but you're right, is it okay now?
– petar
Nov 12 at 17:06
Yes, it is OK now.
– trincot
Nov 12 at 17:11
add a comment |
1
Warning! Here you did not put theid
check in thewhere
clause. This is NOT correct. You need to make sure the update only happens to the intended record (with a certain ID value). The way you have it now you risk to update multiple records when by coincidence they share the sameversion
value.
– trincot
Nov 12 at 16:54
For the version I use DBMS_UTILITY.GET_TIME, but you're right, is it okay now?
– petar
Nov 12 at 17:06
Yes, it is OK now.
– trincot
Nov 12 at 17:11
1
1
Warning! Here you did not put the
id
check in the where
clause. This is NOT correct. You need to make sure the update only happens to the intended record (with a certain ID value). The way you have it now you risk to update multiple records when by coincidence they share the same version
value.– trincot
Nov 12 at 16:54
Warning! Here you did not put the
id
check in the where
clause. This is NOT correct. You need to make sure the update only happens to the intended record (with a certain ID value). The way you have it now you risk to update multiple records when by coincidence they share the same version
value.– trincot
Nov 12 at 16:54
For the version I use DBMS_UTILITY.GET_TIME, but you're right, is it okay now?
– petar
Nov 12 at 17:06
For the version I use DBMS_UTILITY.GET_TIME, but you're right, is it okay now?
– petar
Nov 12 at 17:06
Yes, it is OK now.
– trincot
Nov 12 at 17:11
Yes, it is OK now.
– trincot
Nov 12 at 17:11
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249487%2fhow-to-use-optimistic-locking-within-procedure%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I don't get what I expected": it would be useful if you specify what you do get, and how that is different from what you expected.
– trincot
Nov 11 at 14:18
I've edited the question
– petar
Nov 11 at 20:14
You are supposed to pass a number as last argument, not a date string.
– trincot
Nov 11 at 20:16
Column version is a timestamp data type, how should i forward the number?
– petar
Nov 11 at 20:36
It should not be a timestamp data type, but a plain number. You'll have to alter the data type. The idea is that it functions as an incremental version number: 1, 2, 3 ... reflecting the number of updates that record has received.
– trincot
Nov 11 at 20:37