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: HOw many records were affected?

Re: HOw many records were affected?

From: <jgotthelf_at_my-deja.com>
Date: Tue, 22 Aug 2000 16:53:51 GMT
Message-ID: <8nub6j$qv7$1@nnrp1.deja.com>

Coming from Visual FoxPro, using SQL Passthrough.

In article <8nu4bh$rfb$1_at_news.sinet.slb.com>,   "Yong" <yhuang_at_indigopool.com> wrote:
> When you say ODBC, you need to specify what application environment
 you're
> in. Microsoft ASP (Active Server Pages), Perl DBI/DBD, Java JSP etc.
 all
> provide ways to use bind variables. You can't pass the literal
 string "var n
> number" to Oracle through ODBC because it's for SQL*Plus, not ASP or
 Perl
> DBI or JSP. Read up on the section on Bind Variables in your
 programmers'
> manual.
>
> Yong Huang
> yhuang_at_indigopool.com
>
> <jgotthelf_at_my-deja.com> wrote in message news:8ntv18
 $bhh$1_at_nnrp1.deja.com...
> > This won't work from ODBC calls that I can tell though; at the very
> > least, sending "var n number;" via ODBC seems to be rejected as
> > an "Invalid SQL statement".
> >
> > Also, I haven't yet found a way to get variables sent back via ODBC.
> >
> > In article <8nkpuu$djt$1_at_nnrp1.deja.com>,
> > sergey_s_at_my-deja.com wrote:
> > > SQL> create table t (i number);
> > >
> > > Table created.
> > >
> > > SQL> insert into t values (1);
> > >
> > > 1 row created.
> > >
> > > SQL> var n number; <- This creates a global variable n in sqlplus
> > > SQL>begin
> > > 2 update t set i=13 where i=1;
> > > 3 :n := sql%rowcount; <- Number of affected rows assigned to n
> > > 4 end;
> > > 5 /
> > >
> > > PL/SQL procedure successfully completed.
> > >
> > > SQL> print n
> > >
> > > N
> > > ----------
> > > 1
> > >
> > > SQL>
> > >
> > > So, you need to assign sql%rowcount to a variable of your choice
 and
 do
> > > it inside a stored proc immediately after the execution of the
 desired
> > > statement.
> > >
> > > hth
> > >
> > > Sergey
> > >
> > > In article <8njova$700$1_at_nnrp1.deja.com>,
> > > jgotthelf_at_my-deja.com wrote:
> > > > Hi,
> > > >
> > > > I'm accessing Oracle via ODBC Passthrough - and after and
 UPDATE or
> > > > INSERT I need to find out how many records were updated. IN SQL
 Server
> > > > I do:
> > > >
> > > > update table_name set value = 42 where key_field = 11
> > > > select @@rowcount
> > > >
> > > > If the update was successfull, @@rowcount returns a 1, else it
 returns
> > > > a zero.
> > > >
> > > > How can I accomplish the same in Oracle?
> > > >
> > > > Sent via Deja.com http://www.deja.com/
> > > > Before you buy.
> > > >
> > >
> > > Sent via Deja.com http://www.deja.com/
> > > Before you buy.
> > >
> >
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Tue Aug 22 2000 - 11:53:51 CDT

Original text of this message

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