Step 1:
To begin, establish a non-database block with
whatever name you like. in my instance, I named it DEMO.
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.
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.
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;
Output:
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.
Thanks for sharing man it's working.
ReplyDelete