oracle 多表查询有关问题

oracle 多表查询问题
 表 A 
列 : bbid ,bbjc

表B 
列: bbid , zdmc 

如何查询出 bbjc 和 zdmc 列 
自己写的sql语句 错误:
sql="select A.bbjc, B.zdmc from employee A,dept B where A.bbid=B.bbid and A.bbid ="+id;

后面的sql语句 对不对?
就是: A.bbid ="+id; 
/* id为 令个页面传过来的 */


------最佳解决方案--------------------
应该没什么问题,是不是你的参数id传的值有问题阿
还有错误信息是什么俄
这是我这里运行的例子:
with tab as(
select 1 id, 'a' name1 from dual
),
tab2 as (select 1 id , 'b' name2 from dual)
select A.name1, B.name2 from tab A, tab2 B where A.id=B.id and A.id=1
---------------------------
name1   name2
a              b
--ps:sql绝对没有问题

------其他解决方案--------------------
你的参数ID是什么类型,
注意拼接sql的时候,你这里应该会有类型强制转换,会不会是这里出的问题呢?
------其他解决方案--------------------
引用:
SQL code
应该没什么问题,是不是你的参数id传的值有问题阿
还有错误信息是什么俄
这是我这里运行的例子:
with tab as(
select 1 id, 'a' name1 from dual
),
tab2 as (select 1 id , 'b' name2 from dual)
select A.name1, B.name2 from tab A, tab2 B……

就是说sql语句有错误 。。。
------其他解决方案--------------------
在你的表中bbid是什么类型?如果是数字,那么你的SQL应当是没问题的。
如果是字符那么就需要使用下面的SQL,把ID的两则加上单引号

sql="select A.bbjc, B.zdmc from employee A,dept B where A.bbid=B.bbid and A.bbid ='"+id+"'";