Cursor to retrieve information.

Hi,
I am using SQllite and I have the following database:
Drop table Orders cascade constraints;
Drop type item_type;
Drop type Item_nested;
Create or Replace Type item_type AS Object (
Cat_code Varchar2(6),
Amount_ord Number(3),
Cost Number(5,2) );
Create or Replace Type item_nested as table of item_type;
Create Table Orders (
Order_no Varchar2(8) constraint pkorder primary key,
Customer_name Varchar2(30),
AddressLine1 Varchar2(20),
AddressLine2 Varchar2(20),
AddressLine3 Varchar2(20),
Town Varchar2(20),
Postcode Varchar2(10),
Country Varchar2(20),
Order_items item_nested,
Order_date Date)
Nested Table Order_items
Store as nested_items return as locator;
From this, I need to write a PL/SQL procedure using a cursor to retrive multiple orders. This by inputting the Cat_code to retrieve Order_no, Amount_ord and cost. Can anyone help as I am unable to write this cursor.
Thanks

I tried using this procedure which did not work
Declare
Type item_nested is table of orders;
Create or Replace Procedure sel_order (catcde in Varchar2)
AS
Cursor c IS select * from item_nested
where Cat_code = Catcde;
BEGINDeclare cursor C is
Select Order_no, Amount_ord, Cost
from Orders
Begin
for c_rec in c loop
DBMS_OUTPUT.PUT_LINE ('Order no is:' || c_rec.Order_no || 'Amount ordered:' || c_rec.Amount_ord || 'Cost is:' || c_rec.cost);
end loop;
end;
Exception
When no_data_found Then
DBMS_OUTPUT.PUT_LINE ('Order does not exist');
when others then
DBMS_OUTPUT.PUT_LINE ('Failed' || 'SQLCODE:'||SQLCODE);
DBMS_OUTPUT.PUT_LINE('Error Message' ||SQLERRM);
Rollback;
End;
I did not put in any code yet as I was trying to figure this out first
Edited by: SG200407 on 18-Jan-2009 06:22

