Solved

Working with oracle  input parameters

Posted on 2003-10-29
3
1,268 Views
Last Modified: 2008-03-06
I am new to oracle
I have a package that has a begindate and enddate and I want to use the begindate to get the value of the enddate eg in mssql enddate = begindate + 1 how do I go about it in oracle? Proc below

CREATE OR REPLACE PACKAGE Del_Times_Reports AS
  -- Author  : GMAYAKA.
  -- Created : 10/22/2003
  -- Purpose : To store procs to access common delivery times reports.

       -- Public type declarations
        TYPE results_cursor IS REF CURSOR;

            -- Public procedure declarations
       
            Procedure DelTimesWeekbyDay (BeginDate IN date,Plant IN number := Null, io_cursor IN OUT results_cursor);



END Del_Times_Reports;
/
CREATE OR REPLACE PACKAGE BODY Del_Times_Reports AS
Procedure DelTimesWeekbyDay (BeginDate IN date,Plant IN number := Null, io_cursor IN OUT results_cursor)
   IS
   -- Returns a list of Delivery Data by Date for an intranet report on delivery confirmation data.
   -- Returns 7 days worth of data, can return for 1 SmartCenter or all.
        v_cursor results_cursor;

   BEGIN
               OPEN v_cursor FOR
            SELECT TO_CHAR(bn_filetime,'MM/DD/YYYY') AS BNManifestDate
        ,count(dcn) as BNManifested
        ,COUNT(dtDSEScanDate) AS DSEScanned
        --,(CASE WHEN count(dtDSEScandate) = 0 THEN null
            --       ELSE cast(COUNT(dtDaysToDeliver)  / COUNT(dtDSEScanDate) * 100 as number(9,2))
            --  END) DeliveryRate
            , DECODE(count(dtDSEScanDate), 0, NULL,
               cast(COUNT(dtDaysToDeliver)  / COUNT(dtDSEScanDate) * 100 as number)) DeliveryRate
             , cast(AVG(dtDaystoDeliver) as number) AvgDaystoDeliver
   FROM Delivery_Time
   WHERE bn_filetime between beginDate AND endDate = begindate  + 1
   AND plantID = NVL(plant, plantID)
GROUP BY TO_CHAR(bn_filetime,'MM/DD/YYYY')
ORDER BY BNManifestDate;

        io_cursor := v_cursor;
   END DelTimesWeekbyDay;


END Del_Times_Reports;
/

setting the enddate in mssql is pretty simple but I don't know a work around in oracle

Thanks in advance
0
Comment
Question by:mwanchi
3 Comments
 
LVL 7

Accepted Solution

by:
Bigfam5 earned 120 total points
ID: 9643980

You can add numbers to any date column,  So if you what endDate to = beginDate +1 in the where clause

WHERE bnfiletime between  beginDate and (beginDate+1)
0
 
LVL 23

Expert Comment

by:seazodiac
ID: 9643991
Same in Oracle. you should be able to use enddate= begindate +1 too.
0
 
LVL 8

Expert Comment

by:Danielzt
ID: 9644029
In Oracle, if you only care about the day (ignore the hours,minutes and seoncds)
you can do like this:

trunc(endDate) = trunc(begindate)  + 1
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now