0

次のステートメントの件名で参照されている ORA-00933 エラーが発生しています。

 select
 (select count(name) as PLIs
 from (select
   a.name,
   avg(b.list_price) as list_price
 from 
   crm.prod_int a, crm.price_list_item b
 where 
   a.row_id = b.product_id
   and a.x_sales_code_3 <> '999'
   and a.status_cd not like 'EOL%'
   and a.status_cd not like 'Not%'
   and a.x_sap_material_code is not null
 group by a.name)
 where list_price = 0)
 /
 (select count(name) as PLIs
 from (select
   a.name,
   avg(b.list_price) as list_price
 from 
   crm.prod_int a, crm.price_list_item b
 where 
   a.row_id = b.product_id
   and a.x_sales_code_3 <> '999'
   and a.status_cd not like 'EOL%'
   and a.status_cd not like 'Not%'
   and a.x_sap_material_code is not null
 group by a.name))
 as result from dual;

他の投稿で提案された解決策としてエイリアスを削除しようとしましたが、問題は変わりませんでした。何か案は?ありがとう。

4

3 に答える 3

0

これはあなたの質問に直接答えるものではありませんが、クエリを簡略化できると思います:

select case PLIs when 0 then -1 else PLIs_noprice / PLIs end from (
 select 
  count(name) as PLIs,
  count(case list_price when 0 then 1 end) as PLIs_noprice
 from (
  .... your innermost subselect, up to "group by" goes here ...
 )
)

どういうわけか、実際の副選択コードをここに貼り付けることができず、「投稿の送信中にエラーが発生しました」というメッセージが表示されます...テーブルがないため、テストされていません。

于 2013-05-15T15:34:33.177 に答える