Similar Messages

  • Outlook 2013 Free/Busy can not retrieve information

    Currently have a problem with Outlook 2013 Free/Busy can not retrieve information.
    All windows updates are installed. 
    Exchange 2007 is being used. 
    Problem started last week. 
    Already Tried without any progress:
    1) Recreated profile (Fixed the issue for 1 week)
    2) Cleanfreebusy ( No longer works for outlook 2013)
    3) /Cleanreminders 
    4) Removed latest updates for outlook 10/02( As requested by Microsoft support, however we found users without this update installed, suffering from the problem) 
    5) Repaired OST file 
    6) Repaired Office 2013 
    Can anyone help it would be much appreciated?

    Hi
    As per the information and details provided by you, Outlook 2013 free/busy cannot retrieve information, please follow these steps: -
    The user has never logged in
    Before any free/busy information is available, the user must have at least a calendar. A calendar will not be created until a user logs into their account.
    The option to publish at some location has been enabled in Calendar options
    In all Outlook versions, the option to publish free/busy information must be unchecked. By default, this option is already unchecked.
    This option is located under
    Tools > Options > Preferences > Calendar Options > Free/busy Options.
    Outlook is using cached browser information
    Outlook Free/busy user HTTP, and therefore borrows information cached by Internet Explorer. It is required to clear the offline cache. This is located under
    Tools > Internet Options > General. In the “Temporary Internet Files”  section, choose the
    “ Delete files” button.
    Internet Explorer settings is not correct
    AN Internet Explorer setting may prevent the .ics file from downloading via HTTPS. In Internet Exporer on the Outlook computer, go to
    Tools > Internet Options > Advanced. In the Security section, the checkbox for “Do not save encrypted pages to disk” should be unchecked.
    I hope this information will be helpful for you.
    Thanks and regards
    Shweta@G

  • Installing printer Envy 4500 on MAC OS X.10- set up bar stuck on "retrieving information"- Help!!!

    I bought the HP Envy 4500 because I just upgraded my Mac to OS 10.10 and my office jet would not come along for the ride...  I installed the driver from the HP website and I completed all the steps until the last step "configuation results".
    The window reads "retriving information" and it has been "retrieving information" for 20 minutes.  I have cancelled and gone back twice to no avail.  I printed the practice page and that went fine.  What can I try next?   

    Hi @Elizabetti,
    Welcome to the HP Support Forums! I see you are trying to install your new HP Envy 4500 with your Mac running the Yosemite 10.10 Operating system. When you attempt to install the setup bar stops on 'retrieving information'. You have cancelled it 2 times with no success. I would like you to go ahead and complete the steps listed below:
    Scrub/ Uninstall
    • Open the Applications folder > HP or Hewlett Packard folder > HP Uninstaller
    • Click continue, click on one of the printers in the list.
    • * Only do this step if you do not have any other HP Printers. Hold down Control, Option and Command, While holding the three buttons down,
    • Click uninstall.
    Reset Printing System
    1. Click the Apple icon (   ), and then click System Preferences.
    2. In the Hardware section, click Print & Fax/Scan. The Print & Fax/Scan  dialog box opens.
    3. Right-click (or  Ctrl  +click) in the left panel, and then click Reset printing system…
    4. Click OK to confirm the reset.
    5. Type the correct Name and Password.
    6. Click OK to reset the printing system. The Print & Fax dialog box shows no printer selected
    Note: This will remove all printers in the print and Fax/Scan, any printer removed can be re-added later by clicking the plus (+) symbol..
    Repair Disk Permissions
    1.On the Dock, click Applications, and then click Utilities.
    2.Double-click Disk Utility.
    3.Highlight your hard drive/partition on the left (by default this is "Macintosh HD").
    4.Click the Repair Disk Permissions button at the bottom of the window.
    5.Once the repair is complete, restart the computer.
    Restart the printer. Now you can download and install the printer software and install it. Click on the link below to begin the download and follow the on screen instructions:
    HP ENVY 4500 series Full Feature Software and Drivers
    I hope this helps, please let me know the outcome!
    Thanks,
    HevnLgh
    I work on behalf of HP
    Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" to the left of the reply button to say “Thanks” for helping!

  • HT3275 how can i retrieve information from  time machine if my computer has less storage capacity? How can I access data that is on my time machine but can not be copied to a computer with less storage capacity? I used to have 180 GB, now I have 128 GB.

    how can i retrieve information from  time machine if my computer has less storage capacity? How can I access data that is on my time machine but can not be copied to a computer with less storage capacity? I used to have 180 GB, now I have 128 GB.

    Plug an external drive into the computer and use that to expand data onto.
    http://pondini.org/TM/16.html

  • Retrieving Information

    Hi!
    Anyone has any idea how to retrieve information (contacts, messages etc.) from the phone SIM to the iPhone?

    There is no way as the iPhone does not store any information on the SIM.
    Unless you have a SIM that was used on another phone you can get contacts off the SIM. Settings>>Mail, Contacts>> Import SIM Contacts

  • Retrieve information about the operating system

    Hi, I have an Air application and I need to retrieve
    information such as local IP address, local computer name and
    operating system user. It is possible?
    Thanks,
    Anselmo

    flash.system.Capabilities.os for operating system. IP and
    computer name I don't think you can get in ActionScript. You could
    get IP with a web service, but computer name... no idea, unless
    it's possible to find it in the file system...

  • TS4009 how do you retrieve information after the system has been reset to default

    how do you retrieve information after the system has been reset to default?

    From a backup on itunes or icloud, assuming you have made backups.  Connect to itunes and in the first tab for your device, choose to perform a restore.

  • Cursor query retrieves records in anon pl/sql block but no data in store pr

    Hello,
    Can any one please help me,
    I am using the below query, to get the table name and constraint name
    select table_name,constraint_name
    from all_constraints
    where constraint_type in ('R','P')
    and status = 'ENABLED'
    and owner='IRIS_DATA'
    order by constraint_type desc;
    The below query retrieves data in anonymous pl/sql block and retrieve no data when i use the same cursor with the same query in procedure inside the package.
    CREATE USER CLONEDEV
    IDENTIFIED BY CLONE123
    DEFAULT TABLESPACE IRIS
    TEMPORARY TABLESPACE TEMP;
    GRANT DBA TO CLONEDEV;
    the user from which i am executing this query is granted dba role.
    My oracle version is 10.2.0.4
    Please update if you any other information.
    Please advice.
    Thanks

    >
    Roles cannot be used by pl/sql.
    >
    NOT TRUE!
    That is an oft quoted myth. There are many posts in the forum that mis-state this.
    Roles can be, and are used by PL/SQL. In fact, OP stated and demonstrated that in their question: their anonymous block worked.
    The Oracle docs provide a very clear explanation - the core restriction is for NAMED PL/SQL blocks that use DEFINER's rights (the default):
    >
    Roles Used in Named Blocks with Definer's Rights
    All roles are disabled in any named PL/SQL block (stored procedure, function, or trigger) that executes with definer's rights. Roles are not used for privilege checking and you cannot set roles within a definer's rights procedure.
    >
    The Database Security Guide has the information in the section 'How Roles Work in PL/SQL Blocks (which, of course, wouldln't be needed if they didn't work. ;) )
    http://docs.oracle.com/cd/B28359_01/network.111/b28531/authorization.htm#i1007304
    >
    The use of roles in a PL/SQL block depends on whether it is an anonymous block or a named block (stored procedure, function, or trigger), and whether it executes with definer's rights or invoker's rights.
    Roles Used in Named Blocks with Definer's Rights
    All roles are disabled in any named PL/SQL block (stored procedure, function, or trigger) that executes with definer's rights. Roles are not used for privilege checking and you cannot set roles within a definer's rights procedure.
    The SESSION_ROLES view shows all roles that are currently enabled. If a named PL/SQL block that executes with definer's rights queries SESSION_ROLES, then the query does not return any rows.
    See Also:
    Oracle Database Reference
    Roles Used in Named Blocks with Invoker's Rights and Anonymous PL/SQL Blocks
    Named PL/SQL blocks that execute with invoker's rights and anonymous PL/SQL blocks are executed based on privileges granted through enabled roles. Current roles are used for privilege checking within an invoker's rights PL/SQL block. You can use dynamic SQL to set a role in the session.

  • How to retrieve information from XML using servlets

    Hi
    I have a scenario like this
    File-->XI-->J2ee application(HTTP Receiver adapter)
    I want to know how XI sends xml file as a query string file name?
    What ever may be the case i just need to retrieve the information from Request object and display the same in browser(JSP).How to do that, I am totally confused, please anyone help me!
    Code help is highly rewarded.
    Thanx

    Hi Rajesh!
    I have tried your code. But some where i went wrong. Please correct me: I am using NWDS2.0.9
    my web.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
                             "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
        <display-name>WEB APP</display-name>
        <description>WEB APP description</description>
        <servlet>
            <servlet-name>DisplayRes</servlet-name>
            <servlet-class>com.quinnox.DisplayRes</servlet-class>
        </servlet>
        <servlet-mapping>
              <servlet-name>DisplayRes</servlet-name>
              <url-pattern>/DisplayRes/*</url-pattern>
         </servlet-mapping>
    </web-app>
    my application.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
                                 "http://java.sun.com/dtd/application_1_3.dtd">
    <application>
        <display-name>ReceiverEntpr</display-name>
        <description>EAR description</description>
        <module>
            <web>
                <web-uri>HttpReceiver.war</web-uri>
                <context-root>/HttpReceiver</context-root>
            </web>
        </module>
    </application>
    and my servlet code:
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.PrintWriter;
    import java.io.Writer;
    import javax.servlet.ServletException;
    import javax.servlet.ServletOutputStream;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.InputSource;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Result;
    import javax.xml.transform.Source;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.xml.sax.EntityResolver;
    import org.xml.sax.SAXException;
    import com.sun.java_cup.internal.parser;
    import com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl;
    public class DisplayRes extends HttpServlet {
         public void doGet(HttpServletRequest requset, HttpServletResponse response) throws ServletException, IOException
              doWork(requset, response);
         public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
              doWork(req, resp);
         private void doWork(HttpServletRequest req, HttpServletResponse resp) throws IOException
              String path = null;
              PrintWriter out = null;
              PrintWriter p2=resp.getWriter();     
              try
                   resp.setContentType("text/xml");
                   out = resp.getWriter();
                   out.println("hi");
                   path = req.getPathInfo();
                   if(req.getContentLength() != -1){
                   outputURI(req.getInputStream(), out);
              } catch (IOException ioe) {     return;     
         //private void outputURI(InputStream resultStream, Writer out) {
              private void outputURI(InputStream resultStream, PrintWriter out) {
              if (resultStream == null) {
    //             no default file
    //            logger.error("No File to return");
              return;
              try {
              DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    //            Class clazz = loader.loadClass("org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
    //            DocumentBuilderFactoryImpl factory = (DocumentBuilderFactoryImpl) clazz.newInstance();
    //            DocumentBuilder parser = factory.newDocumentBuilder();
              parser.setEntityResolver(new ClassPathEntityResolver());
              printXML(parser.parse(resultStream), out);
              resultStream.close();
              } catch (Exception e) {
    //            logger.error("Trying to parse the output " , e);
         //private void printXML(Document document, Writer writer) throws Exception {
              private void printXML(Document document, PrintWriter writer) throws Exception {
              Transformer transformer = TransformerFactory.newInstance().newTransformer();
              Source source = new DOMSource(document);
              Result output = new StreamResult(System.out);
              transformer.transform(source, output);
    //             Write as XML so that entity references can be resolved.
              if (writer != null) {
              transformer.transform(source, new StreamResult(writer));
    Please tell me how to display in servlet.
    If it is better to display in a browser. Please send me the code.
    Thanks

  • Unable to retrieve information from the sync server

    This only just started after I updated to the new 3.1 software, which included an update to the Mobile Me control panel. I sure would love to fix it, because the error message pops up every 20 seconds. My phone is syncing with MM and with my PC.Also,i have been ok with retrieving my job bids from http://www.besteventstaff.com since i signed up.Which was over 2 weeks ago but today everything won't load.I contacted the admin at Best Event Staff and hey are telling me they haven't had any other complaints.Pls help me out here.Why has things stopped loading so suddenly?Thanks in advance

    I have notes from my palm days too!  If you haven't resolved this, below there is a "more like this" set of links. One of them lists four solutions to this problem including how I resolved mine. Good luck!
    Re: How do I resolve "unable to retrieve conflict information from the sync server" when syncing with Outlook

  • How to retrieve information on UNIX Host from oracle Forms

    Hi,
    Has anybody tried to retrieve manipulated information
    on the Unix Server From the oracle forms running on a client ?.
    If it is to be done by user exit and calling the pro*c code
    then where should the pro*c code exist ?. on server or on client.
    1. If on server then can that code return the value to form ?.
    2. If on client then can that code access the unix server and
    return the value ?..
    OR
    any other method or tool to do the above.
    Thnaks and regards
    null

    I can only tell you what we've done for our system. We have
    client applications which need to send/recv information from the
    UNIX server (report submission, etc.)
    We have a deamon (written in PRO*C) which runs on the UNIX
    server. This deamon constantly monitors a pipe (using the
    DBMS_PIPE package available with ORACLE 7.1). The client apps.
    send requests through this pipe and wait for the server deamon to
    process the request and send responses down a "return pipe".
    This approach has served us well.
    With ORACLE 8, you can (according to what I've read) link
    external object modules (similar to ORA_FFI on the client), which
    would make these OS specific functions available to the database
    developer via PL/SQL but we're just now looking at ORACLE 8 so I
    have no first hand experience with this.
    gautam (guest) wrote:
    : Hi,
    : Has anybody tried to retrieve manipulated information
    : on the Unix Server From the oracle forms running on a client ?.
    : If it is to be done by user exit and calling the pro*c code
    : then where should the pro*c code exist ?. on server or on
    client.
    : 1. If on server then can that code return the value to form ?.
    : 2. If on client then can that code access the unix server and
    : return the value ?..
    : OR
    : any other method or tool to do the above.
    : Thnaks and regards
    null

  • How do i retrieve information from the JSP into my SELECT statements?

    I need to retrieve the information that is being entered into JSP page.. So that i can use them to do an SQL statement.. but im not very sure if my codes are correct.. Following are my codes.. Pls help.. thx
    MyJSPPage.jsp
    <jsp:useBean id="user" class="user.User" scope="session"/>
    <form name="loanItem" method ="POST" action="user">
    <input type="hidden" name="userID" value="<jsp:getProperty name="user" property="userID"/>">
         <tr><td align=left height="34"> <b> <font size="4">Member ID:</font>
    </b> </td>
              <td height="34">
              <jsp:getProperty name="user" property="userID"/></td>
         </tr>     
    ==================================================================================
    MyManager.java --> this file is where all my SQL statements are ..
    [l]String itemType = session.getParameter("itemType");[l] (--->> is how i retrieve info from the JSP page?)
              if (itemType.equals("Book"))
                   String sqlQuery1 = "select loanDuration from ItemPolicy where itemType ='" + itemType+ "'";
                   System.out.println(sqlQuery1);
                   ItemPolicy itempolicy = null;
                   try {
                        db = new Database();
                        rs = db.readRequest(sqlQuery1);
                        if (rs != null && rs.next()) {
                             itempolicy = new ItemPolicy();
                             itempolicy.setLoanDuration(Integer.parseInt(rs.getString("loanDuration")));
                        db.close();
                   } catch (SQLException se) {
                                  se.printStackTrace();
                                  throw (new UserException("Unable to retrieve from Database!"));
                             } catch (Exception e) {
                                  e.printStackTrace();
                                  throw (new UserException("Unknow error encountered!"));
                   String dueDate = util.getDueDate(itempolicy.getLoanDuration());
              else if (itemType.equals("Magazine"))
    ==================================================================================
    Thanks in advance...

    you should change to request.getParameter("itemType").
    or just System.out.print the itemType to see it got the value.
    Hope it helps.

  • At what point is PL/SQL cursor data retrieved?

    Hi
    This may sound like a silly question but since I am not entirely sure, I thought I'd ask.
    In Oracle PL/SQL, do you know at what stage the query in a cursor is actually executed?
    Is it at the DECLARE stage or when you first OPEN / LOOP on it?
    I suspect upon the OPEN or the LOOP.
    I.e. if I had a cursor declared but did not loop (using FOR .. LOOP) through it for some hours, would the query results be as at the time of declare or as at the time of the OPEN / FOR...LOOP?
    E.g.
    CURSOR invoices
      IS
        SELECT invoice_number
        FROM unpaid_invoices
        WHERE due_date < TRUNC (SYSDATE)
    BEGIN
    -- Some time consuming processing that will take an hour
    -- Start Loop through cursor of invoices.
      <<overdue_invoices>>
      FOR inv IN invoices LOOP
    -- Some processing on the invoice
      END LOOP overdue_invoices;
    END;Would the cursor details for invoices be as at the CURSOR declaration or when the FOR inv... is reached?
    Thanks
    Martin

    When you use a for loop like that it implicitly opens the cursor at the start and closes it at the end of the loop.
    But the SQL query in that cursor is actually "run" when the first implicit or explicit fetch is issued, and retrieves new rows for every subsequent fetch.
    Of course, before rows can be retrieved there needs to be several other tasks.
    There's a good description of the steps of SQL processing in this part of the documentation.
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10471/adfns_sqlproc.htm
    PL/SQL implicitly declares a cursor for all SQL data manipulation statements, including queries that return only one row. For queries that return multiple rows, you can explicitly declare a cursor to process the rows individually.
    A cursor is a handle to a specific private SQL area. In other words, a cursor can be thought of as a name for a specific private SQL area. A PL/SQL cursor variable enables the retrieval of multiple rows from a stored subprogram.Edited by: fsitja on Dec 15, 2009 1:03 AM

  • Retrieving information about the logged in user in Power BI for O365

    I am trying to retrieve the email of the current logged in user so i can pass it into a query to my sql server which then adjusts the data based on who is viewing a power bi dashboard. If anyone knows a way to grab that information or even the url that
    the file has, then i can parse out its location and change my data based on that as well.

    Currently row level security is not supported in Power BI.
    Thanks,
    Sagar K 
    (Blog: http://datamazik.blogspot.in/)

  • In CQ5 How to retrieve information stored provided via dialog and stored in a node of content folder

    Hi,
    I have to get few details in dialog of a component and stored it in node of the content package. how can i retrieve the saved information from the jsp.?
    any help will be helpful.
    Thanks in advance.

    Hi Raja,
    In a component's jsp, assuming <cq:defineObjects> has been called, you can use the properties scripting variable to get the node's properties.
    Have you gone through the tutorial at http://dev.day.com/docs/en/cq/current/developing/components.html#Extending%20the%20Text%20 and%20Image%20Component%20-%20An%20Example ?
    Regards,
    Justin

Maybe you are looking for