DB beginner here.
I have a procedure called “mkdir” that’s supposed to mimic the bash command:
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;
Heres part of my Java program:
String sql = "begin mkdir(var1=>?, " +"var2=>?); end;";
st = conn.prepareCall(sql);
st.setInt(1,1);
st.setString(2, "hello");
st.execute();
I’ve tried switching the order of variables, but it doesn’t work. I realise this is an extremely stupid error, but i can’t for the life of me resolve it.
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
it should be
String sql = “exec mkdir …….