我正在使用Oracle SQL developer。我正在对employees表运行一个查询,默认情况下,该表包含first_name、last_name、employee_id、email、phone_no、hire_date、job_id、工资、commission_pct、manager_id、department_id等列。
我正在编写一份报告,该报告显示员工的姓氏和薪资,这些员工的收入超过用户在提示符后指定的金额。如果输入12000,则应显示所有收入超过12000的员工。Salary_value: 12000。
我的报告是这样的
select last_name, salary
from employees
where employees.salary>&sal;但我遇到了这样的错误
ORA-01008: not all variables bound
01008. 00000 - "not all variables bound"
*Cause:
*Action:
Vendor code 1008很明显,原因部分没有任何内容。我需要帮助。提前谢谢。
但是,我可以成功地从Sql命令行实用程序中运行它,也可以作为一个*.sql文件运行它。但在报告的情况下,这是行不通的。为什么会发生这种情况?
发布于 2019-04-14 14:31:02
也许您已经将define设置为off。
set define off
select last_name, salary from employees where employees.salary>&sal;
Error starting at line : 2 in command -
select last_name, salary from employees where employees.salary>&sal
Error at Command Line : 2 Column : 31
Error report -
SQL Error: ORA-01008: not all variables bound
01008. 00000 - "not all variables bound"
*Cause:
*Action:将其设置为on (顺便说一下,它是默认值):
set define on
select last_name, salary from employees where employees.salary>&sal;将define设置为on后,SQL将提示为变量&sal输入一个值。
https://dba.stackexchange.com/questions/234761
复制相似问题