Skip to Content
Former Member
Aug 16, 2005 at 11:18 AM

Passing tablename as variable in SQLJ


Hi all,

I've developed an application in WebDynpro using SQLJ.This application accesses my MAXDB database.When I write a normal query in SQLJ for e.g

INSERT into TMP_EMPLOYEE(EMPID,EMPNAME,DEPT) values (:empid,:empname,:dept)

(empid,empname,dept are variables) there is no problem.

What I want to do is replace the table name by a variable which contains the tablename.I tried the following query

INSERT into :tablename (EMPID,EMPNAME,DEPT) values (:empid,:empname,:dept)

But it gave me syntax error

<b>SQLJ: SQL syntax error: the token "?" was not expected here</b>

Has anybody tried this?