ORA-00933: 甲骨文 8i

Posted

技术标签:

【中文标题】ORA-00933: 甲骨文 8i【英文标题】:ORA-00933: oracle 8i 【发布时间】:2017-01-18 11:25:11 【问题描述】:

我想在 Oracle 8i 中使用 join。我的查询如下。 我有使用join 从两个表中获取数据的查询,但我收到错误SQL command not properly ended

    private List<StamfordProdRelease> GetStamfordProdReleases()
    
        List<StamfordProdRelease> list = null;

        string srtQry = "SELECT NVL(NULL, 0) ID," +
        "                DLOG.RELEASEID AS RELEASE_BUILD," +
        "                TRUNC (DLOGDET.DEPLOYDATE) AS PROD_DEPLOY_DATE," +
        "                DLOGDET.DEPLOYREQUEST AS BAAR_RFD," +
        "                DLOG.FILENAMEEXT_VC AS SCRIPT_NAME," +
        "                DLOG.VERSION," +
        "                DLOG.REQUEST," +
        "                DLOG.NOTE AS COMMENTS" +
        "                FROM ADM_DEPLOYMENTLOGDETAIL DLOGDET" +
        "                JOIN ADM_DEPLOYMENTLOG DLOG ON DLOG.LOGNO = DLOGDET.LOGNO;";

        using (OracleConnection conn = new OracleConnection(Globals.Constants.AppConnectionStringReadOnly))
        
            using (OracleCommand objCommand = new OracleCommand(srtQry, conn))
            
                objCommand.CommandType = CommandType.Text;
                DataTable dt = new DataTable();
                OracleDataAdapter adp = new OracleDataAdapter(objCommand);
                conn.Open();
                adp.Fill(dt);
                if (dt != null)
                
                    list = ConvertToStamfordProdRelease(dt).ToList();
                
            
        
        return list;
    

我的目标是向表中插入记录。

【问题讨论】:

删除“;”来自查询 为什么不接受答案? 【参考方案1】:

将所有内容保存在一组 " 中,并且您只需要一个 ; 即可在双引号之外结束 SQL 查询。

    private List<StamfordProdRelease> GetStamfordProdReleases()
    
        List<StamfordProdRelease> list = null;

        string srtQry = "SELECT NVL(NULL, 0) ID, 
DLOG.RELEASEID AS RELEASE_BUILD, 
TRUNC (DLOGDET.DEPLOYDATE) AS PROD_DEPLOY_DATE, 
DLOGDET.DEPLOYREQUEST AS BAAR_RFD, 
DLOG.FILENAMEEXT_VC AS SCRIPT_NAME, 
DLOG.VERSION, 
DLOG.REQUEST, 
DLOG.NOTE AS COMMENTS 
FROM ADM_DEPLOYMENTLOGDETAIL DLOGDET 
JOIN ADM_DEPLOYMENTLOG DLOG ON DLOG.LOGNO = DLOGDET.LOGNO";

        using (OracleConnection conn = new OracleConnection(Globals.Constants.AppConnectionStringReadOnly))
        
            using (OracleCommand objCommand = new OracleCommand(srtQry, conn))
            
                objCommand.CommandType = CommandType.Text;
                DataTable dt = new DataTable();
                OracleDataAdapter adp = new OracleDataAdapter(objCommand);
                conn.Open();
                adp.Fill(dt);
                if (dt != null)
                
                    list = ConvertToStamfordProdRelease(dt).ToList();
                
            
        
        return list;
    

【讨论】:

【参考方案2】:

Oracle 8i 不支持标准 ANSI SQL JOIN 语法。

该功能是在 Oracle 9i 第 2 版(又名 Oracle 9.2)中引入的

Quote from the chapter "What's New in SQL Reference"

SELECT [...] 具有符合 ANSI 的新连接语法。

【讨论】:

【参考方案3】:

不要将所有的字符串组合在一起。

【讨论】:

以上是关于ORA-00933: 甲骨文 8i的主要内容,如果未能解决你的问题,请参考以下文章

甲骨文表格 6i

Oracle简述

ORA-00933: SQL 命令未正确结束 00933. 00000 - “SQL 命令未正确结束

SQL 错误:ORA-00933:SQL 命令未正确结束 00933。00000 -“SQL 命令未正确结束”

“ORA-00933: SQL 命令未正确结束”

ora-00933:SQL 命令未正确结束