Vbscript passing parameter to SQL statement

I have a vbscript that connects to an Oracle Database to retrieve information.  Part of the conditional statement is to subtract a number from the current date.  I currently have this hard-coded as 1 but want it to be a parameter.  

Code is :-

firstSQL = "SELECT txrefnbr||','||msgtype||','||createdate||','||supplierid||','||senderid||','|| " _
           & "receiverid||','||direction||','||messagesource||','||tdoemmachk||','||ackfromtdoemma||','|| " _
           & "responsetotdoemma||','||ackfromstsemma||','||responsetostsemma||','||stsemmachk||','|| " _
           & "messagedest||','||reconciled " _
           & "FROM mm_reconcile " _
           & "WHERE RTRIM(receiverid) = 'NIE' " _
           & "AND reconciled IN ('N', 'F') " _
           & "AND createdate < sysdate - 1 "

For the last line instead of saying sysdate -1 I want to have it as sysdate - &x.

Any suggestions as to how I do this ?

Thanks in advance

Who is Participating?
Jinesh KamdarConnect With a Mentor Commented:
Something like this - & "AND createdate < sysdate - " & x_no_of_days
HRMortonAuthor Commented:

So I don't have to pass the parameter, as long as it's defined in the body of my vbscript I
can use it in the SQL ?

Jinesh KamdarCommented:
Yes, assuming that x_no_of_days is a number-type of variable.
HRMortonAuthor Commented:
Very quick response and worked perfectly
Jinesh KamdarCommented:
Glad to be of help :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.