原sql语句select a1.name,a1.age from a1 where a1.id='123456'
union all
select b1.name,b1.age from b1 where b1.id='123456'
union all
select c1.name,c1.age from c1 where c1.id='123456'
需要的sql语句
怎样定义一下 userid='123456'select a1.name,a1.age from a1 where a1.id=userid
union all
select b1.name,b1.age from b1 where b1.id=userid
union all
select c1.name,c1.age from c1 where c1.id=userid怎么定义一个变量???
union all
select b1.name,b1.age from b1 where b1.id='123456'
union all
select c1.name,c1.age from c1 where c1.id='123456'
需要的sql语句
怎样定义一下 userid='123456'select a1.name,a1.age from a1 where a1.id=userid
union all
select b1.name,b1.age from b1 where b1.id=userid
union all
select c1.name,c1.age from c1 where c1.id=userid怎么定义一个变量???
解决方案 »
- 急~字符型转化成数值型,提示 无效数字
- Oracle 的查询?
- 关于.net中oracle数据库连接关闭后会话还未结束
- 请问各位大侠,Oracle 9i数据库命名如何能超过8个字符?在线等,急急急
- 在PL/SQL中能否通过序号对游标中的列进行读取?还是只能通过列名来进行读取?
- 我装了Oracle 9i 一启动就内存就使用800多M!!!天...
- ORACLE中的过程在VB中如何调用?
- oracle 怎样实现每2小时分组对数据统计
- 请教一个sqlldr导入数据文件数据CTL问题
- kettle数据批量抽取问题
- 游标与update问题~在线等
- 对一个存过中Exception、gather_table_stats及索引的疑问
var uerid number
exec :userid:=123456;select a1.name,a1.age from a1 where a1.id=:userid
union all
select b1.name,b1.age from b1 where b1.id=:userid
union all
select c1.name,c1.age from c1 where c1.id=:userid
userid := 123456;
begin
以下就是你的查询语句……
end;
union all
select b1.name,b1.age from b1 where b1.id=&&userid
union all
select c1.name,c1.age from c1 where c1.id=&&userid运行时会需要输入'&'打头的值,而后面两个‘&&’打头的就可以接受第一个变量的值而不需要重复输入。
from (select a1.id, a1.name, a1.age
from a1
union all
select b1.id, b1.name, b1.age
from b1
union all
select c1.id, c1.name, c1.age from c1)
where id = &userid;
不然这个替代变量能使用?而且刚好写反了吧,应该先两个&&,然后在一个&&使用绑定变量就可以了啊,plsql中使用3#那样的写法,jdbc中使用?