Oracle
如何在替換變數中轉義點(。)
我有一個名為的變數
ERROR_DETAIL
,在我的文件中file.sql
我有這一行:SELECT 'error detail : &ERROR_DETAIL ' FROM DUAL;
ERROR_DETAIL
一旦執行 sqlplus 在變數包含例如以下錯誤時抱怨'the field x.y is mandatory'
:ORA-00923: FROM keyword not found where expected
我知道
x.y
(視為table.column)的問題。我嘗試使用雙引號,但出現無效標識符錯誤
我也不能
set define off
。這是我收到的腳本錯誤:
SELECT q'{error detail : &ERROR_DETAIL }' FROM DUAL;
SQL> SELECT 'error detail : ' || &ERROR_DETAIL from dual; Enter value for error_detail: 'the field x.y is mandatory' old 1: SELECT 'error detail : ' || &ERROR_DETAIL from dual new 1: SELECT 'error detail : ' || 'the field x.y is mandatory' from dual 'ERRORDETAIL:'||'THEFIELDX.YISMANDATORY' ----------------------------------------- error detail : the field x.y is mandatory SQL>