473,396 Members | 1,774 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,396 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 6469
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.