Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: INSERT creates duplicate records

Re: INSERT creates duplicate records

From: Vladimir M. Zakharychev <bob_at_dpsp-yes.com>
Date: Mon, 17 Mar 2003 21:47:51 +0300
Message-ID: <b555kg$sgb$1@babylon.agtel.net>


I believe that Refresh call causes your insert statement to execute second time. This means improper use of oraSqlStmt - this object is for queries (select statements) only.

--
Vladimir Zakharychev (bob@dpsp-yes.com)                http://www.dpsp-yes.com
Dynamic PSP(tm) - the first true RAD toolkit for Oracle-based internet applications.
All opinions are mine and do not necessarily go in line with those of my employer.


"Torsten Schulz" <tos_theblocks_at_celerity-consulting.com> wrote in message
news:880be48f.0303170903.48e9db5e_at_posting.google.com...

> Ok,
>
> I am officialy going nuts. This is so simple, that I can't believe I
> didn't find anything on Google.
>
> Database: Oracle8i Enterprise Edition Release 8.1.7.3.0
>
> I create a table:
> SQL> create table test (x varchar2(10));
>
> I create an VB app with OO4O (Oracle InProc Server 3.0):
> Private Sub Command1_Click()
> Dim oraSession As oraSession
> Dim oraDatabase As oraDatabase
> Dim oraSqlStmt As oraSqlStmt
>
> Set oraSession = CreateObject("OracleInProcServer.XOraSession")
> Set oraDatabase = oraSession.OpenDatabase("dbname", "user" & "/" &
> "password", ORADB_ORAMODE)
> Set oraSqlStmt = oraDatabase.CreateSql("INSERT INTO test (x)
> VALUES ('abc')", ORASQL_FAILEXEC)
> oraSqlStmt.Refresh
> Set oraSqlStmt = Nothing
> End Sub
>
> When I run this function, I get:
> SQL> select * from test;
>
> X
> ----------
> abc
> abc
>
> The INSERT was fired twice. No triggers involved or anything. The same
> INSERT in SQL Plus is executed only once.
>
> Any ideas? Help is greatly appreciated...
>
> Torsten
Received on Mon Mar 17 2003 - 12:47:51 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US