我似乎无法在 pl/sql 函数中声明变量?
这是一个非常简单的问题,但我似乎无法在任何地方找到它的语法。
我有这样的事情:
FUNCTION some_function
(
t_string IN VARCHAR2
) RETURN NUMBER IS
some_variable NUMBER;
BEGIN
//logic
END some_function;
它击中了 some_variable 声明并告诉我它正在期待“语言”我在哪里/如何声明变量?我见过这样的例子,但由于某种原因它不起作用。
非常感谢, 河豚
This is a really simple question, but I can't seem to find the syntax for this anywhere.
I have something like this:
FUNCTION some_function
(
t_string IN VARCHAR2
) RETURN NUMBER IS
some_variable NUMBER;
BEGIN
//logic
END some_function;
It hits the some_variable declaration and tells me it was expecting "language" where/how do I declare variables? I've seen examples which have done it this way but for some reason it doesn't work.
Many thanks,
Fugu
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
没有发现您声明的变量有任何问题:
按预期返回 NULL:
Did not found anything wrong with your declared variable:
Returned NULL as expected:
问题是您的函数声明中没有 CREATE OR REPLACE 关键字,如 @Michael 的答案所示。
The problem is that you don't have the CREATE OR REPLACE keywords in your function declaration, as shown in @Michael's answer.