ORA-00936: 缺少表达式 | ASP.NET 核心 3.1 MVC |文件为 | NPoco

ORA-00936: missing expression | ASP .NET CORE 3.1 MVC | WITH FILES AS | NPoco

我的函数有问题,抛出异常“ORA-00936:缺少表达式”,但查询在 Oracle SQL开发者...

有谁知道这可能来自哪里?

public List<(string, string, string, string)> GetSomething(string idWorkflow)
{
    var nb = new List<(string, string, string, string)>();

    if (!string.IsNullOrEmpty(idWorkflow))
    {
        try
        {
            List<(string, string, string, string)> result = _core.Query<dynamic>(
                $"WITH FILES AS " +
                $"(SELECT m.col1, m.col2 FROM TABLE1 m WHERE m.col5=@0 AND EXISTS(SELECT 1 FROM TABLE3 s WHERE s.col5 = m.col5 AND m.col6 = s.col8) AND m.col7 IS NULL) " +
                $"SELECT " +
                $"f.col1, " +
                $"f.col2, " +
                $"(SELECT col9 FROM TABLE2 h, TABLE4 d WHERE h.col1 = d.col10 AND d.col11 = f.col1 AND col12 = 3 AND d.col13 = 'INV' AND ROWNUM = 1) col3, " +
                $"(SELECT col9 FROM TABLE2 h, TABLE4 d WHERE h.col1 = d.col10 AND d.col11 = f.col1 AND col12 in (5, 6) AND d.col13 = 'INV' AND ROWNUM = 1) col4 " +
                $"FROM FILES f"
                ,
                idWorkflow
                ).Select(x => ((string)x.col1, (string)x.col2, (string)x.col3, (string)x.col4)).ToList();
            return result;
        }
        catch (Exception e)
        {
            var test = e.Message;
            return nb;
        }
    }

    return nb;
}

这是我解决问题的方法:

public List<(string, string, string, string)> GetSomething(string idWorkflow)
{
    var nb = new List<(string, string, string, string)>();
    var param = new { workflow = idWorkflow };
    var query = @";WITH FILES AS (
              SELECT m.col1, m.col2 FROM TABLE1 m WHERE m.col5=@workflow AND EXISTS(SELECT 1 FROM TABLE3 s WHERE s.col5 = m.col5 AND m.col6 = s.col8) AND m.col7 IS NULL)
                SELECT
                f.col1,
                f.col2,
                (SELECT col9 FROM TABLE2 h, TABLE4 d WHERE h.col1 = d.col10 AND d.col11 = f.col1 AND col12 = 3 AND d.col13 = 'INV' AND ROWNUM = 1) col3,
                (SELECT col9 FROM TABLE2 h, TABLE4 d WHERE h.col1 = d.col10 AND d.col11 = f.col1 AND col12 in (5, 6) AND d.col13 = 'INV' AND ROWNUM = 1) col4
                FROM FILES f";
    if (!string.IsNullOrEmpty(idWorkflow))
    {
        try
        {
            List<(string, string, string, string)> result = _core.Query<dynamic>(query, param).Select(x => ((string)x.col1, (string)x.col2, (string)x.col3, (string)x.col4)).ToList();
            return result;
        }
        catch (Exception e)
        {
            var test = e.Message;
            return nb;
        }
    }
    return nb;
}