ORA-00933:oracle 8i

时间:2017-01-18 11:25:12

标签: sql join oracle8i

我想在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;
    }

我的目标是将记录插入表格。

3 个答案:

答案 0 :(得分:0)

将所有内容保存在一组"中,并且您只需要一个;来结束双引号之外的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;
    }

答案 1 :(得分:0)

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

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

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

  

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

答案 2 :(得分:-2)

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