我一直得到相同的错误代码ORA-00933

时间:2018-04-13 01:54:15

标签: sql oracle

我不太确定这是怎么回事。我将得到代码" 00907缺少右括号"所以,我添加了括号,然后我会得到" 00933错误"

<div><Map /></div>

3 个答案:

答案 0 :(得分:1)

你应该尝试这个:

在要使用的列的列名称之前放置表的别名或名称。

在这里,我假设您希望RENTER_ID表中的RENTER

SELECT RENTER.RENTER_ID,
  RENTER_LNAME,
  ROUND((COUNT(DEP_ID)+1)/APART_BED) AS "PEOPLE / BEDROOM"
FROM RENTER
    JOIN DEPENDENT
        ON RENTER.RENTER_ID = DEPENDENT.RENTER_ID
    JOIN LEASE
        ON LEASE.RENTER_ID = RENTER.RENTER_ID
    JOIN APARTMENT
        ON APARTMENT.APART_NUM = LEASE.APART_NUM
    WHERE RENTER.RENTER_ID        = LEASE_END
      AND RENTER.RENTER_ID          = '30-JUN-18'
    ORDER BY RENTER_ID;

答案 1 :(得分:1)

您在WHERE CLAUSE中有语法错误,您无法写:

 WHERE RENTER_ID = ((LEASE_END) = '30-JUN-18')

您必须编写两个单独的条件,例如:

WHERE RENTER.RENTER_ID = LEASE.RENTER_ID
AND LEASE.LEASE_END = '30-JUN-18'

示例查询:

SELECT RENTER.RENTER_ID,
       RENTER_LNAME,
       Round((Count(DEP_ID) + 1) / APART_BED) AS "PEOPLE / BEDROOM"
  FROM RENTER
  JOIN DEPENDENT
    ON RENTER.RENTER_ID = DEPENDENT.RENTER_ID
  JOIN LEASE
    ON LEASE.RENTER_ID = RENTER.RENTER_ID
  JOIN APARTMENT
    ON APARTMENT.APART_NUM = LEASE.APART_NUM
 WHERE RENTER.RENTER_ID = DEPENDENT.RENTER_ID
 AND LEASE.LEASE_END = '30-JUN-18'
 ORDER BY RENTER_ID;

答案 2 :(得分:0)

SELECT  RENTER.RENTER_ID,
    RENTER_LNAME,
    Round((Count(DEP_ID)+1)/APART_BED) AS "PEOPLE / BEDROOM"
FROM RENTER JOIN DEPENDENT ON RENTER.RENTER_ID = DEPENDENT.RENTER_ID
        JOIN LEASE ON LEASE.RENTER_ID = RENTER.RENTER_ID
        JOIN APARTMENT ON APARTMENT.APART_NUM = LEASE.APART_NUM
WHERE RENTER_ID = LEASE_END AND RENTER_ID = '30-JUN-18'
ORDER BY RENTER_ID;