-
updating records
i have to update column .there is one to many relationship between two tables.and i am trying to do this ..
update line set passcode= "(select mdn from line l,line_esn le where l.line_id=le.line_id )"
passcode value is last 4 digit of mdn. mdn is 10 digit number.so how do i substring the mdn.likemdn.substring(6,10) .should i have to use function..
-
Re: updating records
Use substr as follows
select substr('1234567890',7,4) from dual
OUPUT
7890
update line set passcode[B]=[/B] (select [B]substr(mdn,7,4)[/B] from line l,line_esn le where l.line_id=le.line_id )
Here you are using = .
If there is a chance to return more than one row then use distinct keyword in the subquery.
SELECT DISTINCT SUBSTR(MDN,7,4) from line l,line_esn le where l.line_id=le.line_id )
-
Re: updating records
try this
select substr(mdn,-4) from ....
It will give the last four digits