我是 sql 新手,我无法弄清楚如何在我们使用带有 pl/sql 变量的别名的地方使用连接。这类似于我的匿名块的样子
DECLARE
l_count PLS_INTEGER;
l_name EmpTable.Name%Type;
BEGIN
FOR l_row In (
Select *
From User_Tab_Columns
Where Table_Name = 'EmpTable')
Loop
l_name := l_row.Name;
Select Count(A.l_name)
INTO l_count
FROM EmpTable A
INNER JOIN CustTable B on A.id = B.emp_id;
DBMS_OUTPUT ("The number of employees who are also customers are " || l_count);
END LOOP;
END;
我收到错误,因为必须声明“l_name”和“A”。“l_name”标识符无效。流程对我来说非常有意义。我应该知道一些细微差别吗?