245
Views
9
Comments
How can I getting total affected row in advanced "UPDATE" query by Oracle
Question

Hi

how can I getting total affected row in advanced "UPDATE" or "INPUT" query by Oracle?

Thanks in advance.

Regards

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi Lucas,

Use Select @@RowCount and an Output parameter of data type int.

Use an input parameter RowCount of data type text and set it to "@@ROWCOUNT"

The assumption here is you use MS SQL Server, if it is Oracle you use let me know, I have to look that up, don't use Oracle myself.

Regards,

Daniel

UserImage.jpg
PeiLin Li

Daniël Kuhlmann wrote:

Hi Lucas,

Use Select @@RowCount and an Output parameter of data type int.

Use an input parameter RowCount of data type text and set it to "@@ROWCOUNT"

The assumption here is you use MS SQL Server, if it is Oracle you use let me know, I have to look that up, don't use Oracle myself.

Regards,

Daniel

Thanks for your reply. But this solution can't work on Oracle.

Oracle have a command is "SQL%rowcount" like MS SQL's "@@ROWCOUNT".

It can't not used in select statement.


My English is weak, please don't mind.

UserImage.jpg
Prajwal Kori

Hi Daniel,

How many attributes do I set in int structure? Is it just one attribute, where the number of rows impacted are deposited to this attribute?

Thank you,


Prajwal.

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi, try  for Oracle "sql%rowcount" as the input parameter value. 

UserImage.jpg
PeiLin Li

Thank you Daniël.


Sorry, I got this error:  ORA-00933: SQL command not properly ended

The image is my query and RowCount value.

I have check the update statement can execute. I got error after add the select statement.

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Do you have the property Expand Inline Parameters set to True?

See the screenshot I shared originally.

UserImage.jpg
PeiLin Li

Daniël Kuhlmann wrote:

Do you have the property Expand Inline Parameters set to True?

See the screenshot I shared originally.

Yes! I've already set to Ture...


2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hmm... problem is I don't have Oracle and are not an Oracle specialist.

Either way, the trick is the Inline Parameter and SELECT statement with output parameter and the right Oracle syntax. Hope you can google yourself to a working SQL clause.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.