In which, the first error pattern is very common and easy to solve. But the second one is not so obvious, you need more patience to solve it. If SQL engine expects your subquery to return a single row, it may throw ORA when the subquery returns more than one row unexpectedly. For example:. Consequently, the statement fails to continue and then throw ORA to notify developers. It's just like that we wanted strictly only one item, but eventually it returned more than we expected. Equal Sign Wants Only One.
But Get More Eventually! A similar exception that relates to returned number mismatch is ORA too many values. But they have different error patterns. If you really want to use an equal operator to confine the scope of returned rows as one, you have to limit the number of rows returned of queries to only one row.
Id, p. Name, cc. CCode, cc. Improve this answer. Yup changed my table name and let me try this out ; — user You appear to have dulicates in your category table; otherwise a simple join would suffice: select p. Gordon Linoff Gordon Linoff 1. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog.
The subquery returns a table of two columns and 91 rows. It's returned to outer query and City and Country in employees table are compared with each row in the table. This query reveals the highest unit price for each product sold. The inner query returns a temporary table that contains ProductID and maximum price for the product. This temporary table is then returned to outer query to use. It uses inner join to rephrase the query above and the query performance is dramatically improved. ProductID , a.
ProductID and a. ProductID ;. Custom Search. Practice 1: Use subquery to return rows of values.
0コメント