日期:2014-05-17  浏览次数:20887 次

orcale怎么在查询语句里面定义变量
我想在写查询语句的时候,将条件赋给变量,不知道怎么写,
SQL的话,比如:
declare @temp varchar(20) 
set @temp='SRT13000007'
select * from  einvgtfhd where efhno=@temp
但我不知道orcale怎么写

------解决方案--------------------
declare temp varchar(20);
begin 
temp:='SRT13000007';
//--select *  from  einvgtfhd where efhno=temp;
ORACLE不支持这种查询,这样的查询必需有游标。
end;

------解决方案--------------------
hr@ORCL> var v_tt number
hr@ORCL> select * from employees where employee_id=&v_tt;