我找不到任何禁止在“更改会话”中使用绑定变量的 Oracle 文档,但它不起作用:
declare
savedecim char(2);
begin
savedecim := ',.';
EXECUTE IMMEDIATE 'DECLARE foo char(2); BEGIN foo := :1; END;' using savedecim; -- works
EXECUTE IMMEDIATE 'ALTER session SET NLS_NUMERIC_CHARACTERS = '',.'''; -- works
EXECUTE IMMEDIATE 'ALTER session SET NLS_NUMERIC_CHARACTERS = :1' using savedecim; -- ORA-00922: missing or invalid option
null;
end;
/