Solved

Working with oracle  input parameters

Posted on 2003-10-29
3
1,273 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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
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 shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

776 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