pkatanic
21st September 2015, 16:36
I tried this in Oracle :
Select REPLACE(tfcmg301.t$orig,'302',' ')
from BAAN.TTFCMG301302 tfcmg301;

Select SUBSTR(tfcmg301.t$orig,5)
from BAAN.TTFCMG301302 tfcmg301;

The question is how to write function in BAAN to remove first 4 charachters from tfcmg301.t$orig ?

mark_h
21st September 2015, 17:48
I am sure there are better ways than this, but basically I would write session(or maybe just a script depending on situation) to find all the tfcmg301 records and just set tfcmg301.orig to tfcmg301(5;length) where the length is found using len(tfcmg301). Then just do a update. Something like this:

db.retry.point()
select tfcmg301.orig
from tfcmg301 for update
where ....set your conditions...
selectdo
orig.length = len(tfcmg301.orig) - 4
tfcmg301.orig = tfcmg301.orig(5,orig.length)
db.update(ttfcmg301,db.retry)
commit.transaction()
endselect

bhushanchanda
21st September 2015, 19:08
Hi,

To add one more solution. Again, there could be various better possibilities. :)

db.retry.point()
select tfcmg301.orig
from tfcmg301 for update
where ....set your conditions...
selectdo
tfcmg301.orig(1;len(tfcmg301.orig)-4) = tfcmg301.orig(5;len(tfcmg301.orig))
db.update(ttfcmg301,db.retry)
commit.transaction()
endselect

pkatanic
23rd September 2015, 14:44
Thank you both!