Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Using Oracle bind variables on an INSERT
Depends upon the driver. In OO4O you define parameters, set them and then
create your statement once.(reset the values in the parameters, and
reexecute)
Jim
-- Replace part of the email address: kennedy-down_with_spammers_at_attbi.com with family. Remove the negative part, keep the minus sign. You can figure it out. "Mark Freeman" <mark_freeman_at_asc.aon.com> wrote in message news:df323d2.0306161811.3c2b4825_at_posting.google.com...Received on Mon Jun 16 2003 - 23:00:21 CDT
> I am trying to tune my VB 6 application to take better advantage of
> the Oracle 8i database it uses.
>
> I have the following code:
>
> ChangeLog.AddNew
> ChangeLog("USER_ID") = UserID
> ChangeLog("Updated") = Now()
> ChangeLog("EQUIPTYPE_ID") = EquipTypeID
> ChangeLog("EQUIP_ID") = EquipIDOut
> ChangeLog("FIELD_NAME") = FieldName
> ChangeLog("OLD_VALUE") = OldValue
> ChangeLog("NEW_VALUE") = NewValue
> ChangeLog.Update
>
> This code generates sql_text in v$sqlarea like this:
>
> INSERT INTO "TSS_CHANGELOG"
>
("EQUIPTYPE_ID","EQUIP_ID","FIELD_NAME","OLD_VALUE","NEW_VALUE","USER_ID","U PDATED")
> VALUES (1,6111,:V00003,:V00004,:V00005,226,:V00007)
>
> Somehow, many of the values are being converted to bind variables
> without my doing anything. I'd like to take out the middleman and do
> all of them so I end up with one such query in the cache rather than
> the thousands that I found. Is this the proper syntax to do what I
> want:
>
> gcnnOut.Execute "INSERT INTO 'TSS_CHANGELOG'
>
('EQUIPTYPE_ID','EQUIP_ID','FIELD_NAME','OLD_VALUE','NEW_VALUE','USER_ID','U PDATED')
> VALUES (:a,:b,:c,:d,:e,:f,:g,:h,:i) using " & EquipTypeID & "," &
> EquipIDOut & "," & FieldName & "," & OldValue & "," & NewValue & "," &
> UserID & ",SYSDATE"
>
> Thanks for your guidance,
>
> - Mark