I am trying to do a insert that copies rows from an existing user. 
Essentially cloning a user, but change userid for the new record.

Here is the syntax:
    @Insert("insert into USER (USERID, USERNAME, PASSWORD, SERVER_GROUP) " +
            "select #{trgUserId,javaType=int,jdbcType=INTEGER}, USERNAME,
PASSWORD, SERVER_GROUP " +
            "from USER where USERID =
#{srcUserId,javaType=int,jdbcType=INTEGER}")
    void cloneUser(final int trgUserId, final int srcUserId);

When I try this syntax, I get the following error back:

org.apache.ibatis.exceptions.IbatisException: 
### Error updating database.  Cause: java.sql.SQLException: ORA-00903:
invalid table name

### The error may involve testibatis3.UserMapper.cloneUser-Inline
### The error occurred while setting parameters
### Cause: java.sql.SQLException: ORA-00903: invalid table name

        at
org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8)
        at
org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:100)
        at
org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:87)
        at
org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:54)
        at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:35)

Any ideas as to what would cause an "Invalid table name"?  The USERS table
exists and I have verified the SQL statement in SQLPLUS.
-- 
View this message in context: 
http://old.nabble.com/ibatis-3.0---%40Insert-with-Insert-select-fails-tp27857358p27857358.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org

Reply via email to