Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Variable in SQL insert statement

I defined a variable with 'FileName' and assigned a value to it.
No I am trying to use this variable in the INSERT INTO statement.

cursor.execute("INSERT INTO etlbatch (source) VALUES ('FileName')")

When I try to run the above as a Jython Script it is inserting FileName into the column instead of the Value in the variable(FileName). Can you please help me with this.

Regards,

Pallavi


1 Community Answers

Matillion Agent  

Damian Chan —

Hello Pallavi,

If it’s a local variable that you’re referring to then you can do the following:

cursor.execute(‘INSERT INTO etlbatch (source) VALUES (${FileName})’)

I hope this helps.

Best Regards,
Damian

Post Your Community Answer

To add an answer please login