Forum Discussion

Max's avatar
Max
New Contributor
16 years ago

SQL exception "invalid table name"

I'm working with Groovy scripts and soapUI Pro. I have a Groovy script that connect to db and retrieving data to validate.
I get a SQL exception "invalid table name" when in my sql statement the db schema is parametrazed '${schema}.table_name'.
if I hard-code db schema value 'dbschema.table_name' it succeeds.
There seems to be a problem interpreting variables when building a SQL string.

Here is my script.

def schema = context.expand( '${#Project#schema}' )
def query = "SELECT user_name FROM ${schema}.account_customer WHERE email = 'myemail@test.com'";

Please tell me what I am doing wrong.

Thanks