0

I have a locked down database with a somewhat useful API, however i'm struggling with a final call to retrieve a value.

set serveroutput on;
declare
v_ne_Id number;
begin
v_ne_id := package.get_str('10800002').str_ne_id;
dbms_output.put_line(v_ne_id);
end;
/

The above code through SQL plus gets my result perfectly, however I am using this in a .net application. How can i retrieve the value in asp.net?

I've tried direct coding the above pl/SQL but this doesnt return any value.

1 Answer 1

0

After much trial and error I figured it out... this may or may not help someone.

String SQL = " ";

            SQL += " begin ";
            SQL += " :v_ne_id := package.get_str('10800002').str_ne_id; ";
            SQL += "  ";
            SQL += " end;";

            OracleParameter p_description = new OracleParameter();
            p_description.Direction = ParameterDirection.Output;
            p_description.OracleDbType = OracleDbType.Decimal;
            p_description.Value = "";
            p_description.ParameterName = "v_ne_id";

            using (OracleConnection connection = new OracleConnection(oracleconnection.thisConnString()))
            {
                connection.Open();

                OracleCommand command = new OracleCommand(SQL, connection);


                command.Parameters.Add(p_description);


                command.ExecuteNonQuery();


            }

            return p_description.Value.ToString();

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.