'Is it possible to use row access locking when using SCRIPT command in Teradata

I'm trying to process the data in the table using an external script (Linux binary) with the SCRIPT_COMMAND function. However I cannot make it work so that row access lock is applied. By default read lock seems to be applied for the whole table.

This is an example - the script command is not important.

EXPLAIN SELECT * FROM SCRIPT
( ON (SELECT * from user1.test_table)   
SCRIPT_COMMAND('echo test') RETURNS('text VARCHAR(30)'));

This returns

 Explanation                                                              
 ------------------------------------------------------------------------ 
   1) First, we lock user1.test_table in TD_MAP1 for read on a     
      reserved RowHash to prevent global deadlock.                       
   2) Next, we lock user1.test_table in TD_MAP1 for read.          
(...)

I tried the following query:

EXPLAIN SELECT * FROM SCRIPT
( ON (LOCK ROW FOR ACCESS SELECT * from user1.test_table)   
SCRIPT_COMMAND('echo test') RETURNS('text VARCHAR(30)'));

But it is invalid.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source