有一个函数: funtion_num_word(f_num NUMBER,f_word WORD)
有如下表 a 表
id name num
1 张三 75
2 李四 45
. . .
. . .
. . .
. . .
. . .
. . . b 表
id word age
1 ABC 25
2 EFG 40
. . .
. . .
. . .
. . .
. . .
. . .
a表中的找到数据name的第一个字为‘张’ 找到b表中id字段和它相同的数据,如果这个数据的age大于30
那么就把a表中的num 传递给f_num参数 把b表中对应的word 传递给f_word参数使用一条select语句完成函数的引用,可以吗?
有如下表 a 表
id name num
1 张三 75
2 李四 45
. . .
. . .
. . .
. . .
. . .
. . . b 表
id word age
1 ABC 25
2 EFG 40
. . .
. . .
. . .
. . .
. . .
. . .
a表中的找到数据name的第一个字为‘张’ 找到b表中id字段和它相同的数据,如果这个数据的age大于30
那么就把a表中的num 传递给f_num参数 把b表中对应的word 传递给f_word参数使用一条select语句完成函数的引用,可以吗?
select funtion_num_word(a.num,b.WORD)
from a,b
where substr(a.name,1,1)='张' and a.id=b.id and b.age>30
from (select a.num,b.word,nvl(age,0)
from a,b
where a.id=b.id(+)
and a.name like '张%'
and a.rownum=1) c
where c.age>30
select c.num,c.word
from (select a.num,b.word,nvl(age,0)
from a,b
where a.id=b.id(+)
and a.name like '张%') c
where c.age>30
试试吧:
select funtion_num_word(a.num,b.WORD)
from a,b
where a.name like='张%' and a.id=b.id and b.age>30
from a,b
where a.name like '张%' and a.id=b.id and b.age>30上面的写错了,试试这个吧