收到与“SELECT INTO”相关的未指定错误;
收到错误信息: 第 6 行出现错误:PL/SQL:忽略 SQL 语句 0.03 秒
没有与数据库本身的创建、涉及的表或任何插入语句相关的错误。
任何建议表示赞赏。
CREATE OR REPLACE FUNCTION Function1(NumberOfBugs NUMBER, TotalIncome FLOAT)
RETURN FLOAT
IS PricePerBug FLOAT;
BEGIN
SELECT INTO TotalIncome SUM(ProjectValue) FROM tblProject;
SELECT INTO NumberOfBugs COUNT(idBug) FROM tblBug;
PricePerBug := (NumberOfBugs)/(TotalIncome);
RETURN PricePerBug;
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('No data found, no result to display; exception handled...');
WHEN TOO_MANY_ROWS THEN
RETURN 'Too many rows returned...';
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20015, 'Unknown exception in function Function1.');
RETURN PricePerBug;
END Function1;
/
Receiving the error message:
ERROR at line 6: PL/SQL: SQL Statement ignored 0.03 seconds
There are no errors relating to the creation of the database itself, the tables involved or any of the insert statements.
Any suggestions appreciated.
CREATE OR REPLACE FUNCTION Function1(NumberOfBugs NUMBER, TotalIncome FLOAT)
RETURN FLOAT
IS PricePerBug FLOAT;
BEGIN
SELECT INTO TotalIncome SUM(ProjectValue) FROM tblProject;
SELECT INTO NumberOfBugs COUNT(idBug) FROM tblBug;
PricePerBug := (NumberOfBugs)/(TotalIncome);
RETURN PricePerBug;
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('No data found, no result to display; exception handled...');
WHEN TOO_MANY_ROWS THEN
RETURN 'Too many rows returned...';
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20015, 'Unknown exception in function Function1.');
RETURN PricePerBug;
END Function1;
/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 Select Into 语句,例如:
您遵循此语法吗?请核实
Use Select Into statement like :
Are you following this syntax ? Please verify