运行 sql*plus 脚本时出错

发布于 2024-08-11 16:26:52 字数 164 浏览 3 评论 0原文

我有一个脚本,它只需连接到 sql*plus 中的表并在表中插入一行。

它抛出如下错误:

SP2-0552: Bind variable "BIND" not declared

我无法准确弄清楚它试图插入的查询中的绑定变量是什么。

i have a script which simply connect to the table in sql*plus and inserts a row in the table.

it is throwing an error as below:

SP2-0552: Bind variable "BIND" not declared

i am not able to figure out exactly what the bind variable is in the query that it is trying to insert.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

囚我心虐我身 2024-08-18 16:26:52

您正在尝试运行这样的 sql:

SELECT 1 FROM DUAL WHERE :BIND = 1;

SQL*Plus 将 :BIND 标识为绑定变量,但您尚未在会话中声明该变量。要声明绑定变量,请使用 VAR(IABLE) 命令。

VAR BIND NUMBER

然后,您可以为该变量赋值。

EXEC :BIND := 1

再次运行 select 以确认绑定变量现已设置。请注意,您还可以使用此变量来保存单行查询的结果。

SELECT 1 INTO :BIND FROM DUAL;

You are trying to run a sql like this:

SELECT 1 FROM DUAL WHERE :BIND = 1;

SQL*Plus identifies :BIND as a bind variable, but you haven't declared one in your session yet. To declare the bind variable use the VAR(IABLE) command.

VAR BIND NUMBER

Then, you can assign a value to the variable.

EXEC :BIND := 1

Run the select again to confirm that the bind variable is now set. Note that you can also use this variable to hold results from single-row queries.

SELECT 1 INTO :BIND FROM DUAL;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文