SQL Passing Parameters execute query

Could someone clarify how the passing of parameters in execute query works? I understand that you can call the parameters using “?” however you have to keep your parameters in the correct order. I have tried the “@” symbol as well.

Here is an example:

“SELECT a.col1, a.col2
FROM table a
WHERE a.col3 = @acctName

Parameter:
Name: acctName
Direction: In
Type: String
Value: someString

where someSting = “String”

However, I either get back errors when I do this @acctName, or an empty table if I do this ‘@acctName

Hi,

  1. Hope you have used EXECUTE QUERY and not EXECUTE NON-QUERY activity, then the below query would return a data table as output.
    “select a.L_Name, a.F_Name from Employees_data a WHERE a.Id = @Id

  2. use the for each row to iterate through the table.

The above query i tried and worked for me .
let me know if that worked

Hey @ashley11 ,

I tried that method of running the query, but unfortunately it was not successful. The details of that were explained above. The error referenced is an ORA-00936 missing expression error.

hi,
I could find these links which might be of help to you
https://www.tekstream.com/oracle-error-messages/ora-00936-missing-expression/

hope this would help you

@ashley11
I have read through these, but am not seeing a correlation. Do you see anything in the code referenced above that you think could be causing this issue?

what i feel after going through those links is the query requires proper formatting try this once

“SELECT a.col1, a.col2”+System.Environment.NewLine+“FROM table a”+System.Environment.NewLine+“WHERE a.col3 = @acctName” instead of

“SELECT a.col1, a.col2
FROM table a
WHERE a.col3 = @acctName

@ashley11
The goal is to not have to re-write the code to make it one solid string, but instead to be able to call the parameter in the current code.

I tried the above suggestion, and it also appears to not be working.

Where you able to solve this issue. I too am facing a similr issue.
If I pass hard coded values in my filtering condition, the execute query activity provides expected number of rows in return. But if I pass the same filtering conditions through parameters, the execute query activity provides zero rows. Not sure where the issue is.

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

What I ended up doing was adding the parameters in order that they appear in the code, and for every parameter in the code I replaced with a ?