How do you copy substring from clob-field with SQL if substring from/to positions are varables?
This works OK (RPG free w embedded sql):
exec sql select substr(myclobfield, 25, 70)
Whereas this causes a compilation error:
from = 25;
to = 70;
exec sql select substr(myclobfield, :from, :to)
The compile error follows:
MSG ID SEV RECORD TEXT
SQL0171 30 27 Position 1 Argument 2 of function SUBSTRING not valid.
SQL0171 30 27 Position 1 Argument 3 of function SUBSTRING not valid.
Pls explain why this does not work, and please give hint on how to circomvent; - since the positions in the clob-field content are changing from record to record, the application need the from/to positions to be variables.
Software/Hardware used: Power System i, v6r1, ilerpg, sql
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!