Results 1 to 4 of 4

Thread: Oracle View

  1. #1
    Join Date
    Apr 2012
    Posts
    2

    Unanswered: Oracle View

    Hi, I need to create a view, that identifies orders that take over 14 days to fullfill. I need to compare the completed date to the date the order was made. I also need to include, cust name, order id, placed, completed, and days over due. This is the code i have so far, but not sure how to do the date part, any help would be good thanks:



    create view overdue_order as
    select c_cust_surname "customer_name", oh_order_id "order", oh_order_date "placed_on", oh_order_completed "fulfilled",
    from customer join order_header on customer.c_cust_id = order_header.oh_order_customer
    where oh_order_completed - oh_order_date >14;

  2. #2
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    What exactly is not working?

    And please use [code] tags to format your sql. For details see:
    http://www.dbforums.com/oracle/1031644-guidance-resources-posters.html

  3. #3
    Join Date
    Apr 2012
    Posts
    2
    The code above works, I just need to add extra parts to it so it displays how many days between the day it was ordered an the day it was completed. An if it was over 14days by how many days.

  4. #4
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Quote Originally Posted by ORACLEMAN12345 View Post
    I just need to add extra parts to it so it displays how many days between the day it was ordered an the day it was completed.
    Then add the expression oh_order_completed - oh_order_date to your select list

    An if it was over 14days by how many days.
    Isn't that the same as the above as you are already selecting only those that are over 14days.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •