We have a database setup where we have a separate user for owners and users of database tables in an Oracle database. This means that in practice each query is prefixed like this: ownername.tablename
This works just fine if I just write the whole thing statically in Slick's SQLInterpolation.sql function:
(sql"select foo_owner.foo_sequence.nextval from dual").as[Long].first()
The problem is, that the owner prefix changes depending on test/prod. environment. What I'd like to do is this:
(sql"select $owner.foo_sequence.nextval from dual").as[Long].first()
But SQL interpolation doesn't work with it. I get this error Oracle:
An exception or error caused a run to abort: ORA-22806: not an object or REF
Any suggestions? I can of course fall back to the more verbose StaticQuery, but using sql/sqlu interpolation would be much more compact.