【发布时间】:2022-06-23 01:07:12
【问题描述】:
我要执行这条语句
if (select object_type from user_objects where object_name = 'xxx')='PROGRAM' then .......
但问题是我不能在不使用变量的情况下做出这样的声明:
select object_type into ala from user_objects where object_name = 'xxx';
if ala !='PROGRAM' then ...
您知道如何在不使用带变量的 INTO 的情况下执行第一条语句吗?
谢谢!
【问题讨论】:
-
Postgres 还是 Oracle?这有很大的不同。但是你也不能在 SQL 中使用
IF,只能在 PL/SQL 或 PL/pgSQL 中使用
标签: sql database postgresql oracle if-statement