今天执行一条语句:
INSERT INTO a@ora156
SELECT seq_sysalert_id.NEXTVAL,
'15098727782' AS MSISDN,
'0' AS MSTYPE,
'sfafs' AS MSMESSAGE,
'0' AS MSFLAG
FROM DUAL
抛出错误码为ORA-02069 ,错误解释如下:ORA-02069 global_names parameter must be set to TRUE for this operation
Cause: A remote mapping of the statement is required but cannot be achieved because GLOBAL_NAMES should be set to TRUE for it to be achieved.
Action: Issue ALTER SESSION SET GLOBAL_NAMES = TRUE if possible
。
实际引发错误的原因并非如此,而是因为插入的表是远程数据库的表,而序列不是远程数据库的序列,这时需要将序列后面也添加远程标识,修改为如下即可:
INSERT INTO a@ora156
SELECT seq_sysalert_id.NEXTVAL@ora156,
'15098727782' AS MSISDN,
'0' AS MSTYPE,
'sfafs' AS MSMESSAGE,
'0' AS MSFLAG
FROM DUAL