sql – ORA-00936:缺少表达式oracle

前端之家收集整理的这篇文章主要介绍了sql – ORA-00936:缺少表达式oracle前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有这个问题
SELECT DAL_ROWNOTABLE.DAL_ID FROM 
(
    SELECT ticket.id AS "DAL_ID",ROWNUMBER ( Order By ticket.id  )  AS "DAL_ROWNUMBER" 
    FROM ticket_table ticket 
    WHERE ( ticket.type = N'I' ) 
    AND 
    ( 
        ticket.tenant IS NULL OR ticket.tenant IN 
        (
            SELECT  * FROM 
            ( 
                SELECT tenant_group_member.tenant_id 
                FROM tenant_group_member 
                WHERE tenant_group_member.tenant_group = HEXTORAW('30B0716FEB5F4E4BB82A7B7AA3A1A42C') 
                ORDER BY ticket.id 
            ) 
         ) 
     )
) DAL_ROWNOTABLE 
WHERE DAL_ROWNOTABLE.DAL_ROWNUMBER BETWEEN 1 AND 21

允许查询抛出ORA-00936缺少表达式的问题是什么?任何人?任何帮助将不胜感激…错误抛出列:80是在第一个订单的开头:

解决方法

您的查询可以大大简化.它具有额外的子查询层和子查询中不必要的顺序.你想用rownumber做什么,你只需要rownum:
SELECT DAL_ROWNOTABLE.DAL_ID
FROM (SELECT ticket.id AS "DAL_ID" 
      FROM ticket_table ticket 
      WHERE (ticket.type = N'I' ) AND 
            (ticket.tenant IS NULL OR
             ticket.tenant IN (SELECT tgm.tenant_id 
                               FROM tenant_group_member tgm
                               WHERE tgm.tenant_group = HEXTORAW('30B0716FEB5F4E4BB82A7B7AA3A1A42C') 
                              ) 
            )
      ORDER BY ticket.id
     ) DAL_ROWNOTABLE 
WHERE rownum <= 21;
原文链接:https://www.f2er.com/mssql/83800.html

猜你在找的MsSQL相关文章