OracleCommandBuilder.DeriveParameters doesn't return parameters every time
-
Hello, I use Microsoft's Oracle client provider. I have 2 Oracle stored procedures that do the same thing and have only different names: SP1: create or replace procedure GetScalar(last_name IN PERSON.LastName%TYPE, row_count OUT INTEGER) as begin SELECT COUNT(*) INTO row_count FROM PERSON WHERE LASTNAME = last_name; end GetScalar; SP2: create or replace procedure Get_Bool(last_name IN PERSON.LastName%TYPE, r_count OUT INTEGER) as begin SELECT COUNT(*) INTO r_count FROM PERSON WHERE LASTNAME = last_name; end Get_Bool; I use the same C# code for both. When I use stored procedure SP1 after this code was called: OracleCommandBuilder.DeriveParameters(objCmd); int n = objCmd.Parameters.Count; n is 2, which is ok. But, when I use stored procedure SP2: n is 0, which is not ok. What should I do yo make it work? When I call both store procedures inside Oracle enviroment both work fine.
-
Hello, I use Microsoft's Oracle client provider. I have 2 Oracle stored procedures that do the same thing and have only different names: SP1: create or replace procedure GetScalar(last_name IN PERSON.LastName%TYPE, row_count OUT INTEGER) as begin SELECT COUNT(*) INTO row_count FROM PERSON WHERE LASTNAME = last_name; end GetScalar; SP2: create or replace procedure Get_Bool(last_name IN PERSON.LastName%TYPE, r_count OUT INTEGER) as begin SELECT COUNT(*) INTO r_count FROM PERSON WHERE LASTNAME = last_name; end Get_Bool; I use the same C# code for both. When I use stored procedure SP1 after this code was called: OracleCommandBuilder.DeriveParameters(objCmd); int n = objCmd.Parameters.Count; n is 2, which is ok. But, when I use stored procedure SP2: n is 0, which is not ok. What should I do yo make it work? When I call both store procedures inside Oracle enviroment both work fine.
Would help if code tags were used but it appears that the stored proc signature, excluding identifiers, is the same. If that is the case then you have a faulty assumption. You are assuming that a difference in identifies makes a difference. Excluding key word usage (which I do not see any) that is not possible. Since it isn't possible it suggests that you need to look for a difference source of the problem. So possible reasons are the following. This is not a complete list. - The proc in your C# code is not named correctly. - The proc does not exist in the database, or it is an older version with no parameters. - You are pointing at a different database.
-
Hello, I use Microsoft's Oracle client provider. I have 2 Oracle stored procedures that do the same thing and have only different names: SP1: create or replace procedure GetScalar(last_name IN PERSON.LastName%TYPE, row_count OUT INTEGER) as begin SELECT COUNT(*) INTO row_count FROM PERSON WHERE LASTNAME = last_name; end GetScalar; SP2: create or replace procedure Get_Bool(last_name IN PERSON.LastName%TYPE, r_count OUT INTEGER) as begin SELECT COUNT(*) INTO r_count FROM PERSON WHERE LASTNAME = last_name; end Get_Bool; I use the same C# code for both. When I use stored procedure SP1 after this code was called: OracleCommandBuilder.DeriveParameters(objCmd); int n = objCmd.Parameters.Count; n is 2, which is ok. But, when I use stored procedure SP2: n is 0, which is not ok. What should I do yo make it work? When I call both store procedures inside Oracle enviroment both work fine.
Roll your own -- don't depend on automagic tools.