简体   繁体   English

Oracle 10g中的SQL

[英]SQL in Oracle 10g

insert into BOOK values(&bid, '&title', '&pub', &year);

I am getting an error when I run the query in oracle 10g, this is the error message i am getting: 在oracle 10g中运行查询时出现错误,这是我收到的错误消息:

ORA-01008: not all variables bound ORA-01008:并非所有变量都已绑定

By default, SQL Plus treats '&' as a special character that begins a substitution string. 默认情况下,SQL Plus将'&'视为以替换字符串开头的特殊字符。 So when you run this query oracle will consider bid, title, pub, year as bind variables and prompt you to enter the values for these variables. 因此,当您运行此查询时,oracle将把bid,title,pub,year作为绑定变量,并提示您输入这些变量的值。 Enter the values for them it will replace the values and inserts the record into the database. 输入它们的值,它将替换这些值,并将记录插入数据库中。

If you want to turn of the default behavior you can use the following command 如果要转为默认行为,可以使用以下命令

SQL> set define off 

Once you want to turn on the default behavior use this command 要打开默认行为后,请使用此命令

SQL> set define on

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM