简体   繁体   中英

How can get rid of the oracleCommand error?

How can get rid of the oracleCommand error when I put double quotation marks between "USER1" I need to use below query for my oracleCommand and USER1 has double quotation marks and C# thinks my command only USER1, but it actually "Select....."USER1".......dual".

 using (OracleCommand crtCommand = new OracleCommand("SELECT  REGEXP_REPLACE ( REPLACE ( dbms_metadata.get_ddl ('PROCEDURE', 'HELL_'), '"USER1".'),'^\s+', NULL, 1, 0, 'm') FROM dual", conn2))

how can I modify like below

using (OracleCommand crtCommand = new OracleCommand(@"SELECT  REGEXP_REPLACE ( REPLACE ( dbms_metadata.get_ddl ('PROCEDURE', '+ Items +'), '"" + txtSrcUserID.Text.ToUpper() + "".'),'^\s+', NULL, 1, 0, 'm') FROM dual", conn1))

使用“ @”来处理Verbatim字符串文字 ,如下所示:

using (OracleCommand crtCommand = new OracleCommand(@"SELECT  REGEXP_REPLACE ( REPLACE ( dbms_metadata.get_ddl ('PROCEDURE', 'HELL_'), '""USER1"".'),'^\s+', NULL, 1, 0, 'm') FROM dual", conn2))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM