'Stored procedure error-Exception calling "ExecuteNonQuery" with "0" argument(s): "ORA-06502: PL/SQL: numeric or value error:

I am trying to invoke a stored procedure from my powershell but it is giving below error-

Exception calling "ExecuteNonQuery" with "0" argument(s): "ORA-06502: PL/SQL: numeric or value error: character string buffer too small

Below is my powershell code-

    $data_source = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=$DBHost)(PORT=$DBPort))(CONNECT_DATA=(SERVER=DEDICATED)(SID=$DBSID)));User Id=$DBUser;Password=$DBPassword";
    $connectionString = 'User Id=' + $DBUser + ';Password=' + $DBPassword + ';Data Source=' + $data_source
    LogToFile($logTime ,":Data source--- $data_source")
    LogToFile($logTime ,":storedproc--- $storedProc")
    
    $connection= New-Object Oracle.ManagedDataAccess.Client.OracleConnection($connectionString)
    $connection.open()
    
    $command=$connection.CreateCommand()
    $command.CommandText= $storedProc #Name of the stored procedure
    $command.CommandType =[System.Data.CommandType]::StoredProcedure;
    
    
    LogToFile($logTime ,":Triggering Stored procedure with WIN as argument")
#$win- value of the input
    $command.Parameters.Add("WININPUT",[Oracle.ManagedDataAccess.Client.OracleDbType]::Varchar2,$win, [System.Data.ParameterDirection]::Input);
    $command.Parameters.Add("STATUS",[Oracle.ManagedDataAccess.Client.OracleDbType]::Varchar2, [System.Data.ParameterDirection]::Output);
    $command.Parameters.Add("ERRTXT",[Oracle.ManagedDataAccess.Client.OracleDbType]::Varchar2, [System.Data.ParameterDirection]::Output);
    $command.ExecuteNonQuery();
    $connection.Close()

Below is the stored procedure signature provided by DB team-

Package : TEST Stored Procedure : DELETE_WIN_FROM_TEST (WININPUT in varchar2, STATUS out VARCHAR2, ERRTXT out VARCHAR2)

Also, as in the code i am using Oracle.ManagedDataAccess.Client so not sure if i am preparing the parameters body correct, however i am getting below value also-

ArrayBindSize :
ArrayBindStatus :
CollectionType : None
DbType : String
Direction : Input
IsNullable : False
Offset : 0
OracleDbType : Varchar2
OracleDbTypeEx : Varchar2
ParameterName : WININPUT
Precision : 0
Scale : 0
Size : 0
SourceColumn :
SourceColumnNullMapping : False
SourceVersion : Current
Status : Success
UdtTypeName :
Value : 12344912



ArrayBindSize :
ArrayBindStatus :
CollectionType : None
DbType : String
Direction : Output
IsNullable : False
Offset : 0
OracleDbType : Varchar2
OracleDbTypeEx : Varchar2
ParameterName : STATUS
Precision : 0
Scale : 0
Size : 0
SourceColumn :
SourceColumnNullMapping : False
SourceVersion : Current
Status : Success
UdtTypeName :
Value :



ArrayBindSize :
ArrayBindStatus :
CollectionType : None
DbType : String
Direction : Output
IsNullable : False
Offset : 0
OracleDbType : Varchar2
OracleDbTypeEx : Varchar2
ParameterName : ERRTXT
Precision : 0
Scale : 0
Size : 0
SourceColumn :
SourceColumnNullMapping : False
SourceVersion : Current
Status : Success
UdtTypeName :
Value :

Any help is much appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source