DB初学者在这里。我有一个名为“mkdir”的程序,它应该模仿 bash 命令:
create or replace
PROCEDURE "MKDIR"
(
id_p in number
, name in varchar2
) as
begin
insert into folders(name,id_p) values(name,id_p);
dbms_output.put_line('Created folder: '||name);
exception
when DUP_VAL_ON_INDEX then
dbms_output.put_line('Folder with the same name already exists!');
when NO_DATA_FOUND then
dbms_output.put_line('Parent id not found!');
end mkdir;
这是我的 Java 程序的一部分:
String sql = "begin mkdir(var1=>?, " +"var2=>?); end;";
st = conn.prepareCall(sql);
st.setInt(1,1);
st.setString(2, "hello");
st.execute();
我试过切换变量的顺序,但它不起作用。我意识到这是一个非常愚蠢的错误,但我无法终生解决它。
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'MKDIR'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored