Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8382943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:02:48+00:00 2026-06-09T17:02:48+00:00

Today I found a sql to check the modification of a table, it looks

  • 0

Today I found a sql to check the modification of a table, it looks like below:

SELECT MODEL_ID, STATUS_ID, COUNT(*) as QUANTITY, ORA_ROWSCN as CHANGE_NUM
FROM DEVICE 
GROUP BY MODEL_ID, STATUS_ID

When I added one record to DEVICE table, the QUANTITY of the result increased but CHANGE_NUM didn’t change.

Then I was surprised to found that the ORA_ROWSCN was not part of GROUP BY clause, is it because ORA_ROWSCN is a pseudocolumn?

When I changed ORA_ROWSCN to MAX(ORA_ROWSCN), the CHANGE_NUM increased as expected.

So what’s the ORA_ROWSCN we got in the first sql? The first change num of a group? And what’s the meaning of this usage?

PS: I’m using Oracle Database 11g

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:02:49+00:00Added an answer on June 9, 2026 at 5:02 pm

    “I was surprised to found that the ORA_ROWSCN was not part of GROUP BY
    clause, is it because ORA_ROWSCN is a pseudocolumn?”

    Yes. You could replace ORA_ROWSCN with another pseudo-column like SYSDATE and your query would still work.

    “When I added one record to DEVICE table, the QUANTITY of the result
    increased but CHANGE_NUM didn’t change”

    According to the documentation, “Oracle tracks SCNs by transaction committed for the block in which the row resides.” (emphasis mine). So, if you are not tracking the SCN with ROWDEPENDENCIES (and that is the default) then the value you’ll see for ORA_ROWSCN is the SCN of the last committed transaction. The CHANGE_NUM won’t change until someone (not necessarily you) issues a COMMIT.

    Note that if you had have been using a table with ROWDEPENDENCIES the ORA_ROWSCN function would have returned null, until you issued a commit.

    In either case, when you execute an aggregated query the value of ORA_ROWSCN is the maximum for the block (or table – I think – when using ROWDEPENDENCIES).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Today while inside a client's production system, I found a SQL Server query that
I've been using SQL Server 2008 for a while now, yet only today, found
Today I found a strange problem that is I have a Table With a
Good morning, I'm studing the SQL, and today I've found two ways of declaring
Today I found out that code like that works. That sounds really strange to
Today I found a very mysterious bug in the code. I have used the
Today I found LiquiBase project and I think it is very interesting. I would
Today I found the following: #include <stdio.h> int main(){ char x = 255; int
Today I found that my site was down...I turned the errors to off and
While searching a bug in my code today I found a strange thing. When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.