我已与SQL Server以前工作,并能学习如何创建临时变量,在SQL声明Oracle数据库临时变量
使用它们我以前写的东西是这样的:
declare @Student nvarchar(255)
select @Student = studentname from sometable where somecondition = 1
declare @teacher nvarchar(255)
select @teacher = teachername from sometable2 where somecondition >2
然后
select @student, @teacher, other columns from sometable where some condition
我想在ORACLE数据库中做同样的事情。
请帮忙!
sqlplus具有使用“define”关键字和“&”作为替换的变量(请参阅http://docs.oracle.com/cd/B19306_01/server.102/b14357/ch5.htm#sthref1020) – tbone