ORA-00907:缺少右括号00907. 00000 - “缺少右括号”*原因:*操作:行错误:44列:30

时间:2015-07-08 06:14:21

标签: sql oracle

我正在执行以下查询:

SELECT * 
FROM   (SELECT * 
        FROM   (SELECT DISTINCT r.llobjid   AS dataid, 
                                r.drawingid, 
                                r.revisionid, 
                                r.revisionnumber AS Revision_Number, 
                                r.revisionlabel, 
                                r.minorrevisionlabel, 
                                r.revisiontype, 
                                p.project AS Project, 
                                r.revisionstatus, 
                                r.r1i AS SignIn_Requestor, 
                                r.r2i AS SeedFileVersion, 
                                rt.display_type_name AS Revision_Type, 
                                rt.can_signin, 
                               rs.display_status_name AS Revision_Status, 
                                a.adntypeid, 
                                at.NAME AS ADN_Type, 
                                a.requestby, 
                                a.assignbyAS Assign_By_Id, 
                                ' '  AS Assign_By, 
                                a.assigndate, 
                                ' ' AS Assign_Date 
                FROM   adnids a 
                       INNER JOIN crt_revision r 
                               ON r.drawingid = a.adnid 
                                  AND Upper(a.wholeid) LIKE '4160%' 
                       INNER JOIN adntypes at 
                               ON a.adntypeid = at.adntypeid 
                                  AND at.orgunitid = 21 
                       INNER JOIN crt_project p 
                               ON r.projectid = p.projectid 
                                  AND p.ouid = 21 
                       LEFT OUTER JOIN crt_revision_type_map rt 
                                    ON r.revisiontype = rt.revtypeid 
                                       AND rt.ouid = 21 
                       LEFT OUTER JOIN crt_revision_status_map rs 
                                    ON r.revisionstatus = rs.revstatusid 
                                       AND rs.ouid = 21 
                WHERE  ( r.revisionstatus = 2 )) tbl1 
               INNER JOIN (SELECT DISTINCT d.dataid  AS LLDataID, 
                         Cast(d.dcomment AS NVARCHAR(4000)) AS 
                                           Title, 
                                           d.NAME  AS Document_Name, 
                                       d.createdate  AS  Created_Date, 
                                       d.modifydate  AS Modified_Date, 
                                           d.subtype, 
                                           d.versionnum, 
                                           d.permid, 
                                           d.reserved, 
                                           d.ownerid 
                           FROM   crt_revision r3 
                                  INNER JOIN adnids a3 
                                          ON r3.drawingid = a3.adnid 
                                      AND Upper(a3.wholeid) LIKE '4160%' 
                                  INNER JOIN dtree d 
                                          ON r3.llobjid = d.dataid 
                           WHERE  ( r3.revisionstatus = 2 )) tbl2 
                       ON tbl1.dataid = tbl2.lldataid 
               LEFT OUTER JOIN (SELECT DISTINCT l.dataid AS asm_dataid, 
                                                l.stateid, 
                                                l.intransition, 
                                               ls.NAME  AS Current_State, 
                                                ls.signin, 
                                                ls.lifecycleid, 
                                                ll.NAME  AS Lifecycle 
                                FROM   crt_revision r5 
                                       INNER JOIN adnids a5 
                                               ON r5.drawingid = a5.adnid 
                                    AND Upper(a5.wholeid) LIKE '4160%' 
                                       INNER JOIN lm_lifecycles l 
                                               ON l.dataid = r5.llobjid 
                                       INNER JOIN lm_def_states ls 
                                               ON l.stateid = ls.stateid 
                                       INNER JOIN lm_def_lifecycles ll 
                                               ON ls.lifecycleid = 
                                                  ll.lifecycleid 
                                WHERE  ( r5.revisionstatus = 2 )) tbl4 
                            ON tbl1.dataid = tbl4.asm_dataid 
        WHERE  ( EXISTS (SELECT b.dataid 
                         FROM   dtreeacl b 
                         WHERE  b.dataid = Nvl(tbl2.permid, tbl2.lldataid) 
                                AND ( rightid IN ( -2, -1, 1000, 1001 ) ) 
                                AND see > 0) ) 
        ORDER  BY modified_date DESC) tbl100 
WHERE  rownum <= 25
  

ORACLE SQL Developer抛出错误:ORA-00907:错过了   括号

看起来一切都很好,但不明白我在哪里得到错误的右括号错误。

1 个答案:

答案 0 :(得分:0)

这完全是因为/usr/libexec/webmin/foobar/script /path/filename.tar。 NVARCHAR不是有效的数据类型。

将其更改为Cast(d.dcomment AS NVARCHAR(4000))

它会起作用

Fiddle

在小提琴中,我的样本是

Cast(d.dcomment AS NVARCHAR2(2000))

如果您将其更改为

select Cast('ddd' AS NVARCHAR2(2000)) AS dd from dual

您将收到错误

  

ORA-00907:缺少右括号

Cast Operator in Oracle Tutorial

Data Types in Oracle