select创建存储过程错误
createorreplaceprocedureget_gdnum(n_gdnuminnumber)asbeginselectto_char(sysdate,'YYMMD...
create or replace procedure get_gdnum(n_gdnum in number)
as
begin
select to_char(sysdate,'YYMMDD')||to_char(gdseq.nextval,'0000') into n_gdnum from dual;
end get_gdnum;
提示错误Error: PLS-00403: 表达式 'N_GDNUM' 不能作为 SELECT/FETCH 语句的 INTO 目标
我想把n_gdnum在textbox空间中显示出来有什么办法吗?
String constring = "data source=;user id=;password=";
OracleConnection con = new OracleConnection(constring);
OracleCommand cmd = con.CreateCommand();
cmd.CommandText = "get_gdnum";
cmd.CommandType = CommandType.Text;
OracleParameter n_gdnum = cmd.Parameters.Add("n_gdnum", OracleType.VarChar, 30);
n_gdnum.Direction = ParameterDirection.Output;
con.Open();
cmd.ExecuteNonQuery();
textBox1.Text = n_gdnum.Value.ToString();
con.Close(); 展开
as
begin
select to_char(sysdate,'YYMMDD')||to_char(gdseq.nextval,'0000') into n_gdnum from dual;
end get_gdnum;
提示错误Error: PLS-00403: 表达式 'N_GDNUM' 不能作为 SELECT/FETCH 语句的 INTO 目标
我想把n_gdnum在textbox空间中显示出来有什么办法吗?
String constring = "data source=;user id=;password=";
OracleConnection con = new OracleConnection(constring);
OracleCommand cmd = con.CreateCommand();
cmd.CommandText = "get_gdnum";
cmd.CommandType = CommandType.Text;
OracleParameter n_gdnum = cmd.Parameters.Add("n_gdnum", OracleType.VarChar, 30);
n_gdnum.Direction = ParameterDirection.Output;
con.Open();
cmd.ExecuteNonQuery();
textBox1.Text = n_gdnum.Value.ToString();
con.Close(); 展开
1个回答
展开全部
1.create or replace procedure get_gdnum(n_gdnum in number)
in在这里表是输入,并且再括号中定义的数据是用于执行的时候输入输出,你可以把n_gdnum number调到is下运行
2.众观过程你的目的是输出字符串,所以建议你使用一下语句试验下:
create or replace procedure get_gdnum
as
n_gdnum varchar2(10);
begin
select to_char(sysdate,'YYMMDD')||to_char(gdseq.nextval,'0000') into n_gdnum from dual;
dbms_output.put_line(n_gdnum);
end get_gdnum;
上面有个语句我不知道你到底是什么用:to_char(gdseq.nextval,'0000')
去掉这个剩下这个:
create or replace procedure get_gdnum
as
n_gdnum varchar2(10);
begin
select to_char(sysdate,'YYMMDD')into n_gdnum from dual;
dbms_output.put_line(n_gdnum);
end get_gdnum;
运行结果:
110331
PL/SQL procedure successfully completed
in在这里表是输入,并且再括号中定义的数据是用于执行的时候输入输出,你可以把n_gdnum number调到is下运行
2.众观过程你的目的是输出字符串,所以建议你使用一下语句试验下:
create or replace procedure get_gdnum
as
n_gdnum varchar2(10);
begin
select to_char(sysdate,'YYMMDD')||to_char(gdseq.nextval,'0000') into n_gdnum from dual;
dbms_output.put_line(n_gdnum);
end get_gdnum;
上面有个语句我不知道你到底是什么用:to_char(gdseq.nextval,'0000')
去掉这个剩下这个:
create or replace procedure get_gdnum
as
n_gdnum varchar2(10);
begin
select to_char(sysdate,'YYMMDD')into n_gdnum from dual;
dbms_output.put_line(n_gdnum);
end get_gdnum;
运行结果:
110331
PL/SQL procedure successfully completed
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询