I can't seem to declare variables within a pl/sql function?
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 som开发者_运维技巧e reason it doesn't work.
Many thanks, Fugu
Did not found anything wrong with your declared variable:
create or replace FUNCTION some_function
(
t_string IN VARCHAR2
) RETURN NUMBER
IS
some_variable NUMBER;
BEGIN
return some_variable;
END some_function;
Returned NULL as expected:
select some_function('ff') from dual
The problem is that you don't have the CREATE OR REPLACE keywords in your function declaration, as shown in @Michael's answer.
精彩评论