Wednesday, January 19, 2022

How to Fetch Data By Using Cursor for loop In Oracle Form

 


Step 1:

To begin, establish a non-database block with whatever name you like. in my instance, I named it DEMO.

How to Fetch Data By Using Cursor for loop In Oracle Form

Step 2:

Create a button with whatever name you like; in my example, I called it FETCH DATA. It is then necessary to go to the property palette and look for Number of items Displayed setting it to 1.

How to Fetch Data By Using Cursor for loop In Oracle Form

Step 3:

Now, go to Smart triggers to right click on the button or shortcut key that you have generated, such as F11. And search WHEN-BUTTON-PRESSED trigger. And hit the enter key.

How to Fetch Data By Using Cursor for loop In Oracle Form

Step 4:

Now copy and paste the code I provided below. I'll walk you through it line by line to show you how it works. Now run the form and pressed the button.

BEGIN

GO_BLOCK('DEMO');

clear_block;

FIRST_RECORD;

                For REC in (select empno, ename, sal from emp)

loop

                  :Demo.empno := REC.empno;

                  :demo.ename:=rec.ename;

                  :demo.sal:=rec.sal;

                  NEXT_RECORD;

                end loop;

END;

How to Fetch Data By Using Cursor for loop In Oracle Form

Output:

How to Fetch Data By Using Cursor for loop In Oracle Form

If you have any problem so download the file to click on "Download".

 I hope it's helpful for you. If you have any queries, don't hesitate to contact me.

Name : Muhammad Sahal Qasim
E-mail : s.m.sahal789@gmail.com
Thank you.

1 comment:

If you have any doubts, please let me know. I will help you.