I am trying to make SQL with variable.
var PLid = '02101';
var connection = new Packages.SQLConnection("oracle");
connection.connect("server", port ,"SID", "test", "test");
var result = connection.getResults("select policy_no from policy where product_id = '"PLid"');
connection.disconnect();
I am getting the following error:
missing ) after argument list (Script=script_2;Line=4)
If I rewrite what i found on the internet:
var result = connection.getResults("select policy_no from policy where product_id = '?'",1);
Can't find method SQLConnection.getResults(string,number). (Script=script_2;Line=4)
I am trying to implement this code in Neoload.
To concatenate strings in JavaScript you need
+
. Change the fourth line to this:If
PLid
can be set as an integer (var PLid = 2101;
), you can skip the single quotation marks, like this: