2014-09-26 83 views
0

我試圖在Oracle SQL中運行以下查詢,但它始終迴應'單行子查詢返回多個行'的錯誤。 DESCR254的查詢獲取10個結果。Oracle SQL插入單行子查詢返回多個行

INSERT INTO PS_Z_TREND_NOW_TBL 
    VALUES(
(SELECT DESCR254 
    FROM ( 
SELECT DESCR254 
, COUNT(*) AS COUNT 
    FROM PS_IS_STATS_URLS 
    GROUP BY DESCR254 
    ORDER BY COUNT(*) DESC, DESCR254) 
WHERE ROWNUM <= 10), ' ') 

PS_Z_TREND_NOW_TBL有兩列。我試圖在第一列中插入子查詢的結果,並在第二列中添加''。有誰知道我做錯了什麼?

回答

1

試試這個:

INSERT INTO PS_Z_TREND_NOW_TBL 
SELECT DESCR254,' ' 
    FROM ( 
SELECT DESCR254 
     , COUNT(*) AS COUNT 
    FROM PS_IS_STATS_URLS 
    GROUP BY DESCR254 
    ORDER BY COUNT(*) DESC, DESCR254 
) 
WHERE ROWNUM <= 10))