Skip to Main Content

Oracle Forms

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!

how to use cursor for loop in oracle forms 10g

994122Apr 22 2014 — edited Apr 23 2014

Hi all,

I have 2 DATABASE blocks

1)emp -->deptno,find button

2)emp1-->taking all rows

I have taken ONLY one canvas FOR the both the blocks emp AND NEXT emp1(UNDER the emp block)

Passing deptno=10 AND click ON the find button it goes TO the emp1 BLOCK AND fetched ALL records IN the emp1 BLOCK

this IS fine.

I want TO pass deptno=60 then, i want TO show thw messages "you should enter lower the deptno"

but i am NOT getting ANY messages.

emp bolck

----------

1)pre-query

    IF To_char(:emp.deptno) > 50 THEN

      Message ('you should enter lower the deptno');

      RAISE form_trigger_failure;

    END IF;

2)FIND Button

go_block('EMP1');

DECLARE

    CURSOR empcur IS

      SELECT *

      FROM   emp

      WHERE  deptno = :EMP.deptno;

BEGIN

    first_record;

    FOR rec IN empcur LOOP

        :EMPNO := rec.empno;

        :ENAME := rec.ename;

        :HireDate := rec.hiredate;

        :Job := rec.job;

        :Sal := rec.sal;

        :Comm := rec.comm;

        :MGR := rec.mgr;

        :emp.deptno := rec.deptno;

        next_record;

    END LOOP;

    first_record;

END;

My Question IS, IF i have more COLUMNS IN the EMP1(Navigational block) what should i DO?

means,FOR ALL the COLUMNS i have TO WRITE LIKE below....(IN the loop) right?

        :EMPNO := rec.empno;

        :ENAME := rec.ename;

        :HireDate := rec.hiredate;

        :Job := rec.job;

         ..

         ..

         ...

         ..

         ...

      etc.

If i am doing wrong so please provide me the correct solution please.

Thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 21 2014
Added on Apr 22 2014
6 comments
5,656 views