YouXiang-Wang
YouXiang-Wang

Reputation: 1127

How to interpolate whole SQL query in Slick

In slick, I could

sql"""SELECT C1 FROM T1""".as[Int].head

But I could not use a variable in the SQL

val ss = "SELECT C1 FROM T1"
sql"""${ss}""".as[Int].head

Is there some solution for this?

Upvotes: 2

Views: 398

Answers (1)

justAbit
justAbit

Reputation: 4256

Use of #$ for splicing literal values can be useful in this scenario. Check Splicing Literal Values for more info.

Upvotes: 3

Related Questions