Please HELP to retrieve all records in PL/SQL --Still waiting for solution

First of all, I am a PL/SQL beginner. I need help to retrieve all records in PL/SQL from a database (maybe anyone could give me an example). Here is my code, but this code is only able to retrieve one records only. I would like to create a web service by using PL/SQL to view data in a table.
CREATE or REPLACE package body DRIVER_FETCHER as
FUNCTION get_driver(driver_id in VARCHAR2) RETURN driver_rec IS
driver_found tblDrivers%rowtype;
driver_rtn driver_rec;
BEGIN
SELECT *
INTO driver_found
FROM tblDrivers;
WHERE tblDrivers.lngDriverID=driver_id;
driver_rtn := driver_rec
driver_found.lngDriverID,
driver_found.strTitle,
driver_found.strFirstName,
driver_found.strLastName,
driver_found.dteDOB,
driver_found.dteDateLicensed,
driver_found.strLicenseReference,
driver_found.strAddress_Street,
driver_found.strAddress_TownVillage,
driver_found.strAddress_Country,
driver_found.strAddress_PostCode,
driver_found.strContactDayPhone,
driver_found.strContactNightPhone
RETURN driver_rtn;
END;
END;
and here is the tblDrivers table
CREATE or REPLACE type DRIVER_REC as object
lngDriverID varchar2(10),
strTitle varchar2(5),
strFirstName varchar2(20),
strLastName varchar2(20),
dteDOB date,
dteDateLicensed date,
strLicenseReference varchar2(30),
strAddress_Street varchar2(50),
strAddress_TownVillage varchar2(20),
strAddress_Country varchar2(15),
strAddress_PostCode varchar2(10),
strContactDayPhone varchar2(20),
strContactNightPhone varchar2(20)
CREATE or REPLACE package DRIVER_FETCHER as
FUNCTION get_driver(driver_id IN VARCHAR2) RETURN driver_rec;
END;
Thank You,
Paul
Message was edited by:
user452391
Message was edited by:
user452391
Message was edited by:
user452391

Hi,
you will enjoy reading
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/toc.htm
for a fundamental understanding of PL/SQL.
You can do a "select * from t;" only in SQL, not in PL/SQL. There you have to open a cursor and fetch the results into a variable, e.g.:
declare
cursor c_example
is
   select * from emp;
begin
   for r_example in c_example loop
       dbms_output.put_line(r_example.empno);
   end loop;
end;This is an explicit cursor, opened within an "cursor for"-loop. The results are fetched into a (implicitly declared) record "r_example". The record now holds the values of one row from the emp table. The loop ends when all record from emp where fetched.
Regards,
Gerd

