Missing IN or OUT parameter at index:: 1 error in Java, Oracle

不羁的心 提交于 2019-12-05 04:31:39

The "Missing IN or OUT parameter" in the error message is for the ? in the query:

SELECT TITLE FROM BOOK AND BORROWER WHERE ISBN=?

You didn't supply a value for it. Try like this:

BookidPs = con.prepareStatement("SELECT TITLE FROM BOOK AND BORROWER WHERE ISBN=?");
BookidPs.setString(1, theIsbn);

The query needs an ISBN parameter, but I don't see where you have such variable in your code. To use this query, you need to provide the missing parameter. In fact, it seems this second query is not useful for you at all. Given the code, I don't see why you want to use this query instead of getting the value from rs.

But actually, even with that parameter filled, the query is invalid SQL.

I think you probably want just one query, a JOIN. Your second query seems to try to select the TITLE from the BOOK table. So maybe you want this query, without parameters:

SELECT * FROM BORROWER JOIN BOOK ON BORROWER.BOOKID = BOOK.BOOKID
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!