Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Updating a varray column in table

User_DUYMHAug 6 2021 — edited Aug 6 2021

Hi Guys
I have a table with one of the column as varray and need to update that column particular index with a value.

*** Test Data***
CREATE OR REPLACE TYPE "VARR_50" AS VARRAY (1000) OF VARCHAR2 (50);

CREATE TABLE test_data
(
user_id RAW (16),
attr_ids VARR_50
);

insert into test_data values (sys_guid(), VARR_50('abc','pqr',null,null,null,null,null,null,null,null,null,null));

insert into test_data values (sys_guid(), VARR_50(null,null,null,null,null,null,null,null));

insert into test_data values (sys_guid(), VARR_50('xyz',null,'FOO',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null));

commit;

Now how to update column attr_ids, to have a value of 'FOO' at 7th index of varray for each record.
Expected O/P
Record 1- 'abc','pqr',null,null,null,null,null,'FOO',null,null,null,null

Thanks

This post has been answered by mathguy on Aug 6 2021
Jump to Answer

Comments

Post Details

Added on Aug 6 2021
8 comments
2,875 views