Home » SQL & PL/SQL » SQL & PL/SQL » ORA:01427: single row sub query returns more than one record (Oracle 11g)
ORA:01427: single row sub query returns more than one record [message #598132] Thu, 10 October 2013 09:56 Go to next message
jayant.tripathi
Messages: 8
Registered: October 2013
Junior Member
Hi

I am not able to update a table cloumn using below query and getting ORA 01427: single row subquery returns more than one record error.

update fuctions f set id = (Select g.fn_id from access g where g.level = 'A' )
where f.u_id = "ABC";

I understand that problem is there with inner select query.

Can you please help me with this?

Thanks.
Re: ORA:01427: single row sub query returns more than one record [message #598134 is a reply to message #598132] Thu, 10 October 2013 10:06 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
You need to change the sub-query so it only returns one row per row being updated.
How you do that in your case we have no idea since we don't know what your tables and data look like or what the relationship between the tables is.
Re: ORA:01427: single row sub query returns more than one record [message #598160 is a reply to message #598132] Thu, 10 October 2013 16:23 Go to previous message
John Watson
Messages: 8929
Registered: January 2010
Location: Global Village
Senior Member
jayant.tripathi wrote on Thu, 10 October 2013 15:56
Hi

I am not able to update a table cloumn using below query and getting ORA 01427: single row subquery returns more than one record error.

update fuctions f set id = (Select g.fn_id from access g where g.level = 'A' )
where f.u_id = "ABC";

I understand that problem is there with inner select query.

Can you please help me with this?

Thanks.
This should run, but I have no idea if it is correct in business terms:
update fuctions f set id = (Select max(g.fn_id) from access g where g.level = 'A' )
where f.u_id = "ABC";


[Updated on: Thu, 10 October 2013 16:26]

Report message to a moderator

Previous Topic: Creating views - percentages and multiple tables. Newbie
Next Topic: Rank based on multiple conditions
Goto Forum:
  


Current Time: Fri Apr 19 18:53:48 CDT 2024