How to pass string array to snowflake stored procedure from C#?

35 Views Asked by At

I have a stored procedure with the following argument:

CREATE OR REPLACE PROCEDURE GET_CALCULATED_ANALYSIS(
  Provider_Names ARRAY
)

When I call it in the worksheet it works fine:

CALL GET_CALCULATED_ANALYSIS(['Dr Sulaiman Al Habib Medical Center (DHCC)', 'Dr Rami Hamed Center']);

But when I'm trying to call it from C#:

public async Task<List<Analysis>> GetCalculatedAnalysis(string[] providerNames)
{
    return await ExecuteWithConnection(async () =>
    {
        var analysisList = await _connection.QueryAsync<Analysis>(
            $"CALL {_appParameters.StoredProcedures.GetCalculatedAnalysis}(:providerNames)",
            commandTimeout: 0,
            param: new { providerNames }
        );

        return analysisList.ToList();
    });
}

I get this error:

Invalid argument types for function 'GET_CALCULATED_ANALYSIS': ((VARCHAR(42)) SqlState: 42P13, VendorCode: 1044,

I tried to use .ToArray() method, but it doesn't help at all.

0

There are 0 best solutions below