Skip to Main Content

APEX

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!

Update records in a table from Apex_Collection does not work

rober584812Jan 12 2019 — edited Jan 28 2019

Update a collection of Apex is a big problem, investigate in some threads of this community and in tutorials and has not served me anything.

The new data that is entered is not updated in the database.

I expose in detail how I generated the tabular form:

  1. Create the Collection.

Captura20190112095633.png

IF apex_collection.collection_exists ('NOMINA_ESTUDIANTES_COLL') = FALSE THEN

apex_collection.create_collection_from_query(

 p\_collection\_name => 'NOMINA\_ESTUDIANTES\_COLL',

 p\_query => 'select NUMERO\_matricula alias1,

                    periodo alias2,

                    alumno\_id alias3,

                    apellidos alias4,

                    nombres alias5,

                    curso\_id alias6,

                    paralelo alias7,

                    nivel\_id alias8,

                    subnivel\_id alias9,

                    asignatura\_id alias10,

                    tai1 as tai1,

                    wwv\_flow\_item.md5(NUMERO\_matricula,periodo,alumno\_id, apellidos, nombres,curso\_id,paralelo,nivel\_id,subnivel\_id,asignatura\_id,tai1)

             from reporte\_parcial where periodo=2018   /\* and nivel\_id=300 and curso\_id=3 and subnivel\_id=14\*/',

 p\_generate\_md5 => 'YES');

END IF;

Captura20190112114345.png

  1. Generate the report.

SELECT

 apex\_item.DISPLAY\_AND\_SAVE(1,c001,8)as NUMERO\_matricula

 ,apex\_item.DISPLAY\_AND\_SAVE(2,c002,8)as periodo

 ,apex\_item.DISPLAY\_AND\_SAVE(3,c003) as alumno\_id

 ,apex\_item.DISPLAY\_AND\_SAVE(4,c004,8) as APELLIDOS

 ,apex\_item.DISPLAY\_AND\_SAVE(5,c005,8)as  NOMBRES

 ,apex\_item.DISPLAY\_AND\_SAVE(6,c006,8)as CURSO

 ,apex\_item.hidden(7,c007,8)as PARALELO

 ,apex\_item.text(8, c010)as  TAI

FROM apex_collections

WHERE collection_name= 'NOMINA_ESTUDIANTES_COLL' and c002=2018 and c008=300 and c009=14 and c006=3 /*and c006=:P7_CURSO

AND c002=:P7_PERIODO*/ AND C002='2018' and c010=7

ORDER BY APELLIDOS,

   NOMBRES;
  1. Encode the process of updating the collection.

Captura20190112095555.png

for x in 1..apex_application.g_f01.count loop

apex\_debug\_message.log\_message(x);

for x in 1..apex_application.g_f01.count loop

apex\_debug\_message.log\_message(x);

apex\_collection.update\_member\_attribute(p\_collection\_name=>'NOMINA\_ESTUDIANTES\_COLL',

                               p\_seq=>apex\_application.g\_f01(x),

                               p\_attr\_number =>1,

                               p\_attr\_value=>apex\_application.g\_f02(x));

apex\_collection.update\_member\_attribute(p\_collection\_name=>'NOMINA\_ESTUDIANTES\_COLL',

                               p\_seq=>apex\_application.g\_f01(x),

                               p\_attr\_number =>2,

                               p\_attr\_value=>apex\_application.g\_f08(x));

end loop;

end loop;

  1. Create the process to update the database.

Captura20190112113332.png

BEGIN

FOR indice in 1..apex_application.g_f01.count LOOP

     UPDATE RENDIMIENTO\_ACADEMICO3

     SET TAI1=apex\_application.g\_f08(indice)

     WHERE PERIODO='2018' AND NUMERO\_MATRICULA=apex\_application.g\_f01(indice) AND ASIGNATURA\_ID=7;

     COMMIT;

END LOOP;

END;

Captura20190112113345.png

When I press the update button, it shows the message NO DATA FOUND

Suggestions.

Comments
Post Details
Added on Jan 12 2019
6 comments
1,100 views