SQL*Plus (MOSC)

MOSC Banner

update statement

edited Mar 14, 2024 9:12AM in SQL*Plus (MOSC) 3 commentsAnswered ✓

Oracle OPM

12.2.10

requirement to udpate custom table with below example

first time the cnt column will update as 1 and previous_cnt will be 0 then whenever next record is updated then cnt will be 2 and previous_cnt will be 1 and update_time will be previous_time (only time no date) and hash_key value should get updated in previous_hash column

please i need help with the udpate statement

for example

select hash_key, cnt, previous_cnt, update_time, previous_hash from sc_test

for second record trying to update is not working, please i need help

UPDATE SC_TEST A SET A.CNT = (SELECT COUNT(*) FROM SC_TEST B WHERE HASH_KEY IS NOT NULL AND B.INV_NUMBER = A.INV_NUMBER )

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center