从示例查询 (Oracle APEX) 中获得 "ORA-01008: not all variables bound"

Got "ORA-01008: not all variables bound" from a sample query (Oracle APEX)

我在 APEX 中输入了以下内容

INSERT INTO hr.departments 
       (department_id, department_name, location_id)
VALUES     (&department_id, '&department_name',&location);

那是来自幻灯片。我收到以下错误:

ORA-01008: not all variables bound

有人可以解释一下为什么会出现这个错误吗?非常感谢您的帮助!

如果您只是从示例中复制和粘贴并试图将其复制到 运行,看起来中间变量是一个实际的字符串(包含在引号中)。您是否至少不想确保所有 VALUES 都是一种方式(所有变量或所有字符串)?

正确的 PL/SQL 语法如下所示:

INSERT INTO hr.departments 
       (department_id, department_name, location_id)
VALUES     (:P_DEPARTMENT_ID, :P_DEPARTMENT_NAME, :P_LOCATION);

其中 :P_DEPARTMENT_ID:P_DEPARTMENT_NAME:P_LOCATION 是页面项或应用程序项的名称。