gpt4 book ai didi

c# - pl/sql 查询和 .net 的奇怪行为

转载 作者:太空宇宙 更新时间:2023-11-03 22:25:26 25 4
gpt4 key购买 nike

我运行此查询以使用 OracleCommand 的输出参数读取记录的计数:

var query = "declare MyCount number; begin SELECT COUNT(*) INTO :MyCount FROM T_ISSUE; end;";

这个很好用。

但是如果我像这样将查询分成两行:

var query = @"declare MyCount number; 
begin SELECT COUNT(*) INTO :MyCount FROM T_ISSUE; end;";

我得到以下异常:

System.Data.OracleClient.OracleException: ORA-06550: line 1, column 25:
PLS-00103: Encountered the symbol "" when expecting one of the following:

begin function package pragma procedure subtype type use
<an identifier> <a double-quoted delimited-identifier> form
current cursor
The symbol "" was ignored.

有人知道为什么吗?

感谢您的帮助。

最佳答案

这是由于 VS 使用 windows 风格的换行符 (CR+LF) 但 Oracle 只接受 Unix 风格(仅 LF)。

至少在 VB6 中是这样。

关于c# - pl/sql 查询和 .net 的奇怪行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1601744/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com