Quote:
|
Originally Posted by cboden
I am new to doing fancy updates and I am in need of help....
I need to change the first four digits in a field. Here is my sql:
update INPT_PKT_hdr
set substr(pkt_ctrl_nbr,1,4) = 'EUAZ'
where substr(pkt_ctrl_nbr,1,4) like 'EUAT%';
can anyone help me?
|
update INPT_PKT_hdr
set pkt_ctrl_nbr = 'EUAZ' || substr(pkt_ctrl_nbr, 5, ddd)
where pkt_ctrl_nbr like 'EUAT%';
ddd in above substr is the max length of your column pkt_ctrl_nbr
BTW, I changed your predicate by removing the substr to make it more efficiently. Another alternative is:
where substr(pkt_ctrl_nbr, 1,4) = 'EUAT';