Topic: Oracle Certified Professional Exams (OCP & OCA) >> how to declare and use cursors in oracle(D2k)
|
Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property.
You may review the entire Oracle Certification Program Candidate Agreement online Here.
|
|
|
|
| Title: how to declare and use cursors in oracle(D2k) |
| orasab |
Posted: Feb 06, 2008 07:27:26 AM |
Total Post: 9
Joined: Jan, 2008
|
I am trying to retrive number of records from tables and put it into form one row at a time. I am using D2k so i cannot excess number of rows from tables and assign it to text items. I want to access test_id,test_name,unit_id from table test and access unit_desc from unit_mst table and then assign it to a text item in a block called test result. Test result is a table where i have to later save the data i have retrived from tables "TEST" AND "UNIT_DESC".
I need to use cursor so i retrive all the test under test_head and assign one by one to a text_items in D2k.It wont be a problem if single records was displayed at a time but since i have display number of records from two different table and then assign it to another table using form.
I would be very gratefule if someone could help me out be letting me know how is cursor defined and used either in trigger or in procedure.
|
|
|
Mohammed Taj |
| Posted: Feb 06, 2008 07:52:33 AM | |
|
Total Post: 746
Joined: Jul, 2007
|
Did you search anything in google or oracle documentation about cursor.
please come with exact question instead of whole topic.
|
|
|
|
|
lavu |
| Posted: Feb 06, 2008 11:19:16 PM | |
|
Total Post: 3
Joined: Jan, 2008
|
DECLARE
CURSOR C1 IS SELECT TEST_ID,TEST_NAME,UNIT_ID FROM TEST;
CURSOR C2(P_UNIT_ID NUMBER) IS SELCT TEST_DESC FROM UNIT_MASTER WHERE UNIT_ID=P_UNIT_ID;
BEGIN
FOR I IN C1 LOOP
FOR J IN C2 LOOP
:TEXT_ITEM1:=I.TEST_ID;
:TEXT_ITEM2:=I.TEST_NAME;
:TEXT_ITEM3:=I.UNIT_ID;
NEXT_RECORD;
END LOOP;
FIRST_RECORD;
SELECT UNIT_DESC INTO :TEXT_ITEM4 FROM UNIT_MASTER WHERE UNIT_ID=:TEXT_ITEM3;
END;
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |
|
|
|
|
Forum Rules & Description
Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user
|
| |
Get FREE Magazines
|
Top 10 Forum User
|
| Murtuja Khokhar | 857 |
| Mohammed Taj | 746 |
| positive fanatic | 483 |
| Jayanta Sur | 479 |
| Vigyan Kaushik | 386 |
| Vinoth Kumar | 367 |
| Gopu Gopi | 340 |
| Gitesh Trivedi | 322 |
| neeraj sharma | 258 |
| Ramesh Jois | 246 |
|
|