【发布时间】:2010-07-08 14:50:51
【问题描述】:
我可以通过在 select 语句的 where 子句中使用带有变量原始值的 select into 来更改变量的值吗?
EI 是否会按预期运行以下代码:
declare
v_id number;
v_table number; --set elsewhere in code to either 1 or 2
begin
select id into v_id from table_1 where name = 'John Smith';
if(v_table = 2) then
select id into v_id from table_2 where fk_id = v_id;
end if;
end;
【问题讨论】:
-
...有趣的想法。我没试过,但我不明白为什么不。 有你尝试过吗?会发生什么?
-
我确实尝试过,它似乎有效。我主要在寻找知道它会总是工作的人。我不能让它只在某些(未知)情况下工作。