Oracle SQL permits a single-row (scalar) subquery to appear as one of the value expressions in an INSERT ... VALUES clause, so the statement executes successfully and inserts a new row. SH.SALES is a fact table with no primary-key or unique constraint on prod_id alone, so it is expected and permitted to hold multiple sales rows for the same product recorded at different times with different amounts, meaning a product can have a different unit price at different times and a second row for product 23 does not violate any constraint. The SH.SALES table structure consists of five foreign key columns -- prod_id, cust_id, time_id, channel_id, and promo_id -- referencing the Products, Customers, Times, Channels, and Promotions dimension tables respectively, plus the quantity_sold and amount_sold measure columns.
Community Discussion