0

VARCHAR2 和 (4) 之间的错误似乎是语法错误。

创建或替换

    FUNCTION Employee_exists
        (p_employee_id IN NUMBER)
    RETURN VARCHAR2(4);

    AS
    BEGIN
        SELECT employee_id
        FROM employees
        WHERE employee_id = p_employee_id;
        RETURN 'true';
    END Employee_exists;
4

2 回答 2

3

实际上有两个错误:

  1. 您不能在函数或过程规范中指定返回类型的长度
  2. ;是一个语句终止符,因此它在返回类型和AS

你的第一行应该是:

FUNCTION employee_exists
        (p_employee_id IN NUMBER)
    RETURN VARCHAR2 AS
于 2013-10-01T15:04:15.457 回答
0
    create or replace function test_fun(id in number)
    return long
    as
    disp_price long;
    Begin
    select price into disp_price from orders
    where id=2;
    return disp_price;
    end test_fun;

-----------------------------------------------------------
OUTPUT
-----------------------------------------------------------
declare
m_price long;
begin
m_price:=test_fun(1);
end;
于 2013-11-12T06:14:30.487 回答