DapperLib / DapperLib/Dapper

Calling store producer in oracle database 12c I get invalid SQL statement

Open
#1,968 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
18.4k
Forks
3.7k
Avg merge
5h 8m
Merged PRs (30d)
1

Description

Hi there
i have store store producer in oracle database 12c with params in and out
and when i run the code i get error the SQL is not invalid
the code below

using (OracleConnection connection = new OracleConnection(_connection.ConnectionString))
{  
    // Create a OracleDynamicParameters object.
    var parameters = new OracleDynamicParameters();
    // Add(string name, OracleDbType oracleDbType, ParameterDirection direction, object value = null, int? size = null)  
  
    parameters.Add("in_RQ_SALES_REQUEST", OracleDbType.Int32 ,ParameterDirection.Input , 14478);
    parameters.Add("in_RQ_AMOUNT", OracleDbType.Int32 ,ParameterDirection.Input , 2500);
    parameters.Add("in_RQ_CURRENCY", OracleDbType.Char ,ParameterDirection.Input ,"YER", 3);
    parameters.Add("in_RQ_TP_CHANNEL", OracleDbType.Char ,ParameterDirection.Input ,"APP", 3);
    parameters.Add("in_RQ_ACC_TYPE", OracleDbType.Varchar2 ,ParameterDirection.Input ,"SUB"); 
    parameters.Add("in_RQ_MAIN_SRVC_ID", OracleDbType.Int32 ,ParameterDirection.Input ,1);
    parameters.Add("in_RQ_SUB_SRVC_ID", OracleDbType.Int32 ,ParameterDirection.Input ,1); 

    parameters.Add("in_RQ_INTERNAL_EXTRA1", OracleDbType.Varchar2 ,ParameterDirection.Input ,"123456"); 
    parameters.Add("in_RQ_INTERNAL_EXTRA2", OracleDbType.Varchar2 ,ParameterDirection.Input ,"775550902"); 

    
    // Add the out parameters to the OracleDynamicParameters object.
    parameters.Add("P_OUT_RESULT", OracleDbType.Int32, ParameterDirection.Output);
    parameters.Add("P_OUT_RESULT_DESC", OracleDbType.Varchar2, ParameterDirection.Output);

    // Call the stored procedure.
    var result = connection.Execute("SP_INIT_SALES_REQUEST", parameters);

    // Retrieve the out parameter values from the OracleDynamicParameters object.
    // int outResult = parameters["out_Result"].Value<int>();
    // string outResultDesc = parameters["out_Result_Desc"].Value<string>();

    // Close the connection.
    connection.Close();

    return Ok("result =>" + result.ToString());
}

And i can not get the out params

// Retrieve the out parameter values from the OracleDynamicParameters object.
// int outResult = parameters["out_Result"].Value<int>();
// string outResultDesc = parameters["out_Result_Desc"].Value<string>();

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the OracleConnection.Execute call and OracleDynamicParameters setup shown in the issue, then reproduce the stored-procedure invocation. Check how Dapper handles the command and output parameters for this call. Done means the procedure executes without the invalid-SQL error and both output values can be retrieved.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.