Solved

Working with oracle  input parameters

Posted on 2003-10-29
3
1,277 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
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 shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

752 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