procedure TForm1.btn1Click(Sender: TObject);
var
i:integer;
begin
//预处理
with OraStoredProc1 do
begin
AutoCommit := False;
FetchAll := True;
StoredProcName := 'p_register_user';
params.Clear;
params.CreateParam(ftstring,'v_cn',ptinput);
params.CreateParam(ftstring,'v_password',ptinput);
params.CreateParam(ftstring,'v_ip',ptinput);
params.CreateParam(ftInteger,'b_return',ptOutput);
prepare;
end;
//执行
with OraStoredProc1 do
begin
ParamByName('v_cn').AsString := edt1.Text;
ParamByName('v_password').AsString := edt2.Text;
ParamByName('v_ip').AsString := '192.168.1.1';
ExecProc;
i := ParamByName('b_return').Value;
case i of
0:ShowMessage('AddUser OK.');
1:ShowMessage('User Exists.');
9:ShowMessage('Other Error.');
end;
end;
end;
procedure TForm1.btn2Click(Sender: TObject);
var
str:string;
begin
OraQuery1.Close;
OraQuery1.SQL.Clear;
OraQuery1.SQL.Add('select md5(''aaa'') from user_basic');
OraQuery1.Open;
str :=OraQuery1.fields[0].asstring;
ShowMessage(str);
end;