473,326 Members | 2,255 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

need help with PL/SQL Procedure

i try to write a PL/SQL procedure for Oracle 9.2

is there a way to retrieve the number of affected rows of an INSERT or
an UPDATE statement?
i tried different ways with RETURNING INTO... but its not working :(

my statement is like:

insert into BEP_EQUIPMENT_CACHE
(select * from BEP_EQUIPMENT_MV WHERE EQUIPMENT not in (SELECT
EQUIPMENT FROM BEP_EQUIPMENT_CACHE));

please help,
thank you all - sven
Jul 19 '05 #1
5 6460
sv*******@web.de (Sven) wrote in
news:4f**************************@posting.google.c om:
i try to write a PL/SQL procedure for Oracle 9.2

is there a way to retrieve the number of affected rows of an INSERT or
an UPDATE statement?
i tried different ways with RETURNING INTO... but its not working :(

my statement is like:

insert into BEP_EQUIPMENT_CACHE
(select * from BEP_EQUIPMENT_MV WHERE EQUIPMENT not in (SELECT
EQUIPMENT FROM BEP_EQUIPMENT_CACHE));

please help,
thank you all - sven


Take a look at SQL%ROWCOUNT

--
Ken Denny
http://www.kendenny.com/
Jul 19 '05 #2
Also, make sure it is the statement immediately following the DML command
otherwise you lose its value (especially if it is an explicit cursor and you
close the cursor ;)
"Ken Denny" <ke*@kendenny.com> wrote in message
news:Xn**********************@216.77.188.18...
sv*******@web.de (Sven) wrote in
news:4f**************************@posting.google.c om:
i try to write a PL/SQL procedure for Oracle 9.2

is there a way to retrieve the number of affected rows of an INSERT or
an UPDATE statement?
i tried different ways with RETURNING INTO... but its not working :(

my statement is like:

insert into BEP_EQUIPMENT_CACHE
(select * from BEP_EQUIPMENT_MV WHERE EQUIPMENT not in (SELECT
EQUIPMENT FROM BEP_EQUIPMENT_CACHE));

please help,
thank you all - sven


Take a look at SQL%ROWCOUNT

--
Ken Denny
http://www.kendenny.com/

Jul 19 '05 #3
perfect. thank you
Jul 19 '05 #4
hi,
i think MERGE best fits your needs.

MERGE INTO new_table n
USING old_table o
ON (n.column = o.column)
WHEN MATCHED THEN UPDATE SET ....
WHEN NOT MATCHED THEN INSERT .....


sv*******@web.de (Sven) wrote in message news:<4f**************************@posting.google. com>...
i try to write a PL/SQL procedure for Oracle 9.2

is there a way to retrieve the number of affected rows of an INSERT or
an UPDATE statement?
i tried different ways with RETURNING INTO... but its not working :(

my statement is like:

insert into BEP_EQUIPMENT_CACHE
(select * from BEP_EQUIPMENT_MV WHERE EQUIPMENT not in (SELECT
EQUIPMENT FROM BEP_EQUIPMENT_CACHE));

please help,
thank you all - sven

Jul 19 '05 #5
hi,
i think MERGE best fits your needs.

MERGE INTO new_table n
USING old_table o
ON (n.column = o.column)
WHEN MATCHED THEN UPDATE SET ....
WHEN NOT MATCHED THEN INSERT .....


sv*******@web.de (Sven) wrote in message news:<4f**************************@posting.google. com>...
i try to write a PL/SQL procedure for Oracle 9.2

is there a way to retrieve the number of affected rows of an INSERT or
an UPDATE statement?
i tried different ways with RETURNING INTO... but its not working :(

my statement is like:

insert into BEP_EQUIPMENT_CACHE
(select * from BEP_EQUIPMENT_MV WHERE EQUIPMENT not in (SELECT
EQUIPMENT FROM BEP_EQUIPMENT_CACHE));

please help,
thank you all - sven

Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tom Urbanowicz | last post by:
I have a table with 100+ columns, for which I'm trying to retrieve only 1 specific record. For this single record, I do not know which of the columns are NULL, and which are populated. I would...
7
by: Aleem | last post by:
I need help in writing a stored procedure on SQL Server 2000. Basically the stored procedure's primary task is to generate invoice records and insert the records in a invoice table. In order to...
5
by: Ralph | last post by:
Hi all, I'm a newbie to MS-SQL UDFs and seem to have a real big problem. I need to implement a logic to receive an adress build out of various user definable fields from various user defined...
0
by: Doug R | last post by:
Hello, I have a system that I am writing to automaticly import Credit Transaction data into a SQL Server 2000 Database. I am using a VB.Net application to detect when the file arives and prep...
7
by: Terri | last post by:
I have a stored procedure that creates an xml file. It executes a SELECT statement with the FOR XML clause and then writes the xml file using bcp and xp_cmdshell. I am calling this procedure by...
3
by: Ellie O'Donnell | last post by:
Hi, I wrote a DB2 stored procedure in COBOL, and now I need to prepare a CLIST in order to call it. This CLIST would be for people who want to use the stored procedure outside of COBOL or Pl/I....
11
by: my-wings | last post by:
I think I've painted myself into a corner, and I'm hoping someone can help me out. I have a table of books (tblBooks), which includes a field (strPubName) for Publisher Name and another field...
1
by: Jim H | last post by:
I am on a project where I am supposed to send an XML document to a SQL Server stored procedure. The XML Doc is a list strings. If in my c# function I get a list values as (string psValueList),...
46
by: Bruce W. Darby | last post by:
This will be my very first VB.Net application and it's pretty simple. But I've got a snag in my syntax somewhere. Was hoping that someone could point me in the right direction. The history: My...
5
by: byahne | last post by:
We just went live today with a production SQL Server 2005 database running with our custom Java application. We are utilizing the jTDS open source driver. We migrated our existing application...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.