Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 484
  • Last Modified:

ora-01722 when using the ODP OracleDataAdapter to update a DataTable

I'm trying to lookup the referential keys in the insert sql (OracleDataAdapter.InsertCommand.CommandText) =

"INSERT INTO CARDS (CARDS.RTU_ID, CARDS.CARD_TYP_ID, CARDS.RACK_NO, CARDS.SLOT_NO) VALUES ((SELECT RTUS.RTU_ID FROM RTUS WHERE RTUS.RTU_CD = :col0), (SELECT CARD_TYPES.CARD_TYP_ID FROM CARD_TYPES WHERE CARD_TYPES.CARD_TYP_CD = :col3), :col1, :col2)"

and keep getting "ora-01722 invalid number".

The bizarre thing is that this works:

"INSERT INTO CARDS (CARDS.RTU_ID, CARDS.CARD_TYP_ID, CARDS.RACK_NO, CARDS.SLOT_NO) VALUES ('1', '1', :col1, :col2)"

and so does this:

"INSERT INTO CARDS (CARDS.RTU_ID, CARDS.CARD_TYP_ID, CARDS.RACK_NO, CARDS.SLOT_NO) VALUES ((SELECT RTUS.RTU_ID FROM RTUS WHERE RTUS.RTU_CD = :col0), (SELECT CARD_TYPES.CARD_TYP_ID FROM CARD_TYPES WHERE CARD_TYPES.CARD_TYP_CD = :col3), '1', '1')"


Any help is appreciated!
0
Troy_Lyne
Asked:
Troy_Lyne
1 Solution

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now