当执行Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteNonQuery时,如果sql语句是 merge into ...,则返回值表现不稳定,大概率是-1,而不是语句的影响行数.在我的开发环境下debug,返回的是语句影响的行数.但一发布到正式环境下,就返回-1.鉴于此,在有需要返回语种的执行行数,且语句是merge into 时,请不要使用Oracle.ManagedDataAccess.Client.OracleCommand.Exe
因为msdn中说返回受影响的行数: Executes a Transact-SQL statement against the connection and returns the number of rows affected. 但是却没看到备注里说 For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command. When a trigger e
常用语法 MERGE INTO <target table> AS TGT USING <SOURCE TABLE> AS SRC ON <merge predicate> WHEN MATCHED [AND <predicate>] -- 允许两个子句: THEN <action> -- UPDATE 和 DELETE WHEN NOT MATCHED [BY TARGET] [AND <predicate>] -- 允许一个子句:
WITH AS 语法在SQL SERVER 和ORACLE数据库上均支持,主要用于子查询.语法如下: WITH expression_name [ ( column_name [,...n] ) ] AS ( CTE_query_definition ) --只有在查询定义中为所有结果列都提供了不同的名称时,列名称列表才是可选的. --运行 CTE 的语句为: SELECT <column_list> FROM expression_name; 但其语句在两个数据库的应用却有所不同,比如在SQ