Home » SQL & PL/SQL » SQL & PL/SQL » To store table row count in the same table's comment (any version Oracle)
To store table row count in the same table's comment [message #681288] Fri, 03 July 2020 18:54 Go to next message
Olexandr Siroklyn
Messages: 27
Registered: September 2018
Location: USA
Junior Member
Hello,

Is there any way to store, after table modifications, table row count inside the same table's comment?
First wrong idea is a table "after-insert-delete" trigger with "execute immediate 'comment on ...'" operation.

Thank you.
Re: To store table row count in the same table's comment [message #681289 is a reply to message #681288] Fri, 03 July 2020 19:31 Go to previous messageGo to next message
BlackSwan
Messages: 26730
Registered: January 2009
Location: SoCal
Senior Member
Olexandr Siroklyn wrote on Fri, 03 July 2020 16:54
Hello,

Is there any way to store, after table modifications, table row count inside the same table's comment?
First wrong idea is a table "after-insert-delete" trigger with "execute immediate 'comment on ...'" operation.

Thank you.

It is possible to do you you desire as long as you are willing to sacrifice application performance.
Doing so will serialize INSERT & DELETE operations to go in single file as the row count value is changed.
I just hope that you don't need many folks concurrently doing INSERT or DELETE operations against this table.
Re: To store table row count in the same table's comment [message #681292 is a reply to message #681289] Sat, 04 July 2020 09:21 Go to previous messageGo to next message
EdStevens
Messages: 1232
Registered: September 2013
Senior Member
What would be the point of storing the table's row count like this? It would need to be updated on EVERY insert or delete. I guarantee you will not be able to keep it accurate. And why would you want to? What problem are you trying to solve?
Re: To store table row count in the same table's comment [message #681296 is a reply to message #681292] Mon, 06 July 2020 05:22 Go to previous messageGo to next message
Bill B
Messages: 1968
Registered: December 2004
Senior Member
doing what you want is just silly when a simple select count(*) from my_table will produce the exact same result and it will be accurate
Re: To store table row count in the same table's comment [message #681301 is a reply to message #681296] Mon, 06 July 2020 09:49 Go to previous message
Olexandr Siroklyn
Messages: 27
Registered: September 2018
Location: USA
Junior Member
Thanks to everyone. Especially to Bill B. Topic can be closed.
Previous Topic: Newbie needs help with wm_concat
Next Topic: Identify the format and display the data type of a string
Goto Forum:
  


Current Time: Tue Aug 11 08:49:07 CDT 2020