ibatis/Oracle - SELECT query inside INSERT is failing
Posted
by whoopy_whale
on Stack Overflow
See other posts from Stack Overflow
or by whoopy_whale
Published on 2010-03-18T21:11:02Z
Indexed on
2010/03/18
21:21 UTC
Read the original article
Hit count: 335
Hi,
I'm trying to do an Insert operation using iBatis.
INSERT INTO SCHEMA.TABLE
(FIELD1,
FIELD2,
FIELD3)
VALUES
(#field1#,
(SELECT
ANOTHER_FIELD
FROM
SCHEMA.TABLE
WHERE
FIELD4= #field2#),
#field2#)
The inner select query always fails and returns NULL. But if I substitute #field2# with the actual value only in the inner query, it works fine. Why is iBatis not substituting fieldvalues in the innerqueries?
Any ideas?
© Stack Overflow or respective owner