locked
Array of parameters in the WebAPI service RRS feed

  • Question

  • User-362386836 posted

    Experts,

    Having issue while passing the array of parameters in the WEB API service

    public class SampleController : ApiController
    {
       public string Getdetails([FromUri] int[] id) 
      {
        var inconditions = id.Distinct().ToArray();
        using (var dbConn = new OracleConnection("DATA SOURCE=h;PASSWORD=C;PERSIST SECURITY INFO=True;USER ID=T"))
        {
            dbConn.Open();
            var strQuery = "SELECT PRIO_CATEGORY_ID AS PRIO, LANG_ID AS LANG, REC_DATE AS REC, REC_USER AS RECUSER, DESCR, COL_DESCR AS COL, ROW_DESCR AS DROW, ABBR FROM STCD_PRIO_CATEGORY_DESCR WHERE REC_USER  IN (:p)";
            var queryResult = dbConn.Query<SamModel>(strQuery, new { p = inconditions });
            return JsonConvert.SerializeObject(queryResult);
        }
    }

    }

    Now while calling the API as http://localhost:35432/api/Sample?id=1&id=83 it throws an error saying on var queryResult = dbConn.Query(strQuery);

    {"ORA-00907: missing right parenthesis"}

    enter image description here

    checked all the paranthesis and everything looks good

    Friday, July 22, 2016 6:50 PM

Answers

  • User36583972 posted

    Hi vdha,

    Having issue while passing the array of parameters in the WEB API service

    I have made a test on my side. You can receive the correct data while passing the array of parameters in the WEB API service. So, your problem is about your oracle sql query.

    {"ORA-00907: missing right parenthesis"}

    From your error message, maybe you have entered a left parenthesis, but missed the closing right parenthesis; or you entered invalid data within the parentheses. You should make sure all parentheses must be entered in pairs. You must correct the statement and re-execute.

    ORA-00907: missing right parenthesis:

    https://www.tekstream.com/resources/ora-00907-missing-right-parenthesis/

    Best Regards,

    Yohann Lu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 25, 2016 4:42 AM

All replies

  • User-1946294156 posted

    There is not a problem with your asp or C# code syntax, but a problem with your sql syntax for oracle.  The error is being thrown by the Oracle server.  If you can, inspect the actual sql text being sent to the oracle DB.  

    If it still does not look like there is an issue, execute it in a Oracle Database Management tool.  It might give you a better insight into what the error is.

    Saturday, July 23, 2016 7:00 PM
  • User36583972 posted

    Hi vdha,

    Having issue while passing the array of parameters in the WEB API service

    I have made a test on my side. You can receive the correct data while passing the array of parameters in the WEB API service. So, your problem is about your oracle sql query.

    {"ORA-00907: missing right parenthesis"}

    From your error message, maybe you have entered a left parenthesis, but missed the closing right parenthesis; or you entered invalid data within the parentheses. You should make sure all parentheses must be entered in pairs. You must correct the statement and re-execute.

    ORA-00907: missing right parenthesis:

    https://www.tekstream.com/resources/ora-00907-missing-right-parenthesis/

    Best Regards,

    Yohann Lu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 25, 2016 4:42 AM