Oracle过程错误(PLS

编程入门 行业动态 更新时间:2024-10-18 14:26:14
Oracle过程错误(PLS-00428)(Oracle Procedure error (PLS-00428))

这是错误消息: PLS-00428: an INTO clause is expected in this SELECT statement. 同时,这是测试显示系统日期的过程:

CREATE OR REPLACE PROCEDURE "TEST_PROCEDURE" AS BEGIN SELECT SYSDATE FROM DUAL; END;

首先,我不需要使用INTO Oracle坚持让我这样做。 还有其他方法使用光标(我在这里看到它https://stackoverflow.com/a/6029963/1983024 )? 我认为它不应该是这样,它确实正常运行,就像在MS SQL中不使用INTO或游标一样。

This is the error message: PLS-00428: an INTO clause is expected in this SELECT statement. Meanwhile, this is the procedure for testing displaying the system date:

CREATE OR REPLACE PROCEDURE "TEST_PROCEDURE" AS BEGIN SELECT SYSDATE FROM DUAL; END;

In the first place I don't need to use that INTO Oracle is insisting for me to do. Is there other way around beside using a cursor (I've seen it here https://stackoverflow.com/a/6029963/1983024)? I think it should not be like that, this does run normally just like in MS SQL without using INTO or cursor.

最满意答案

首先,我不需要使用INTO Oracle坚持让我这样做。

事实是,Oracle是正确的:您确实需要使用INTO来获取返回值。

毕竟,如果要显示查询结果,您将需要一个变量将其放在第一位。

Finally found a solution to the output I want (based on your responses) :D

CREATE OR REPLACE PROCEDURE "TEST_PROCEDURE" RET_DATE CHAR(10); BEGIN SELECT TO_CHAR(SYSDATE, 'MM/DD/YYYY') INTO RET_DATE FROM DUAL; DBMS_OUTPUT.PUT_LINE(RET_DATE); END;

This displays the SYSDATE with format of MM/DD/YYYY. Still, thanks for the replies and ideas (mostly @Jeffrey Kemp). Oracle just lengthens what MS SQL can normally do in one line :D

更多推荐

本文发布于:2023-07-23 02:33:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1226489.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   过程   Oracle   PLS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!