OracleParameter[] parameters = {
......
OracleHelper.MakeInParam(":Name", OracleType.VarChar,100,model.Name), ...............
};当model.Name=null时就会报错:ORA-01008: not all variables bound
SQL Server是可以这样处理的,
Oracle是不是不能这么做?还是哪里没配置好?
......
OracleHelper.MakeInParam(":Name", OracleType.VarChar,100,model.Name), ...............
};当model.Name=null时就会报错:ORA-01008: not all variables bound
SQL Server是可以这样处理的,
Oracle是不是不能这么做?还是哪里没配置好?
2 v number := null;
3 t number := 0;
4 begin
5 dbms_output.put_line('asd : '||v);
6 execute immediate 'select count(1) from dual where 1 = :v' into t using v;
7 dbms_output.put_line(t);
8 end;
9 /asd :
0PL/SQL procedure successfully completedSQL>
SQL> declare
2 v number := 1;
3 t number := 0;
4 begin
5 dbms_output.put_line('asd : '||v);
6 execute immediate 'select count(1) from dual where 1 = :v' into t using v;
7 dbms_output.put_line(t);
8 end;
9 /asd : 1
1PL/SQL procedure successfully completedSQL>
我用的是providerName="System.Data.OracleClient",
不知道跟这又没关系?
把null改为DBNull.Value是可以的,