将列值作为参数传递给sql

时间:2013-09-25 17:37:08

标签: sql

假设我有一个包含两列的表customerDemandcustomer_iddemand

现在我有一个函数fnMapCustToBucket,它接受​​customer_id并将其映射到测试桶

我想编写一个查询,其中返回一个表格:bucketcustomer_iddemand

我正在尝试:

select
    customer_id id,
    demand d,
    db.fnMapCustToBucket(id) 
from
    customerDemand

这不起作用,因为函数调用点id似乎未定义。这里的帮助将非常感激。谢谢!

1 个答案:

答案 0 :(得分:1)

尝试:

select customer_id id, demand d,
db.fnMapCustToBucket(customer_id)
from customerDemand