类似于: var str:string; i:integer; begin sp1.Parameters.ParamValues['v_col1']:='aaa'; sp1.ExecProc; str:=sp1.Parameters.ParamValues['RETURN_VALUE']; --存储过程的out参数 showmessage(str);
控件设置: object Database1: TDatabase AliasName = 'oradb' DatabaseName = 'mydb' LoginPrompt = False Params.Strings = ( 'USER NAME=sw' 'password=sw') SessionName = 'Default' Left = 40 Top = 112 end object StoredProc2: TStoredProc AutoRefresh = True DatabaseName = 'mydb' StoredProcName = 'MYPROC1' Left = 32 Top = 192 ParamData = < item DataType = ftString Name = 'VEMPID' ParamType = ptInput end item DataType = ftCursor Name = 'O_CURSOR' ParamType = ptInputOutput end> end执行代码: database1.Open; storedproc2.close; storedproc2.Params[0].Value:=edit4.Text; storedproc2.open;
var
str:string;
i:integer;
begin
sp1.Parameters.ParamValues['v_col1']:='aaa';
sp1.ExecProc;
str:=sp1.Parameters.ParamValues['RETURN_VALUE']; --存储过程的out参数
showmessage(str);
object Database1: TDatabase
AliasName = 'oradb'
DatabaseName = 'mydb'
LoginPrompt = False
Params.Strings = (
'USER NAME=sw'
'password=sw')
SessionName = 'Default'
Left = 40
Top = 112
end
object StoredProc2: TStoredProc
AutoRefresh = True
DatabaseName = 'mydb'
StoredProcName = 'MYPROC1'
Left = 32
Top = 192
ParamData = <
item
DataType = ftString
Name = 'VEMPID'
ParamType = ptInput
end
item
DataType = ftCursor
Name = 'O_CURSOR'
ParamType = ptInputOutput
end>
end执行代码:
database1.Open;
storedproc2.close;
storedproc2.Params[0].Value:=edit4.Text;
storedproc2.open;
我用的是TADOStoredProc