Solved

Working with oracle  input parameters

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

Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
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.

828 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