Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在oracle sql脚本中创建if-then-else语句?_Oracle_Prompt_Sql Scripts - Fatal编程技术网

如何在oracle sql脚本中创建if-then-else语句?

如何在oracle sql脚本中创建if-then-else语句?,oracle,prompt,sql-scripts,Oracle,Prompt,Sql Scripts,我正在编写一个sql脚本,whitch应该问一个问题,是否继续将取决于用户的输入 我试过这个: 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;

我正在编写一个sql脚本,whitch应该问一个问题,是否继续将取决于用户的输入

我试过这个:

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搞混了。但是你可以试试这个——Oracle是DBMS,不是SQL客户机。链接断了