0

I need to call two system stored procedures in an Oracle database to refresh materialised views when a C# API executes a related process. My code attempts to do so get the following error:

ORA-06512: at "SYS.DBMS_UTILITY", line 236
ORA-06512: at "SYS.DBMS_UTILITY", line 256
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 3016
ORA-06512: at line 1

My last attempt was this:

            string command= "dbms_snapshot.refresh";
            string mv1 = "MV_00";
            string mv2 = "MV_01";
            string parameter = String.Concat(mv1, ", ", mv2);
            //we pull the connection here from an EF datamodel
            using (var cnx = (OracleConnection)new DataModel().Database.Connection)
            using (var cmd = new OracleCommand(command, cnx))
        
            {
                cmd.Parameters.Add(parameter, OracleDbType.Varchar2);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                await cnx.OpenAsync();
                await cmd.ExecuteNonQueryAsync();
                cnx.Close();
            }      

The error text in c# indicates something is wrong with the parameter value. What am I doing wrong here? I understand how parameters work, that is not the question, simply what is wrong with my comma separated list that would throw the error back up the stack.

3
  • This question shows how to use an oracle parameter. It doesn't look quite like what you have here: stackoverflow.com/questions/50830965/… Commented Jul 11, 2023 at 13:18
  • That doesn't in the least answer the question. The question is why the parameter, which is a varchar2 going into the database stored procedure which is awaiting a string list separated by commas, is not accepting the string concatenated in c#. Commented Jul 11, 2023 at 14:00
  • And the answer of the linked question shows the person creating a parameter as a new OracleParameter(paramerName, parameterValue) Nothing like that was done here. This should actually be closed as duplicate question Commented Jul 11, 2023 at 14:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.