Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update table Error : single-row subquery returns more than one row

Status
Not open for further replies.

soushi01

Technical User
Dec 27, 2010
31
0
0
MY
Hi,
im newbie of sql user


Im try to write a script to update description base on condition that u insert
, the purpose of write this query is for "Remove Title" by using substring ,
Eg: "TT MOVIE dynasty package" , change description to display "dynasty package"

but its pop--up common error "single-row subquery returns more than one row".




here is my query

update table1
--Is set for remove the front title description
set descr = (select SUBSTR(t1.descr,10)
from table1 t1,
table2 t2,
table3 t3,
table4 t4,
table5 t5
where
t1.id=table1.id and
t1.t2_OBJ_ID0 = t2.id and
t3.id = t2.t3_OBJ_ID0 and
t3.id = t4.t3_OBJ_ID0 and
t5.id = t4.t5_OBJ_ID0 and
----retrieve which title description
upper(t1.descr) like 'TT MOVIE%'
---- to insert the condition that you want to remove
t5.descr in(
'TT MOVIE dynasty package',
'TT MOVIE western package'
)
)
where exists (select SUBSTR(t1.descr,10)
from table1 t1,
table2 t2,
table3 t3,
table4 t4,
table5 t5
where
t1.id=table1.id and
t1.t2_OBJ_ID0 = t2.id and
t3.id = t2.t3_OBJ_ID0 and
t3.id = t4.t3_OBJ_ID0 and
t5.id = t4.t5_OBJ_ID0 and
--retrieve which title description
upper(t1.descr) like 'TT MOVIE%'
-- to insert the condition that you want to remove
t5.descr in(
'TT MOVIE dynasty package',
'TT MOVIE western package'
)
);


thanks
regards,
s1
 
Why not simply this ?
UPDATE table1
SET descr = SUBSTR(descr,10)
WHERE upper(descr) LIKE 'TT MOVIE%'

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
hi,PHV

its not only use 1 table to update.... it may join more than 4 table...

but my problem is solved .....

any thanks for ur solution


regards,
s1
 
but my problem is solved
Could you, please, share your solution for the benefit of the members ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top