【发布时间】:2015-11-20 15:11:13
【问题描述】:
我正在编写一个 sql 脚本,我应该问一个问题,然后继续取决于用户的输入。
我试过这个:
prompt script started
accept partitioning prompt "Do you want to partition the table? (Y/N):"
if ($partitioning=Y)
prompt ok, it will be partitioned
else
prompt ok, it won't be partitioned
end;
但我明白了
ORA-00900 异常,这里不允许使用 if 语句。
有没有办法在单个 sql 脚本中使用 if-then-else?如果可能,请给我一个例子。
【问题讨论】:
-
您使用的是哪个 SQL 客户端?
-
oracle,我编辑了问题,对不起
-
我认为您将 sqlplus 与 SQL 混淆了。但是你可以试试这个 - itbh.at/simulating-control-flow-statements-in-sqlplus/?lang=en
-
Oracle 是 DBMS,而不是 SQL 客户端。
标签: oracle prompt sql-scripts