You can translate the question and the replies:

Custom Stored Procedure with default parameter

Hi, in java we created a custom stored procedure having a few input parameters. ``` new StoredProcedureParameter("input_database_name", Types.VARCHAR, StoredProcedureParameter.DIRECTION_IN), new StoredProcedureParameter("input_view_name", Types.VARCHAR, StoredProcedureParameter.DIRECTION_IN), new StoredProcedureParameter("input_column_name", Types.VARCHAR, StoredProcedureParameter.DIRECTION_IN), ``` is it possible to set a default value to "input_column_name"? In a case the storedProcedure will not go into error when "input_column_name" is not set when executing the custom stored procedure.
01-08-2018 05:20:59 -0400

1 Answer

Hello, While the Java API does not provide support for default values outright, there is a workaround to make this happen. You can develop the procedure to where if the input is NULL, then the value of that parameter becomes your default value. So it would follow the logic that if "input_column_name" = NULL, then "input_column_name" = default value. If you invoke the procedure with SELECT and want to make the parameter NULL, just do not provide a value for that parameter in the WHERE clause - this will make the parameter NULL by default. Then you can implement the logic mentioned above. Hope this helps!
Denodo Team
01-08-2018 15:49:02 -0400
You must sign in to add an answer. If you do not have an account, you can register here