igorrino
21st August 2008, 13:23
I need make a update in a table using diferent alias
select tdssc019.plvl: plvl, tdssc019.ptyp: ptyp, tdssc019.item:artitemp, tdssc019.cava:cavatemp
from tdssc019 for update
where tdssc019._index1 = {:tdssc019.ides,
:tdssc019.pono}
and tdssc019.plvl = 1
selectdo
tdssc019.cava = cava
db.update(ttdssc019, db.retry)
endselect
i need this because this table (tdssc019) is used in the sesion and I do not want to lose position. this way not found
sushil
21st August 2008, 14:08
Hi,
Try adding tdssc019.* while selecting , and then update it.
i.e
select tdssc019.plvl: plvl, tdssc019.ptyp: ptyp, tdssc019.item:artitemp, tdssc019.cava:cavatemp ,tdssc019.*
from tdssc019 for update
where tdssc019._index1 = {:tdssc019.ides,
:tdssc019.pono}
and tdssc019.plvl = 1
selectdo
tdssc019.cava = cava
db.update(ttdssc019, db.retry)
endselect
Regards,
Sushil Kumar Mudaliar
igorrino
21st August 2008, 14:13
The problem is that the session is a maintenance of that table, but the field that u can updateis also of that table but another record
sushil
21st August 2008, 14:37
Hi,
you can try like this...this might be a help to you.....
example -
Select tiitm001.dsca:dsc1,tiitm001.item from tiitm001
where tiitm001.item = :a
selectdo
select tiitm001.* from tiitm001 for update
where tiitm001.item=:b
selectdo
tiitm001.dsca=dsc1
db.update(ttiitm001,db.retry)
commit.transaction()
endselect
endselect
Regards,
Sushil Kumar Mudaliar
manish_patel
21st August 2008, 14:58
i need this because this table (tdssc019) is used in the sesion and I do not want to lose position. this way not found
You can use on.main.table() function in scripts. This enables you to perform actions on the record contents without affecting the values in the table.
Write your updation code in to function (eg update.cava) and call it using on.main.table() function.
eg.
on.main.table(update.cava)
functions:
function update.cava()
{
db.retry.point()
select tdssc019.plvl: plvl, tdssc019.ptyp: ptyp, tdssc019.item:artitemp,
tdssc019.cava:cavatemp
from tdssc019 for update
where tdssc019._index1 = {:tdssc019.ides, :tdssc019.pono}
and tdssc019.plvl = 1
selectdo
tdssc019.cava = cava
db.update(ttdssc019, db.retry)
commit.transaction()
endselect
}
sushil
21st August 2008, 15:40
Hi manish,
Thanks for the above post.
Regards,
Sushil Kumar Mudaliar