簡體   English   中英

Oracle SQL Developer選擇查詢Blob

[英]Oracle SQL Developer select query blob

有誰知道我該如何從表中的列中選擇Blob(在這種情況下為圖像)? 我在下面的查詢拋出此錯誤:

ORA-00932: inconsistent datatypes: expected - got BLOB
00932. 00000 -  "inconsistent datatypes: expected %s got %s"

SELECT homes.title, homes.description, homes.living_room_count, homes.bedroom_count, homes.bathroom_count, homes.price, homes.sqft,
       listagg(features.feature_name, ',') WITHIN GROUP (ORDER BY features.feature_name)  features, home_type.type_name, home_photo.photo, home_photo.description
FROM homes
INNER JOIN home_feature
    ON homes.home_id = home_feature.home_id
INNER JOIN home_type
    ON home_type.type_code = homes.type_code
INNER JOIN home_photo
    ON homes.home_id = home_photo.home_id
INNER JOIN features
    ON home_feature.feature_id = features.feature_id
INNER JOIN home_photo
    ON home_photo.home_id = homes.home_id
GROUP BY homes.title, homes.description, homes.living_room_count, homes.bedroom_count, homes.bathroom_count, homes.price, homes.sqft, home_type.type_name, home_photo.photo, home_photo.description;

謝謝

之所以出現此錯誤,是因為您試圖將GROUP BY與BLOB列一起使用。 在Oracle中這是不可能的。

您應該能夠通過在子查詢中進行分組並將帶有home_photo的JOIN移至外部查詢來解決此問題:

select v1.*,
       home_photo.photo,
       home_photo.description
  from (SELECT homes.homes_id,
               homes.title,
               homes.description,
               homes.living_room_count,
               homes.bedroom_count,
               homes.bathroom_count,
               homes.price,
               homes.sqft,
               listagg(features.feature_name,
                       ',') WITHIN GROUP(ORDER BY features.feature_name) features,
               home_type.type_name
          FROM homes
         INNER JOIN home_feature
            ON homes.home_id = home_feature.home_id
         INNER JOIN home_type
            ON home_type.type_code = homes.type_code
         INNER JOIN features
            ON home_feature.feature_id = features.feature_id
         GROUP BY homes.homes_id,
                  homes.title,
                  homes.description,
                  homes.living_room_count,
                  homes.bedroom_count,
                  homes.bathroom_count,
                  homes.price,
                  homes.sqft,
                  home_type.type_name) v1
 INNER JOIN home_photo
    ON home_photo.home_id = v1.home_id

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM