CASE WHEN...INTO - 存储过程
有什么方法可以做 CASE WHEN INTO 语句吗?
Create or replace procedure example
AS
Variable1 varchar;
Variable2 varchar;
BEGIN
Select (CASE WHEN number = 1 THEN
This_thing INTO Variable1
ELSE
That_thing INTO Variable2) The_Other
FROM table;
END;
is there any way to do a CASE WHEN INTO Statement?
Create or replace procedure example
AS
Variable1 varchar;
Variable2 varchar;
BEGIN
Select (CASE WHEN number = 1 THEN
This_thing INTO Variable1
ELSE
That_thing INTO Variable2) The_Other
FROM table;
END;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们无法从单个 CASE() 语句中获得两个输出。您能实现的最好结果是进行两个具有互斥条件的单独调用:
We cannot get two outputs from a single CASE() statement. The best you can achieve is having two separate calls with mutually exclusive conditions:
不,但你可以这样做:
No, but you can so: