Home » SQL & PL/SQL » SQL & PL/SQL » Update Statement
Update Statement [message #2181] Wed, 26 June 2002 05:51 Go to next message
Messages: 4
Registered: June 2002
Junior Member
Hi! I'm trying to make an update statement,However, I would like to implement a SELECT statement in the SET clause of the UPDATE. How would I do that without getting the following error:
ORA-01427: single-row subquery returns more than one row.

basically what I want to do with this UPDATE is that I do not want to actually put the literal data in the UPDATE. I would like for the UPDATE to do this automatically by me using a SELECT statement.

this my UPDATE statement:

UPDATE student_course
SET sc_grade = (SELECT AVG(scg_item_grade)
FROM student,student_course_grade,student_course,course
WHERE s_ssn = sc_s_ssn
student_course_id IN(sc_id)
sc_course_number = course_number
Re: Update Statement [message #2182 is a reply to message #2181] Wed, 26 June 2002 06:36 Go to previous message
koteswara rao p.
Messages: 10
Registered: June 2002
Junior Member
In your query there is one error.
the error is the subquery i.e select query
returning more than on rows.
the select query should return one row and only one
because you are assigning the result to sc_grade.
try once again.

Previous Topic: plsql fuction
Next Topic: Create Function
Goto Forum:

Current Time: Wed Feb 19 04:06:00 CST 2020