Similar Messages

  • I have an iPod Nano that is synced to my mac, but it is sent in for the battery issue. Anyway, I have bought a 2nd gerneration Ipod touch and I want to now sync it to my mac, but it does not show up in the left menu bar. Please help. Thanks All!

    I have an iPod Nano that is synced to my mac, but it is sent in for the battery issue. Anyway, I have bought a 2nd gerneration Ipod touch and I want to now sync it to my mac, but it does not show up in the left menu bar. Please help. Thanks All!

    http://support.apple.com/kb/TS1591
    There have been some problems accessing pages on the Apple web site.  If the hyperlink gives you a "We're sorry" message, try again.

  • My all contacts are available after switching to iCloud from Mobileme.  Please help to restore all my contacts.

    I switched from Mobileme to iCloud last night.
    My iphone show all contacts properly.
    But, I can't see any of contacts from my Mac and pc.
    My all contacts are gone.
    Please helpe to restore all my contacts.
    I sync my ipone and mac.
    Thanks,
    dolphin

    Your signature says you have 10.6.2: is this correct? Lion 10.7.2 is required for syncing with iCloud - you cannot sync your contacts on 10.6.2. All you can do is go to http://icloud.com , select Contacts, click the top contact and then the bottom one while holding the shift key to select them all; click on the cogwheel at bottom left and choose 'Exort vCard'.
    Then go to Address Book on your Mac, from the File menu choose 'Import' and select your vCard. This will restore the contacts to your Mac but they will not sync with iCloud.

  • Personnel Admin AdHoc Query not retrieving all records

    Hi, I recently added a custom info type to a copy of the SAP ad hoc query for Personnel Admin by using the menu path in SQ02>Edit>Change Infotype selection . The query is picking up the new info type and runs fine but does not retrieve all records from the table for a given personnel id. It only retrieves 1 record per id.
    Has anyone dealt with this before and have an easy/quick fix for this?

    Have other users try the query, preferably a user with end user authorization.
    I've had this issue before, I'm an IT person and I customized a Standard infoset.
    During testing, I'm only getting 1 (in my case) Insurance record per employee.
    The end user can see multiple record per employee.
    Btw, did you customize a Global or a Standard Infoset?
    Regards,
    Olekan

  • HT5622 I lost all my pictures! Please help:( I added all my photo to a new album from the camera roll and i delete the picture that already move to new album, at last all my picture was gone !:'( Please, anyway to recover back all my photo? please help :'

    I lost all my pictures! Please help:( I added all my photo to a new album from the camera roll and i delete the picture that already move to new album, at last all my picture was gone !:'( Please, anyway to recover back all my photo? please help :'( Apple Service Center or Branch can help?

    Albums is a way or sorting photos. Photos aren't moved from the Camera roll. The Camera Roll consists of all the photos on the phone. If you delete from Camera Roll they are deleted everywhere but Photo Stream.
    Are you using Photo Stream? Your photos, providing they wer recent should still be in Photo Stream. If you have Photo Stream set up on your computer they should all be there.

  • Please help me retrieve my security questions answer. I forgot my security questions answer.

    Please help me retrieve my security questions answer. I forgot my security questions answer.

    If you have a rescue email address (which is not the same thing as an alternate email address) set up on your account then you can go to https://appleid.apple.com/ and click 'Manage your Apple ID' on the right-hand side of that page and log into your account. Then click on 'Password and Security' on the left-hand side of that page and on the right-hand side you should see an option to send security question reset info to your rescue email address.
    If you don't have a rescue email address (you won't be able to add one until you can answer 2 of your questions) then see if this user tip helps : https://discussions.apple.com/docs/DOC-4551
    e.g. you can try contacting iTunes Support : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Account Management , and then try Apple ID Account Security
    or try ringing Apple in your country and ask to talk to the Accounts Security Team : http://support.apple.com/kb/HE57
    When they've been reset, and if you don't already have a rescue email address,  you can then use the steps half-way down this page to add a rescue email address for potential future use : http://support.apple.com/kb/HT5312

  • HT203167 Hi. 2 days ago I bought a cd ATB. And yesterday I deleted everything from iTunes. Please help in recovering all purchased cd

    Hi. 2 days ago I bought a cd ATB. And yesterday I deleted everything from iTunes. Please help in recovering all purchased cd

    Did you just delete them from iTunes, or did you also tell it to delete the music files from your Mac ? If just from iTunes then they might still be stored under /Users/username/Music - if they are then you can add them back via File > Add To Library
    If not, then whether you can redownload music depends upon what country that you are in. If you can redownload music (and if you haven't changed countries since buying it and it's still in your country's store) then it should show under the Purchased link under Quicklinks on the right-hand side of the iTunes store homepage :
    If you can't redownload music then do you have a copy of it on your backup of your downloads/library that you can copy it back from ?

  • Please Help!   I've got a WRT54GX2 that I used for 2 year...

    Please Help!
    I've got a WRT54GX2 that I used for 2 years with no problems.
    I recently tried to set up network with different IP DSL (Bellsouth).
    The problem is the computer can not "locate" wireless router. Is this due to the Westell modem not being "bridged".   

    ***Note: Make sure that the modem is Bridged and the router is set-up to the Instructions I first gave you. If you still have the issue then follow the below steps. At this point you should find out what is your,
    IP Address =
    Default Gateway =
    Subnet mask =
    and provide us with that information.
    You can get this info by clicking on Start>>Run>>type "cmd">>click ok, now a black command prompt box will open, type in ipconfig /all
    You should see an IP address and default gateway of 192.168.x.xxx
    you should see a subnet mask of 255.255.255.0
    At this time you should power cycle your router and then the modem by removing the power cable from the router, then remove the power cable from the modem. Wait about 60 seconds and plug in the modem and them plug in your router. wait till all the lights on the modem and router are back on. try to connect.
    If it still does not work and the IP address is not what I stated, then you will need to reset the modem by holding in the reset button on back of the router for 30 seconds, this will bring the router back to the factory defaults and will remove any prior settings.
    Good Luck,
    Ttech
    Message Edited by Ttech on 06-30-2008 05:38 AM

  • Please help me to get Oracle 10.2.0.5 software for 64 bit Windows 2008 R2

    Hi All,
    Subject: Please help me to get Oracle 10.2.0.5 software for 64 bit Windows 2008 R2 operating system.
    I am looking for Oracle 10.2.0.5 software to install in windows 2008 server (64 bit) R2. I tried with oracle download repository but unfortunately I couldnt find this software. In the below link I can see the product Oracle 10.2.0.5 - 64 bit (Itanium). I have tried to download and install in the server but I received in-compatible error message.
    http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
    From the oracle support certification site I have found that the Oracle 10.2.0.5 is the compatible version to installed in windows 2008 server(64) R2.
    I am trying very hard to find Oracle 10.2.0.5 - 64 bit. Can you please suggest me where I can download this software.
    Please do the needful.
    Regards,
    Jame

    Hi;
    Which means, do i need to install 10.2.0.4 and then to upgrade 10.2.0.5 using patchset?10.2.0.1 is base relase 10.2.0.x is patchest. 10.2.0.5 cover previous patchest errors which mean you do not need install 10.2.0.4 than upgrade it 10.2.0.5
    Regard
    Helios

  • TS1368 I am recieving the following message when attempting to sign into my iTunes store - An unknown error has occurred. can someone please help me I have reset my password but still unable to log in. help!!

    I am recieving the following message when attempting to sign into my iTunes store - An unknown error has occurred. can someone please help me I have reset my password but still unable to log in. help!!

    I am recieving the following message when attempting to sign into my iTunes store - An unknown error has occurred. can someone please help me I have reset my password but still unable to log in. help!!

  • I drop my phone so i got a new one and back up everything... well now i have pics on my phone that i dont want and i cant delete them please help i tired hooking up to iTunes but still cant delete certain ones

    i drop my phone so i got a new one and back up everything... well now i have pics on my phone that i dont want and i cant delete them please help i tired hooking up to iTunes but still cant delete certain ones.... i can send them or post but nothing to delete them

    The pictures that are on your phone, that you don't want, did they appear there after syncing with iTunes? Or were they taken with the iphone's camera?
    Pictures synced from iTunes have to be removed by syncing again, but not having those pictures checked under the Photos tab in iTunes.

  • Hi my ipad air wont charge unless its turnt off please help i just boght a new charger it still wont work

    hi my ipad air wont charge unless its turnt off please help i just boght a new charger it still wont work

    Hi When  you change your iPad, even if its off it will, turn on when you connect, to charger Check  lightining port for any bits. Do a Reboot press &hold power button & menu button hold both down until you see Apple Logo This may help. Cheers Brian

  • Hi, last month i bought the ms bundle knowing it would help me with my office works..but didnt seem to work as i thought please help me with this, i didnt pay 51 singapore dollar for nothing please get me back asap

    Hi, last month i bought the ms bundle knowing it would help me with my office works..but didnt seem to work as i thought please help me with this, i didnt pay 51 singapore dollar for nothing please get me back asap

    Does the iPod connect to other networks?
    If you restored to factory settings/new iPod and still does not connect to any network that indicates a hardware problem.
    If you only can't connect to your network that indicates a problem with your network.
    Make an appointment at the Genius Bar of an Apple store..
    Apple Retail Store - Genius Bar

  • Please help if you can: I accidentally deleted the IPOD app for my IPAD 3. I need it to enable HOME SHARING. How can I restore or reinstall it? It is not an app I bought, it came on the IPAD from Apple.

    Please help if you can: I accidentally deleted the IPOD app for my IPAD 3. I need it to enable HOME SHARING. How can I restore or reinstall it? It is not an app I bought, it came on the IPAD from Apple

    See These Support Articles for Home Sharing
    Understanding  >  http://support.apple.com/kb/HT3819
    How to  >  http://support.apple.com/kb/HT2688
    Troubleshooting  >  http://support.apple.com/kb/TS2972

  • Please help! i have just upgraded to an iphone 5 for work, so i have started to backup my iphone 4 but it is stuck on 'finishing sync' and has been for 20hours!what can i do?i need it for work tomorrow

    please help! i have just upgraded to an iphone 5 for work, so i have started to backup my iphone 4 but it is stuck on 'finishing sync' and has been for 20hours!what can i do?i need it for work tomorrow

    Is this what you downloaded: iTunes 10.7?
    When the update fails what if any error report do you get, specifically? Please do this before trying again:
    Repair the Hard Drive and Permissions
    Boot from your Snow Leopard Installer disc. After the installer loads select your language and click on the Continue button. When the menu bar appears select Disk Utility from the Utilities menu. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the installer.
    If DU reports errors it cannot fix, then you will need Disk Warrior and/or Tech Tool Pro to repair the drive. If you don't have either of them or if neither of them can fix the drive, then you will need to reformat the drive and reinstall OS X.

Maybe you are looking for