Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

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

  




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 Khokhar857
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Vinoth Kumar367
  Gopu Gopi340
  Gitesh Trivedi322
  neeraj sharma258
  Ramesh Jois246






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software