在bloginfo数据库中,利用用户名 system 密码 scy251147 选择超级管理员登陆 创建如下存储过程:
/*存储过程*/

create or replace procedure sys.InsertInfo
(
TitleParams in nvarchar2,
ContentParams in nvarchar2,
Obj_Params out integer
)
is
begin
insert into testtable(ID,title,content)
values(seq_testtable_ids.nextval,TitleParams,ContentParams)
return ID into Obj_Params;
return;
exception
when no_data_found
then
null;
when others
then
raise;
end InsertInfo;
(
TitleParams in nvarchar2,
ContentParams in nvarchar2,
Obj_Params out integer
)
is
begin
insert into testtable(ID,title,content)
values(seq_testtable_ids.nextval,TitleParams,ContentParams)
return ID into Obj_Params;
return;
exception
when no_data_found
then
null;
when others
then
raise;
end InsertInfo;
然后就是asp.net端的操作代码:

using(OracleConnection conn = new OracleConnection("Data Source=BlogInfo;User ID=System;Password=scy251147"))
{
conn.Open();
OracleCommand oracmd = new OracleCommand();
oracmd.Connection = conn;
DbParameter[] paras=new OracleParameter[3];
paras[0] = new OracleParameter("TitleParams", OracleType.NVarChar,500);
paras[0].Value = "你好啊,哈哈哈哈哈";
paras[0].Direction = ParameterDirection.Input;
paras[1] = new OracleParameter("ContentParams", OracleType.NVarChar,500);
paras[1].Value = "我今天很高兴,真的,希望大家都要高兴啊,哈哈哈哈";
paras[1].Direction = ParameterDirection.Input;
paras[2] = new OracleParameter("Obj_Params",OracleType.Int32);
paras[2].Direction = ParameterDirection.Output;
oracmd.Parameters.Add(paras[0]);
oracmd.Parameters.Add(paras[1]);
oracmd.Parameters.Add(paras[2]);
oracmd.CommandText = "sys.INSERTINFO";
oracmd.CommandType = CommandType.StoredProcedure;
oracmd.ExecuteNonQuery();
int i = Convert.ToInt32(paras[2].Value);
Response.Write(i.ToString());
}
{
conn.Open();
OracleCommand oracmd = new OracleCommand();
oracmd.Connection = conn;
DbParameter[] paras=new OracleParameter[3];
paras[0] = new OracleParameter("TitleParams", OracleType.NVarChar,500);
paras[0].Value = "你好啊,哈哈哈哈哈";
paras[0].Direction = ParameterDirection.Input;
paras[1] = new OracleParameter("ContentParams", OracleType.NVarChar,500);
paras[1].Value = "我今天很高兴,真的,希望大家都要高兴啊,哈哈哈哈";
paras[1].Direction = ParameterDirection.Input;
paras[2] = new OracleParameter("Obj_Params",OracleType.Int32);
paras[2].Direction = ParameterDirection.Output;
oracmd.Parameters.Add(paras[0]);
oracmd.Parameters.Add(paras[1]);
oracmd.Parameters.Add(paras[2]);
oracmd.CommandText = "sys.INSERTINFO";
oracmd.CommandType = CommandType.StoredProcedure;
oracmd.ExecuteNonQuery();
int i = Convert.ToInt32(paras[2].Value);
Response.Write(i.ToString());
}
从这里,我们看上去是一点问题都没有的,然后直接运行。
结果,一直提示“必须说明标识符“InsertInfo””(注意:我当时的语句是:oracmd.CommandText = "INSERTINFO";)
然后一直没找到结果,也没有发现程序中的错误,于是便想到了可能是授权的问题。
于是我退出超级管理员,然后利用用户名system 密码scy251147 选择Normal用户进行登陆,结果在利用
select * from testtable的时候,发现果真找不到这个表了,于是便利用select * from sys.testtable发现竟然显示
除了结果,于是便在语句前面加个sys.,一切正常了,返回了正确的数值。
猜想:可能是程序连接的时候,自动利用普通用户的权限进行登陆,而我的表是在超级管理员里面建立的,所以会看不到
只要在前面加上用户名称,就可以了,比如sys.testtabel。呵呵·~~~
小东西,看来里面的麻烦还不少。
分类:
数据库 点滴记录
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!