关于From键盘的以下oracle查询出错

时间:2016-06-05 16:58:32

标签: sql oracle

我在下面有这个查询,但是当我执行sqlplus / nolog

时会抛出异常
SELECT 'EXEC DROP_CONSTRAINTS('TK_TYUOICE_REWOURCE','WQEA_INVOTRY');' FROM DUAL
                                                       *
ERROR at line 1:
ORA-00923: FROM keyword not found where expected


SELECT 'ALTER TABLE WQEA_INVOTRY ADD CONSTRAINT TK_TYUOICE_REWOURCE CHECK (SOURCE_SYSTEM IN ('WER','TYU'));' FROM DUAL
                                                                                                     *
ERROR at line 1:
ORA-00923: FROM keyword not found where expected

1 个答案:

答案 0 :(得分:0)

您需要转义字符串中的单引号。为此,只需加倍:

SELECT 'EXEC DROP_CONSTRAINTS(''TK_TYUOICE_REWOURCE'', ''WQEA_INVOTRY'');' 
FROM DUAL