在oracle中设置转义符
set escape character in oracle
我正在开发一个 Java 程序,试图在 oracle 和 sql-server 中重置用户密码。此密码是随机生成的密码,其中包含一些不能作为普通字符串接受的字符。例如。 '
,""
,;
我用来重置用户密码的命令是:
甲骨文:
ALTER USER <username> IDENTIFIED BY <password>
sql-服务器:
ALTER LOGIN <username> WITH PASSWORD = '<passowrd>'
我怎样才能重新设置它才能接受所有类型的特殊字符?
我做了 google 并发现了 quoting method:。我也确实发现了使用单代码和双代码。但是,如果生成的密码在该密码中有一个 "
或相同的引号分隔符怎么办?那么这将是一个问题。
Eg. IDENTIFIED BY 'jks'k"fjh''d'
Eg. password = q[#kkksdj#jsksls#]
Eg. password = "nm.js""kh:kjhs"
我有什么方法可以在 oracle 和 sql-server 中执行此操作吗?或者我是否需要在发送到 oracle/sql-server 之前从 java 中一个一个地转义每个字符?我的 oracle 和 sql-server 的重置程序不同。所以方法可以不同
But what if the password generated have a " or same quote delimiter inside that password? Then it will be a problem.
当然可以。 Oracle 已将其记录在 Object Names and Qualifiers 中,这同样适用于 密码 。
Passwords must follow the rules described in the section "Schema Object Naming Rules"
最重要的部分:
Nonquoted identifiers can contain only alphanumeric characters from
your database character set and the underscore (_), dollar sign ($),
and pound sign (#). Database links can also contain periods (.) and
"at" signs (@). Oracle strongly discourages you from using $ and # in
nonquoted identifiers.
Quoted identifiers can contain any characters and punctuations marks
as well as spaces. However, neither quoted nor nonquoted identifiers
can contain double quotation marks or the null character ([=13=]).
因此,引用和非引用标识符都不能包含双引号。
要允许单引号,您可以使用带引号的标识符,使用双引号[=34] =].例如,
SQL> create user test identified by "a'b'c";
User created.
我正在开发一个 Java 程序,试图在 oracle 和 sql-server 中重置用户密码。此密码是随机生成的密码,其中包含一些不能作为普通字符串接受的字符。例如。 '
,""
,;
我用来重置用户密码的命令是:
甲骨文:
ALTER USER <username> IDENTIFIED BY <password>
sql-服务器:
ALTER LOGIN <username> WITH PASSWORD = '<passowrd>'
我怎样才能重新设置它才能接受所有类型的特殊字符?
我做了 google 并发现了 quoting method:。我也确实发现了使用单代码和双代码。但是,如果生成的密码在该密码中有一个 "
或相同的引号分隔符怎么办?那么这将是一个问题。
Eg. IDENTIFIED BY 'jks'k"fjh''d'
Eg. password = q[#kkksdj#jsksls#]
Eg. password = "nm.js""kh:kjhs"
我有什么方法可以在 oracle 和 sql-server 中执行此操作吗?或者我是否需要在发送到 oracle/sql-server 之前从 java 中一个一个地转义每个字符?我的 oracle 和 sql-server 的重置程序不同。所以方法可以不同
But what if the password generated have a " or same quote delimiter inside that password? Then it will be a problem.
当然可以。 Oracle 已将其记录在 Object Names and Qualifiers 中,这同样适用于 密码 。
Passwords must follow the rules described in the section "Schema Object Naming Rules"
最重要的部分:
Nonquoted identifiers can contain only alphanumeric characters from your database character set and the underscore (_), dollar sign ($), and pound sign (#). Database links can also contain periods (.) and "at" signs (@). Oracle strongly discourages you from using $ and # in nonquoted identifiers.
Quoted identifiers can contain any characters and punctuations marks as well as spaces. However, neither quoted nor nonquoted identifiers can contain double quotation marks or the null character ([=13=]).
因此,引用和非引用标识符都不能包含双引号。
要允许单引号,您可以使用带引号的标识符,使用双引号[=34] =].例如,
SQL> create user test identified by "a'b'c";
User created.