Search code examples
sqlsql-updatesap-iq

SQL Anywhere Error -728: Update operation attempted on non-updatable remote query


What I'm trying to do:

update table_name set field2 = substring(REGEXP_SUBSTR(field1, 'item=[0-9]+', charindex('item=', field1)), 6)

But I'm getting

SQL Anywhere Error -728: Update operation attempted on non-updatable remote query

Can I solve it somehow? I don't use local/remote tables. I use one table.


Solution

  • So I guess I found soltion... even 2. Unfortunately still no way to use REGEXP_SUBSTR... I do:

    first

    alter table my_table add item_position int null
    alter table my_table add is_char int null
    alter table my_table add item_part varchar(200) null
    alter table my_table add item bigint null    
    
    update my_table set item_position = charindex('item=', field1)+5; 
    update my_table set item_part = substring(field1, item_pos, 10); 
    update my_table set is_char = charindex('&', clid_part)-1;     
    update my_table set item = case when is_char = -1 then item_part else substring(item_part, 1, charindex('&', item_part)-1) end;
    

    or

    cast(str_replace(substring(field1, charindex('item=', field1)+5, 10), substring(substring(field1, charindex('item=', field1)+5, 10), 
    (charindex('&', substring(field1, charindex('clid=', field1)+5, 10)))), '') as integer) as item
    

    Something like this