Oracle PL-SQL 中定义不明确的列
我试图在不同的表上选择多行,但无论我做什么都无法让它工作。 我收到此错误:
Error(14,1): PL/SQL: ORA-00918: column ambiguously defined
代码(注意,这是触发器的一部分,这就是为什么有 :new
):
SELECT brw.borage, bt.agelower, bt.ageupper
INTO borAge, minAge, maxAge
FROM Borrower brw, BookTitle bt
INNER JOIN BookCopy bc ON :new.bcID = bc.bcID
INNER JOIN BookTitle bt ON bt.isbn = bc.isbn
注意:BookTitle 只有一个ageLower 和ageUpper 列。除了 borAge、minAge 和 maxAge 之外,也没有其他减法。
I'm trying to select multiple rows over different tables but I can't get it to work whatever I do.
I get this error:
Error(14,1): PL/SQL: ORA-00918: column ambiguously defined
Code (Note, this is part of a trigger, that's why there's the :new
):
SELECT brw.borage, bt.agelower, bt.ageupper
INTO borAge, minAge, maxAge
FROM Borrower brw, BookTitle bt
INNER JOIN BookCopy bc ON :new.bcID = bc.bcID
INNER JOIN BookTitle bt ON bt.isbn = bc.isbn
NOTE: BookTitle has only ONE ageLower and ageUpper column. There's no declerations apart from borAge, minAge and maxAge either.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题是你有两次相同的别名,试试这个:
但这可以给你比预期更多的结果,因为你把 BookTitle 表放在 FROM 部分。
我认为只有这可能才是您真正需要的:
Tre problem is that you have two times the sames alias, try this:
but this can give you more results then expected, because you put BookTitle table on the FROM part.
I think that only this might be what you really need:
您定义 BookTitle bt 两次。
You define BookTitle bt twice.