Zum Hauptinhalt gehen

SQL Statement IN Condition Oracle

Kommentare

3 Kommentare

  • Permanently deleted user
    Cody,

     

    That activity does not support SQL 'IN' clauses, and the Product won't change. The same request came in long ago too.

     

     Here is the comment from the Product developer for the same kind of request

     

    "An activity like this that accepts a string argument that is then inserted directly into a non-parameterized SQL statement would open us SQL injection attacks. That is why we opted to have the SQL activities use a property for the command.

     

    While the above code is perfectly well written... this type of activity is extremely risky. We should not recommend this to customers unless they sanitize the SQL statement or ensure that the statement does not contain any user supplied values."

     

    However, you can implement another way though.

     

    Refer the followings:

     

    1. https://www.codeproject.com/Tips/584680/Using-comma-separated-value-parameter-strings-in-S

     

    2. https://stackoverflow.com/questions/5401641/passing-a-sql-parameter-to-an-in-clause-using-typed-datasets-in-net

     

    3. https://blogs.oracle.com/aramamoo/how-to-split-comma-separated-string-and-pass-to-in-clause-of-select-statement
    0
  • Permanently deleted user
    Hi Munhwan-

     

    Thank you for the reply. I will run through the examples you sent and see how to adjust my string to fit those parameters. Thanks again for the resources!
    0
  • Permanently deleted user
    I ended up creating an Assign activity and making my query_string = "OBJECTID in ("+string.Join(") OR OBJECTID in (",listOIDs)+")"

     

    Where listOIDs is my list of ObjectIDs returned from the sql query. It's not the cleanest or most efficient query, but it works without issues while returning more than 1000 records.
    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.