Calendar Table Population

Hi
I need to populate a calendar table with two fields date(for 10 yrs) and Holiday Flag.Holiday flag will be Y if its saturday and Sunday and N for weekdays.
Can anyone please provide me with the script to populate the table.
Thanks

Hi Jameel,
Well, when I said version dependant, the result can differ :
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.7.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.7.0 - Production
SQL> select sysdate+rownum,
  2  decode(to_char(sysdate+rownum,'Dy'),'Sat','Y','Sun','Y','N')
  3  from dual connect by level<=10;
SYSDATE+ D
11/06/06 Y
=================================================
  1  select sysdate+rownum,
  2  decode(to_char(sysdate+rownum,'Dy'),'Sat','Y','Sun','Y','N')
  3* from dual connect by level<=10
SCOTT@demo102> /
SYSDATE+ D
11/06/06 Y
12/06/06 N
13/06/06 N
14/06/06 N
15/06/06 N
16/06/06 N
17/06/06 Y
18/06/06 Y
19/06/06 N
20/06/06 N
10 rows selected.
SCOTT@demo102> select * from v$version where rownum=1;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Prod
SCOTT@demo102> Without said about 10.1.0.2 (which I don't have) which give 11 rows with the same query above (see Re: Cube Function
All these facts said me that we have to use others ways like pipelined (as showed the link I gave above) or dimension...
Nicolas.

Similar Messages

  • SQL Query to calculate on-time dispatch with a calendar table

    Hi Guys,
    I have a query (view) to calculate orders' fulfillment leadtimes.
    The current criteria exclude week-ends but not bank holidays therefore I have created a calendar table with a column name
    isBusinessDay but I don't know how to best use this table to calculate the On-Time metric. I have been looking everywhere but so far I have been unable to solve my problem.
    Please find below the current calculation for the On-Time Column:
    SELECT
    Week#
    , ClntGroup
    , CORD_DocumentCode
    , DESP_DocumentCode
    , Cord_Lines --#lines ordered
    , CORD_Qty --total units orderd
    , DESP_Lines --#lines dispatched
    , DESP_Qty --total units dispatched
    , Status
    , d_status
    , OpenDate --order open date
    , DateDue
    , DESP_PostedDate --order dispatched date
    , DocType
    , [Lead times1]
    , [Lead times2]
    , InFxO
    , OnTime
    , InFxO + OnTime AS InFullAndOneTime
    , SLADue
    FROM (
    SELECT
    DATEPART(WEEK, d.DateOpn) AS Week#
    , Clients.CustCateg
    , Clients.ClntGroup
    , d.DocumentCode AS CORD_DocumentCode
    , CDSPDocs.DocumentCode AS DESP_DocumentCode
    , COUNT(CORDLines.Qnty) AS Cord_Lines
    , SUM(CORDLines.Qnty) AS CORD_Qty
    , COUNT(CDSPLines.Qnty) AS DESP_Lines
    , SUM(CDSPLines.Qnty) AS DESP_Qty
    , CDSPLines.Status
    , d.Status AS d_status
    , d.OpenDate
    , d.DateDue
    , CDSPDocs.PostDate AS DESP_PostedDate
    , d.DocType
    , DATEDIFF(DAY, d.OpenDate, d.DateDue) AS [Lead times1]
    , DATEDIFF(DAY, d.OpenDate, CDSPDocs.PostDate) AS [Lead times2]
    , CASE WHEN SUM(CORDLines.Qnty) = SUM(CDSPLines.Qnty) THEN 1 ELSE 0 END AS InFxO --in-full
    --On-Time by order according to Despatch SLAs
    , CASE
    WHEN Clients.ClntGroup IN ('Local Market', 'Web Sales', 'Mail Order')
    AND (DATEDIFF(DAY, d.OpenDate, CDSPDocs.PostDate) - (DATEDIFF(WEEK, d.OpenDate, CDSPDocs.PostDate) * 2 ) <= 2)
    THEN 1
    WHEN Clients.ClntGroup IN ('Export Market', 'Export Market - USA')
    AND (DATEDIFF(DAY, d.OpenDate, CDSPDocs.PostDate) - (DATEDIFF(WEEK, d.OpenDate, CDSPDocs.PostDate) * 2) <= 14)
    THEN 1
    WHEN Clients.ClntGroup = 'Export Market' OR Clients.CustCateg = 'UK Transfer'
    AND d.DateDue >= CDSPDocs.PostDate
    THEN 1
    ELSE 0
    END AS OnTime
    --SLA Due (as a control)
    , CASE
    WHEN Clients.ClntGroup IN ('Local Market', 'Web Sales','Mail Order') AND CDSPDocs.PostDate is Null
    THEN DATEADD(DAY, 2 , d.OpenDate)
    WHEN Clients.ClntGroup IN ('Export Market', 'Export Market - UK', 'Export Market - USA') OR (Clients.CustCateg = 'UK Transfer')
    AND CDSPDocs.PostDate IS NULL
    THEN DATEADD (DAY, 14 , d.OpenDate)
    ELSE CDSPDocs.PostDate
    END AS SLADue
    FROM dbo.Documents AS d
    INNER JOIN dbo.Clients
    ON d.ObjectID = dbo.Clients.ClntID
    AND Clients.ClientName NOT in ('Samples - Free / Give-aways')
    LEFT OUTER JOIN dbo.DocumentsLines AS CORDLines
    ON d.DocID = CORDLines.DocID
    AND CORDLines.TrnType = 'L'
    LEFT OUTER JOIN dbo.DocumentsLines AS CDSPLines
    ON CORDLines.TranID = CDSPLines.SourceID
    AND CDSPLines.TrnType = 'L'
    AND (CDSPLines.Status = 'Posted' OR CDSPLines.Status = 'Closed')
    LEFT OUTER JOIN dbo.Documents AS CDSPDocs
    ON CDSPLines.DocID = CDSPDocs.DocID
    LEFT OUTER JOIN DimDate
    ON dimdate.[Date] = d.OpenDate
    WHERE
    d.DocType IN ('CASW', 'CORD', 'MORD')
    AND CORDLines.LneType NOT IN ('Fght', 'MANF', 'Stor','PACK', 'EXPS')
    AND CORDLines.LneType IS NOT NULL
    AND d.DateDue <= CONVERT(date, GETDATE(), 101)
    GROUP BY
    d.DateOpn
    ,d.DocumentCode
    ,Clients.CustCateg
    ,CDSPDocs.DocumentCode
    ,d.Status
    ,d.DocType
    ,d.OpenDate
    ,d.DateReq
    ,CDSPDocs.PostDate
    ,CDSPLines.Status
    ,Clients.ClntGroup
    ,d.DocumentName
    ,d.DateDue
    ,d.DateOpn
    ) AS derived_table
    Please find below the DimDate table
    FullDateNZ HolidayNZ IsHolidayNZ IsBusinessDay
    24/12/2014 NULL 0 1
    25/12/2014 Christmas Day 1 0
    26/12/2014 Boxing Day 1 0
    27/12/2014 NULL 0 0
    28/12/2014 NULL 0 0
    29/12/2014 NULL 0 1
    30/12/2014 NULL 0 1
    31/12/2014 NULL 0 1
    1/01/2015 New Year's Day 1 0
    2/01/2015 Day after New Year's 1 0
    3/01/2015 NULL 0 0
    4/01/2015 NULL 0 0
    5/01/2015 NULL 0 1
    6/01/2015 NULL 0 1
    This is what I get from the query:
    Week# ClntGroup CORD_DocumentCode OpenDate DESP_PostedDate OnTime
    52 Web Sales 123456 24/12/2014 29/12/2014 0
    52 Web Sales 123457 24/12/2014 30/12/2014 0
    52 Web Sales 123458 24/12/2014 29/12/2014 0
    52 Local Market 123459 24/12/2014 29/12/2014 0
    1 Web Sale 123460 31/12/2014 5/01/2015 0
    1 Local Market 123461 31/12/2014 6/01/2015 0
    As the difference between the dispatched and open date is 2 business days or less, the result I expect is this:
    Week# ClntGroup CORD_DocumentCode OpenDate DESP_PostedDate OnTime
    52 Web Sales 123456 24/12/2014 29/12/2014 1
    52 Web Sales 123457 24/12/2014 30/12/2014 1
    52 Web Sales 123458 24/12/2014 29/12/2014 1
    52 Local Market 123459 24/12/2014 29/12/2014 1
    1 Web Sale 123460 31/12/2014 5/01/2015 1
    1 Local Market 123461 31/12/2014 6/01/2015 1
    I am using SQL Server 2012
    Thanks
    Eric

    >> The current criteria exclude week-ends but not bank holidays therefore I have created a calendar table with a column name “isBusinessDay” but I don't know how to best use this table to calculate the On-Time metric. <<
    The Julian business day is a good trick. Number the days from whenever your calendar starts and repeat a number for a weekend or company holiday.
    CREATE TABLE Calendar
    (cal__date date NOT NULL PRIMARY KEY, 
     julian_business_nbr INTEGER NOT NULL, 
    INSERT INTO Calendar 
    VALUES ('2007-04-05', 42), 
     ('2007-04-06', 43), -- good Friday 
     ('2007-04-07', 43), 
     ('2007-04-08', 43), -- Easter Sunday 
     ('2007-04-09', 44), 
     ('2007-04-10', 45); --Tuesday
    To compute the business days from Thursday of this week to next
     Tuesdays:
    SELECT (C2.julian_business_nbr - C1.julian_business_nbr)
     FROM Calendar AS C1, Calendar AS C2
     WHERE C1.cal__date = '2007-04-05',
     AND C2.cal__date = '2007-04-10'; 
    We do not use flags in SQL; that was assembly language. I see from your code that you are still in a 1960's mindset. You used camelCase for a column name! It makes the eyes jump and screws up maintaining code; read the literature. 
    The “#” is illegal in ANSI/ISO Standard SQL and most other ISO Standards. You are writing 1970's Sybase dialect SQL! The rest of the code is a mess. 
    The one column per line, flush left and leading comma layout tells me you used punch cards when you were learning programming; me too! We did wrote that crap because a card had only 80 columns and uppercase only IBM 027 character sets. STOP IT, it make you
    look stupid in 2015. 
    You should follow ISO-11179 rules for naming data elements. You failed. You believe that “status” is a precise, context independent data element name! NO! 
    You should follow ISO-8601 rules for displaying temporal data. But you used a horrible local dialect. WHY?? The “yyyy-mm-dd” is the only format in ANSI/ISO Standard SQL. And it is one of the most common standards embedded in ISO standards. Then you used crap
    like “6/01/2015” which is varying length and ambiguous that might be “2015-06-01” or “2015-01-06” as well as not using dashes. 
    We need to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. 
    And you need to read and download the PDF for: 
    https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
    >> Please find below the current calculation for the On-Time Column: <<
    “No matter how far you have gone down the wrong road, turn around”
     -- Turkish proverb
    Can you throw out this mess and start over? If you do not, then be ready to have performance got to hell? You will have no maintainable code that has to be kludged like you are doing now? In a good schema an OUTER JOIN is rare, but you have more of them in
    ONE statement than I have seen in entire major corporation databases.
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Creating Fiscal/Calendar Table

    Hello,
    Please, help to create a Fiscal and Calendar table with the following conditions:
    The table and the first fiscal year start from 01/31/2011
    The end date could be 12/31/2020 (not that important as it could be a smaller date)
    All the next fiscal years should start 52 weeks after on the following Monday.
    I’m trying to modify the following code that is calculating the beginning of the fiscal year with 52 weeks ahead but with following Monday only for the first next Fiscal Year.
    Thanks
    DECLARE
    @StartDate smalldatetime
    = '01/31/2011'
    --First Calendar date to include in table
    DECLARE
    @EndDate smalldatetime
    = '12/31/2020'
    --Last calendar date to include in the table
    declare
    @FiscalYearBegin_First smalldatetime
    = '1/31/2011'
    DECLARE
    @Cycle INT
    = 52
    SET
    DATEFIRST 7
     ;WITH
    --This secton generates the number table
    E00(N)
    AS (SELECT 1
    UNION ALL
    SELECT 1),
    E02(N)
    AS (SELECT 1
    FROM E00
    a, E00
    b),
    E04(N)
    AS (SELECT 1
    FROM E02
    a, E02
    b),
    E08(N)
    AS (SELECT 1
    FROM E04
    a, E04
    b),
    E16(N)
    AS (SELECT 1
    FROM E08
    a, E08
    b),
    E32(N)
    AS (SELECT 1
    FROM E16
    a, E16
    b),
    cteTally(N)
    AS (SELECT
    ROW_NUMBER()
    OVER (ORDER
    BY N)
    FROM E32),
    --This CTE generates a list of calendar dates
    CalendarBase
    as (
     SELECT
    DateKey =
    n
    , CalendarDate
    = DATEADD(day,
    n -1,
    @StartDate )
    case when n
    = 1 then
    @FiscalYearBegin_First 
    else
    case when
    datepart(dw,DATEADD(DAY,
    n -1
    , @StartDate ))
    = 2 then 
    dateadd(week,CAST(ABS(DATEDIFF(WEEK,DATEADD(day,
    n -1
    , @StartDate ),@StartDate))/@Cycle
    AS INT)
    * @Cycle,@FiscalYearBegin_First)
    else
    dateadd(week,
    datediff(week, 0,
    dateadd(week,CAST(ABS(DATEDIFF(WEEK,DATEADD(day,
    n - 1,
    @StartDate ),@StartDate))/@Cycle
    AS INT)
    * @Cycle,@FiscalYearBegin_First)), 7)
    end
    end FiscalYearBegin
    FROM cteTally
      WHERE
    N <=
    DATEDIFF(day,
    @StartDate ,
    @EndDate +1)
    --Finally, use the list of calendar dates to fill the date dimension
    SELECT
    DateKey
    , IsoDate      
    = CONVERT(char(8),
    CalendarDate, 112)
    , CalendarDate
    , CalendarYear 
    = YEAR(CalendarDate)
    , CalendarQuarter
    =  (DATEPART(QUARTER,CalendarDate)
    , CalendarMonth
    = MONTH(CalendarDate)
    , CalendarDay  
    = DATEPART(DAY,
    CalendarDate)
    , DayofWk      
    = DATEPART(Dw,
    CalendarDate)
    , CalendarWeekOfMonth
    = DATEDIFF(week,
    DATEADD(day,1,
    CalendarDate-DAY(CalendarDate)
    + 1)
    -1, CalendarDate)
    +1
    , WeekofYr     
    = DATEPART(WEEK,
    CalendarDate)
    , DayofYr      
    = DATEPART(DAYOFYEAR,
    CalendarDate)
    , NameMonth    
    = DATENAME(Month,
    CalendarDate)
    , NameDay      
    = DATENAME
    (Weekday,CalendarDate
    , FiscalYear   
    = YEAR(FiscalYearBegin)
    , FiscalMonth   
    = DATEDIFF(
    MONTH,
    FiscalYearBegin,
    CalendarDate) + 1
    , FiscalQuarter  
    = DATEDIFF(
    QUARTER,
    FiscalYearBegin,
    CalendarDate) + 1
    , FiscalWeek    
    = DATEDIFF(
    WEEK,
    FiscalYearBegin,
    CalendarDate) + 1
    , FiscalDay     
    = DATEDIFF(
    day,
    FiscalYearBegin,
    CalendarDate) + 1
    FROM
    CalendarBase

    Try the below code if this meets your requirement.
    DECLARE @StartDate DATETIME = '01-31-2011'
    ,@EndDate DATETIME = '12-31-2020'
    ;WITH cteCalendar (CurrentDate,WeekDay,DayNum,WeekNum)
    AS
    (SELECT @StartDate AS CurrentDate, DATENAME(WEEKDAY,@StartDate) AS WeekDay, 1 AS MonthCode, 1 AS WeekNum
    UNION ALL
    SELECT DATEADD(DD,1,cte.CurrentDate) AS CurrentDate, DATENAME(WEEKDAY,DATEADD(DD,1,cte.CurrentDate)) AS WeekDay, cte.DayNum + 1 AS DayNum
    , cte.DayNum / 7 + 1 as WeekNum
    FROM cteCalendar cte
    WHERE cte.CurrentDate + 1 <= @EndDate
    SELECT CurrentDate,WeekDay
    ,CASE WHEN WeekNum%52 = 0 THEN 52
    ELSE WeekNum%52 END AS WeekNumber
    ,DATEPART(YY,@StartDate) + (WeekNum - 1)/52 AS FiscalYear
    FROM cteCalendar
    OPTION (MAXRECURSION 0)
    Only year condition was mentioned and you didn't mention about month, so i did not consider month in the result set. If month is also required, share the condition (30Days in a month or 4Weeks in month?)
    Let me know if i got you wrong.

  • How to find the list of all tables populated

    How to find the list of tables populated in the implentation of a particular company. DD02L contains all the tables SAP having. But i want only which are configured for a particular company.
    Also how to find the list of reports used by all users in a particular company. TSTC contains all transactions. But i require only reports used by a particular company.

    Hi Mohamed
    You use Solution Manager to do the comparison for you.  There are some nice features that will highlight all your customised coding.  Have a look at the SolMan resources on the Support Portal e.g. using SolMan for upgrade comparisons.
    Rgards
    Carl.

  • Saving and passing SelectOneChoice Values for af: table population

    Hey yall.
    *First things first... I am using the EJB as opposed to ADF BC so any examples involving VO's would not help me at this point and that's pretty much all I have been able to find online when searching for help.  I am using JDev version 10.1.3.1.
    Im having some trouble trying to figure out how to program my command button to return a table using the values acquired from a set of 3 dynamic LOV's. In detail, this is what I'm trying to do but can't get it to work no matter what I do:
    1. I have a page where the user must select an option from each drop down list (there are 3 in all). The 2nd list depends on the 1st and the 3rd list depends on the 1st and 2nd. That part is working fine.
    2. Once all selections are made, the user must then click on execute (my command button on page) to then be taken to another page with a table populated using the values selected in the previous page. The table was created using a method from the data control palette that contains the named queries needed to return results in the table.
    3. My problem is figuring out how to wire the execute button to do the tasks mention in #2 above.
    Any suggestions? Ideas? Help?
    Greatly appreciative... Thanks.

    Hi,
    you can do this from the UI using createWithParams
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/13-create-with-params-169140.pdf
    Or by overriding the doDML on the parent EO so you can use an association to update the child records. And of course you could use view links similar. However, the update is recognized on the entity level. And finally, another option - if the tables are not loaded together in an application, is to use a database trigger
    Frank

  • Split date range without Calendar table

    Hi guys!
    Is there any way to split date ranges (to days / hours / minutes) in one table without using Calendar table (without joining 2 tables)?
    Reason I'm asking this is because we have a huge Fact table (500+ million records) and joining small Calendar table and this huge Fact table takes considerable amount of time.
    So far we tried:
    Join 2 tables (Fact and Calendar)
    Cross Applying Calendar and table-valued function (that returns necessary measures from Fact table)
    and both approaches took few minutes for 1 day to complete.
    Most successful test we had so far was using CLR and executing table-valued functions in parallel for different 15 minute periods. This way we were able to get the results in 3-4 seconds.
    Anyway, is there any effective pure T-SQL way to accomplish this?
    Thanks in advance,
    Miljan

    Try using a temporary table rather than table variable.. You can have a CI on the date column.
    or
    declare @PeriodStart datetime2(0) = '2013-01-05 00:00:00'
    declare @PeriodEnd datetime2(0) = '2013-01-05 02:00:00'
    select T.PeriodStart, T.PeriodEnd, count(Column1)as count1, sum(Column2)as sum1
    from Fact F with(nolock)WHERE F.[Start]>= '19000101' AND <=@PeriodStartand F.[End] >= @PeriodEnd and F.[End] <='20200101'
    group by T.PeriodStart, T.PeriodEnd
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • MTD,YTD,PTD without calendar table

              QTY
          Month
          Year
    QTY_YTD
    QTY_MTD
    QTY_PTD
    10
    1
    2010
    20
    2
    2010
    20
    1
    2012
    30
    3
    2012
    Above is how my table looks like and  all are having integer datatypes
    I dont have a calendar table to join hence without calendar table can I compute YTD,MTD,PTD?
    If so what will be the case queries
    Mudassar

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
    use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. 
    Since SQL is a database language, we prefer to do look ups and not calculations. They can be optimized while temporal math messes up optimization. A useful idiom is a report period calendar that everyone uses so there is no way to get disagreements in the DML.
    The report period table gives a name to a range of dates that is common to the entire enterprise. 
    CREATE TABLE Something_Report_Periods
    (something_report_name CHAR(10) NOT NULL PRIMARY KEY
       CHECK (something_report_name LIKE <pattern>),
     something_report_start_date DATE NOT NULL,
     something_report_end_date DATE NOT NULL,
      CONSTRAINT date_ordering
        CHECK (something_report_start_date <= something_report_end_date),
    etc);
    These report periods can overlap or have gaps. I like the MySQL convention of using double zeroes for months and years, That is 'yyyy-mm-00' for a month within a year and 'yyyy-00-00' for the whole year. The advantages are that it will sort with the ISO-8601
    data format required by Standard SQL and it is language independent. The pattern for validation is '[12][0-9][0-9][0-9]-00-00' and '[12][0-9][0-9][0-9]-[01][0-9]-00'
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Date & Calendar table

    Hi
    I have a table with entries that have a date attribute i want to know which dates were not entered for a specific period
    Is there a predefined calendar table?
    Thanks

    Here's an example of the sort of thing you can do...
    SQL> ed
    Wrote file afiedt.buf
      1  with cal as (select min_hiredate+rn-1 as dt
      2               from (select min(hiredate) min_hiredate from emp2), (select rownum rn from dual
      3                                                       connect by rownum <= (select max(hiredate)-min(hiredate)+1 from emp2))
      4              )
      5  -- end of calendar
      6  select cal.dt as cal_date
      7        ,emp2.*
      8  from cal left outer join emp2 on (cal.dt = emp2.hiredate)
      9* order by 1
    SQL> /
    CAL_DATE         EMPNO ENAME      JOB              MGR HIREDATE           SAL       COMM     DEPTNO
    23-JAN-2008       7934 MILLER     CLERK           7782 23-JAN-2008       1300                    10
    24-JAN-2008
    25-JAN-2008
    26-JAN-2008
    27-JAN-2008
    28-JAN-2008
    29-JAN-2008
    30-JAN-2008
    31-JAN-2008
    01-FEB-2008
    02-FEB-2008
    03-FEB-2008
    04-FEB-2008
    05-FEB-2008
    06-FEB-2008
    07-FEB-2008
    08-FEB-2008
    09-FEB-2008
    10-FEB-2008
    11-FEB-2008
    12-FEB-2008
    13-FEB-2008
    14-FEB-2008
    15-FEB-2008
    16-FEB-2008
    17-FEB-2008
    18-FEB-2008
    19-FEB-2008
    20-FEB-2008       7499 ALLEN      SALESMAN        7698 20-FEB-2008       1600        300         30
    21-FEB-2008
    22-FEB-2008       7521 WARD       SALESMAN        7698 22-FEB-2008       1250        500         30
    23-FEB-2008
    24-FEB-2008
    25-FEB-2008
    26-FEB-2008
    27-FEB-2008
    28-FEB-2008
    29-FEB-2008
    01-MAR-2008
    02-MAR-2008
    03-MAR-2008
    04-MAR-2008
    05-MAR-2008
    06-MAR-2008
    07-MAR-2008
    08-MAR-2008
    09-MAR-2008
    10-MAR-2008
    11-MAR-2008
    12-MAR-2008
    13-MAR-2008
    14-MAR-2008
    15-MAR-2008
    16-MAR-2008
    17-MAR-2008
    18-MAR-2008
    19-MAR-2008
    20-MAR-2008
    21-MAR-2008
    22-MAR-2008
    23-MAR-2008
    24-MAR-2008
    25-MAR-2008
    26-MAR-2008
    27-MAR-2008
    28-MAR-2008
    29-MAR-2008
    30-MAR-2008
    31-MAR-2008
    01-APR-2008
    02-APR-2008       7566 JONES      MANAGER         7839 02-APR-2008       2975                    20
    03-APR-2008
    04-APR-2008
    05-APR-2008
    06-APR-2008
    07-APR-2008
    08-APR-2008
    09-APR-2008
    10-APR-2008
    11-APR-2008
    12-APR-2008
    13-APR-2008
    14-APR-2008
    15-APR-2008
    16-APR-2008
    17-APR-2008
    18-APR-2008
    19-APR-2008       7788 SCOTT      ANALYST         7566 19-APR-2008       3000                    20
    20-APR-2008
    21-APR-2008
    22-APR-2008
    23-APR-2008
    24-APR-2008
    25-APR-2008
    26-APR-2008
    27-APR-2008
    28-APR-2008
    29-APR-2008
    30-APR-2008
    01-MAY-2008       7698 BLAKE      MANAGER         7839 01-MAY-2008       2850                    30
    02-MAY-2008
    03-MAY-2008
    04-MAY-2008
    05-MAY-2008
    06-MAY-2008
    07-MAY-2008
    08-MAY-2008
    09-MAY-2008
    10-MAY-2008
    11-MAY-2008
    12-MAY-2008
    13-MAY-2008
    14-MAY-2008
    15-MAY-2008
    16-MAY-2008
    17-MAY-2008
    18-MAY-2008
    19-MAY-2008
    20-MAY-2008
    21-MAY-2008
    22-MAY-2008
    23-MAY-2008       7876 ADAMS      CLERK           7788 23-MAY-2008       1100                    20
    24-MAY-2008
    25-MAY-2008
    26-MAY-2008
    27-MAY-2008
    28-MAY-2008
    29-MAY-2008
    30-MAY-2008
    31-MAY-2008
    01-JUN-2008
    02-JUN-2008
    03-JUN-2008
    04-JUN-2008
    05-JUN-2008
    06-JUN-2008
    07-JUN-2008
    08-JUN-2008
    09-JUN-2008       7782 CLARK      MANAGER         7839 09-JUN-2008       2450                    10
    10-JUN-2008
    11-JUN-2008
    12-JUN-2008
    13-JUN-2008
    14-JUN-2008
    15-JUN-2008
    16-JUN-2008
    17-JUN-2008
    18-JUN-2008
    19-JUN-2008
    20-JUN-2008
    21-JUN-2008
    22-JUN-2008
    23-JUN-2008
    24-JUN-2008
    25-JUN-2008
    26-JUN-2008
    27-JUN-2008
    28-JUN-2008
    29-JUN-2008
    30-JUN-2008
    01-JUL-2008
    02-JUL-2008
    03-JUL-2008
    04-JUL-2008
    05-JUL-2008
    06-JUL-2008
    07-JUL-2008
    08-JUL-2008
    09-JUL-2008
    10-JUL-2008
    11-JUL-2008
    12-JUL-2008
    13-JUL-2008
    14-JUL-2008
    15-JUL-2008
    16-JUL-2008
    17-JUL-2008
    18-JUL-2008
    19-JUL-2008
    20-JUL-2008
    21-JUL-2008
    22-JUL-2008
    23-JUL-2008
    24-JUL-2008
    25-JUL-2008
    26-JUL-2008
    27-JUL-2008
    28-JUL-2008
    29-JUL-2008
    30-JUL-2008
    31-JUL-2008
    01-AUG-2008
    02-AUG-2008
    03-AUG-2008
    04-AUG-2008
    05-AUG-2008
    06-AUG-2008
    07-AUG-2008
    08-AUG-2008
    09-AUG-2008
    10-AUG-2008
    11-AUG-2008
    12-AUG-2008
    13-AUG-2008
    14-AUG-2008
    15-AUG-2008
    16-AUG-2008
    17-AUG-2008
    18-AUG-2008
    19-AUG-2008
    20-AUG-2008
    21-AUG-2008
    22-AUG-2008
    23-AUG-2008
    24-AUG-2008
    25-AUG-2008
    26-AUG-2008
    27-AUG-2008
    28-AUG-2008
    29-AUG-2008
    30-AUG-2008
    31-AUG-2008
    01-SEP-2008
    02-SEP-2008
    03-SEP-2008
    04-SEP-2008
    05-SEP-2008
    06-SEP-2008
    07-SEP-2008
    08-SEP-2008       7844 TURNER     SALESMAN        7698 08-SEP-2008       1500          0         30
    09-SEP-2008
    10-SEP-2008
    11-SEP-2008
    12-SEP-2008
    13-SEP-2008
    14-SEP-2008
    15-SEP-2008
    16-SEP-2008
    17-SEP-2008
    18-SEP-2008
    19-SEP-2008
    20-SEP-2008
    21-SEP-2008
    22-SEP-2008
    23-SEP-2008
    24-SEP-2008
    25-SEP-2008
    26-SEP-2008
    27-SEP-2008
    28-SEP-2008       7654 MARTIN     SALESMAN        7698 28-SEP-2008       1250       1400         30
    29-SEP-2008
    30-SEP-2008
    01-OCT-2008
    02-OCT-2008
    03-OCT-2008
    04-OCT-2008
    05-OCT-2008
    06-OCT-2008
    07-OCT-2008
    08-OCT-2008
    09-OCT-2008
    10-OCT-2008
    11-OCT-2008
    12-OCT-2008
    13-OCT-2008
    14-OCT-2008
    15-OCT-2008
    16-OCT-2008
    17-OCT-2008
    18-OCT-2008
    19-OCT-2008
    20-OCT-2008
    21-OCT-2008
    22-OCT-2008
    23-OCT-2008
    24-OCT-2008
    25-OCT-2008
    26-OCT-2008
    27-OCT-2008
    28-OCT-2008
    29-OCT-2008
    30-OCT-2008
    31-OCT-2008
    01-NOV-2008
    02-NOV-2008
    03-NOV-2008
    04-NOV-2008
    05-NOV-2008
    06-NOV-2008
    07-NOV-2008
    08-NOV-2008
    09-NOV-2008
    10-NOV-2008
    11-NOV-2008
    12-NOV-2008
    13-NOV-2008
    14-NOV-2008
    15-NOV-2008
    16-NOV-2008
    17-NOV-2008       7839 KING       PRESIDENT            17-NOV-2008       5000                    10
    18-NOV-2008
    19-NOV-2008
    20-NOV-2008
    21-NOV-2008
    22-NOV-2008
    23-NOV-2008
    24-NOV-2008
    25-NOV-2008
    26-NOV-2008
    27-NOV-2008
    28-NOV-2008
    29-NOV-2008
    30-NOV-2008
    01-DEC-2008
    02-DEC-2008
    03-DEC-2008       7900 JAMES      CLERK           7698 03-DEC-2008        950                    30
    03-DEC-2008       7902 FORD       ANALYST         7566 03-DEC-2008       3000                    20
    04-DEC-2008
    05-DEC-2008
    06-DEC-2008
    07-DEC-2008
    08-DEC-2008
    09-DEC-2008
    10-DEC-2008
    11-DEC-2008
    12-DEC-2008
    13-DEC-2008
    14-DEC-2008
    15-DEC-2008
    16-DEC-2008
    17-DEC-2008       7369 SMITH      CLERK           7902 17-DEC-2008        800                    20
    331 rows selected.
    SQL>

  • Calendar Table

    Does anyone know the best way to set up a calendar table? We will need a way to account for weekends and holidays when determining work days. I have been searching for some pl/sql code to do this. We are currently not using any other calendaring or using with forms. Needed mainly for reporting issues.
    Please let me know if you have any ideas for me.
    thanks,
    Toni

    Here is an an example using the holiday table combined with the this_year view in the previous example.
    SQL> create table holiday (holiday date,
      2    country varchar2(2), description varchar2(30));
    Table created.
    SQL> insert into holiday values (date '2006-01-23', 'NL',
      2    'National Cheese Day');
    1 row created.
    SQL> select day, weekend, description holiday,
      2    case when weekend = 'N' and holiday is null then
      3      'Y' else 'N' end business_day
      4  from this_year, holiday
      5  where day between sysdate - 5 and sysdate + 5
      6    and day = holiday (+)
      7  order by day;
    DAY       WEEKEND HOLIDAY                        BUSINESS_DAY
    19-JAN-06 N                                      Y
    20-JAN-06 N                                      Y
    21-JAN-06 Y                                      N
    22-JAN-06 Y                                      N
    23-JAN-06 N       National Cheese Day            N
    24-JAN-06 N                                      Y
    25-JAN-06 N                                      Y
    26-JAN-06 N                                      Y
    27-JAN-06 N                                      Y
    28-JAN-06 Y                                      N
    10 rows selected.
    SQL>

  • Internal table population

    Here in this code the internal table it_mseg and it_mbew
    are not being populated in the following code.Can anybody please tell me what the reason.
    Thanks and regards
    jyoti
    SELECT mblnr
             bwart
             matnr
             INTO TABLE it_mseg
             FROM mseg.
      IF it_mseg IS NOT INITIAL .
        SELECT mblnr
               bldat
               INTO TABLE it_mkpf
               FROM mkpf
               FOR ALL ENTRIES IN it_mseg
               WHERE mblnr = it_mseg-mblnr.
      ENDIF.
      IF it_mseg IS NOT INITIAL.
        SELECT matnr
               bwkey
               bwtar
               lbkum
               INTO TABLE it_mbew
               FROM mbew
               FOR ALL ENTRIES IN it_mseg
               WHERE matnr = it_mseg-matnr.
      ENDIF.

    Hi,
      Syntax of  IF it_mseg IS NOT INITIAL is wrong
       Please check this code.
    DATA:it_mseg LIKE MSEG OCCURS 0 WITH HEADER LINE,
         it_mkpf LIKE MKPF OCCURS 0 WITH HEADER LINE,
         it_mbew LIKE MBEW OCCURS 0 WITH HEADER LINE.
    SELECT mblnr bwart matnr
    INTO CORRESPONDING FIELDS OF TABLE it_mseg
    FROM mseg.
    <b>IF NOT it_mseg[] IS INITIAL .</b>
    SELECT mblnr
    bldat
    INTO CORRESPONDING FIELDS OF TABLE it_mkpf
    FROM mkpf
    FOR ALL ENTRIES IN it_mseg
    WHERE mblnr = it_mseg-mblnr.
    ENDIF.
    IF not it_mseg IS INITIAL.
    SELECT matnr
    bwkey
    bwtar
    lbkum
    INTO CORRESPONDING FIELDS OF TABLE it_mbew
    FROM mbew
    FOR ALL ENTRIES IN it_mseg
    WHERE matnr = it_mseg-matnr.
    ENDIF.

  • Pre-loading a table, populating data

    hopefully someone has already crossed this bridge,
    does anyone know how to pre-load a table and then populate the data returned from a query? I have seen websites like ingrammicro.com that display the results from a search where you can see the table and some of the data , and then slowly you start seeing pricing populated within the table. maybe this is more of an HTML question.not sure. thanks for any information you can give.
    thanks, Tim

    yes, that will work. thanks.

  • How FND_PRIMARY_KEYS table populated

    Hello All,<br><br>
    I would like to know how FND_PRIMARY_KEYS are populated. In our application, as per Apps guidelines, we dont have primary key defined on tables. We have indexes. But for Audit Trial we need primary keys. So i would like to know how we can populate the FND_PRIMARY_KEYS table with relevant information ? What information we need to provide and how ?
    <br><br>
    Any pointers are welcome
    <br><br>
    Thanks<br>
    Sindhu

    Is the application, Oracle Applications, or some other vendor's application? Is there a version number?
    I would think that the columns that make up the unique index on a table, providing it has only one unique index, would be the columns that would make up the PK if it were definded. See DBA_IND_COLUMNS. For tables with multiple unique indexes one would likely be the PK and the others UK constraints.
    HTH -- Mark D Powell --

  • Help with PLSQL table population.....

    Hi all,
    I am populating a PLSQL table from a cursor and then inserting into a target table using FORALL.
    While populating, I need two two records differing only by the process_name.
    Say my populated PLSQL table should look like this.
    vt_proc_status_tbl:
    1     76     Pname_A     20     Sysdate     1     U     1
    1     76     Pname_B     20     Sysdate     1     U     1
    How can I create duplicate records like this inside the PLSQL table varying only by process_name????
    OPEN cur_fcst_sites_ppo;
    FETCH cur_fcst_sites_ppo
    BULK COLLECT INTO vt_fcst_sites_tbl;
    CLOSE cur_fcst_sites_ppo;
    FOR v_idx_fcst_sites IN 1 .. vt_fcst_sites_tbl.COUNT
    LOOP
    BEGIN
    SELECT seq_ods_site_process_status.NEXTVAL
    INTO v_odssiteprocessid
    FROM DUAL;
    END;
    v_pst_idx := v_pst_idx + 1;
    vt_proc_status_tbl (v_pst_idx).odssiteprocessid :=
    v_odssiteprocessid;
    vt_proc_status_tbl (v_pst_idx).SYSTEM := pi_system;
    vt_proc_status_tbl (v_pst_idx).process_name := pi_process_name;
    vt_proc_status_tbl (v_pst_idx).siteid :=
    vt_fcst_sites_tbl (v_idx_fcst_sites).siteid;
    vt_proc_status_tbl (v_pst_idx).bday := pi_transferday;
    vt_proc_status_tbl (v_pst_idx).is_no := pi_is_no;
    vt_proc_status_tbl (v_pst_idx).rest_status := c_status_unprocessed;
    vt_proc_status_tbl (v_pst_idx).batch_id := v_batch_id;
    v_cntr := v_cntr + 1;
    IF v_cntr = pi_sites_at_a_time
    THEN
    v_batch_id := v_batch_id + 1;
    v_cntr := 0;
    END IF;
    v_odssiteprocessid := NULL;
    END LOOP;
    IF v_pst_idx &gt; 0
    THEN
    BEGIN
    FORALL v_proc_status_tbl_idx IN 1 .. vt_proc_status_tbl.COUNT
    INSERT INTO ods_site_process_status
    VALUES vt_proc_status_tbl (v_proc_status_tbl_idx);
    END;
    ELSE
    v_code := NULL;
    SELECT SUBSTR ( '[M]:0- No Site Available for the '
    || pi_process_name
    || ' Process For '
    || DECODE (pi_process_name,
    c_transform_bmi_ppo, 'IS_NO '
    || pi_is_no,
    'TransferDay ' || pi_transferday
    || '..',
    1,
    125
    INTO v_errm
    FROM DUAL;
    DBMS_OUTPUT.put_line (v_errm);
    scimf_common.write_log (v_code, --Log error into the LOGFILE
    'E',
    'p_mfcst_transform_master',
    v_errm,
    vr_market.marketid,
    'I'
    END IF;
    Thanks in Advance.
    Jagadish
    Edited by: user646716 on Oct 12, 2008 10:08 AM
    Edited by: user646716 on Oct 12, 2008 12:02 PM

    hi aweiden,
    Please find my entire code below.
    what I am trying to achieve is that when my plsql table vt_proc_status_tbl is populated, I want two different rows to be populated for different process names (i.e bmi_ppo and bmi_ai ) and load it into ODS_SITE_PROCESS_STATUS table so that i do not have to alter my forall statement.
    Thanks for the help
    PROCEDURE p_mfcst_transform_master (
    pi_system IN mfcst_ppo.SYSTEM%TYPE,
    pi_is_ no IN mfcst_ppo.is_no%TYPE,
    pi_transferday IN mfcst_ppo.transferday%TYPE,
    pi_sites_at_a_time IN NUMBER,
    pi_process_name IN ods_site_process_status.process_name%TYPE,
    po_status OUT NUMBER,
    po_error OUT VARCHAR2
    AS
    -- Cursor to get sites to be processed for bmi to ppo transformation process
    CURSOR cur_fcst_sites_ppo
    IS
    SELECT DISTINCT siteid
    FROM sci_restaurant
    WHERE hist_load_status in ('L','H')
    AND SYSTEM = pi_system
    ORDER BY siteid;
    -- Cursor to get sites to be processed for bmi to ai transformation process
    -- Note this cursor is based on the system and transfer day
    TYPE sites_tbltype IS TABLE OF cur_fcst_sites_ppo%ROWTYPE
    INDEX BY PLS_INTEGER;
    vt_fcst_sites_tbl sites_tbltype;
    TYPE proc_status_tbltype IS TABLE OF ods_site_process_status%ROWTYPE
    INDEX BY PLS_INTEGER;
    vt_proc_status_tbl proc_status_tbltype;
    v_cnt NUMBER := 0;
    v_cntr NUMBER := 0;
    v_batch_id NUMBER := 1;
    v_pst_idx PLS_INTEGER := 0;
    v_k PLS_INTEGER := 0;
    v_odssiteprocessid ods_site_process_status.odssiteprocessid%TYPE;
    v_exceptionid NUMBER;
    --variable to log exception into sci_exception table
    BEGIN
    --- If sites were identitfied before, skip the rest of the execution
    --- Note that ods_site_process_status holds the status from the prior runs
    po_error := '';
    po_status := 0;
    scimf_common.p_get_market_parameters (NULL,
    pi_system,
    vr_market,
    v_error_out
    IF v_error_out IS NOT NULL
    THEN
    RAISE e_market_not_found;
    END IF;
    IF pi_process_name = c_transform_bmi_ppo
    THEN
    SELECT COUNT (*)
    INTO v_cnt
    FROM ods_site_process_status
    WHERE SYSTEM = pi_system
    AND process_name = pi_process_name
    AND is_no = pi_is_no
    AND ROWNUM < 2;
    ELSIF pi_process_name = c_transform_bmi_ai
    THEN
    SELECT COUNT (*)
    INTO v_cnt
    FROM ods_site_process_status
    WHERE SYSTEM = pi_system
    AND process_name = pi_process_name
    AND rest_status = c_status_processed
    AND ROWNUM < 2;
    ELSE
    v_code := NULL;
    v_errm :=
    SUBSTR ( '[E]:0- Process Name :>'
    || pi_process_name
    || '<Is Not Proper For System:>'
    || pi_system
    || '< and IS_NO :>'
    || pi_is_no
    || '< and TransferDay :>'
    || pi_transferday
    || '<',
    1,
    125
    DBMS_OUTPUT.put_line (v_errm);
    scimf_common.write_log (v_code, --Log error into the LOGFILE
    'E',
    'p_mfcst_transform',
    v_errm,
    vr_market.marketid,
    'I'
    po_error := TO_CHAR (SQLCODE) || ' -Error Message: ' || v_errm;
    po_status := -1;
    -- Log Exception in the log file and come out.
    END IF;
    IF NVL (v_cnt, 0) > 0
    THEN
    IF pi_process_name = c_transform_bmi_ppo
    THEN
    SELECT SUBSTR
    ( ':0- Sites are already identified before for the '
    || pi_process_name
    || ' Process For '
    || DECODE (pi_process_name,
    c_transform_bmi_ppo, 'IS_NO ' || pi_is_no,
    'TransferDay ' || pi_transferday
    || '..'
    || 'proceeding to invoke child scripts',
    1,
    125
    INTO v_errm
    FROM DUAL;
    DBMS_OUTPUT.put_line (v_errm);
    ELSIF pi_process_name = c_transform_bmi_ai
    THEN
    SELECT SUBSTR
    ( '[I]:0- Sites are already identified before for the '
    || pi_process_name
    || ' Process For '
    || DECODE (pi_process_name,
    c_transform_bmi_ai, 'IS_NO ' || pi_is_no,
    'TransferDay ' || pi_transferday
    || '..'
    || 'proceeding to invoke child scripts',
    1,
    125
    INTO v_errm
    FROM DUAL;
    DBMS_OUTPUT.put_line (v_errm);
    END IF;
    ELSIF NVL (v_cnt, 0) = 0
    THEN
    OPEN cur_fcst_sites_ppo;
    FETCH cur_fcst_sites_ppo
    BULK COLLECT INTO vt_fcst_sites_tbl;
    CLOSE cur_fcst_sites_ppo;
    END IF;
    -- Logic to batch the sites to be processed in the batches of
    -- sites derived from the pi_sites_at_a_time parameter
    -- Batch_Id starts with 1 and need to used along with
    -- either is_no (bmi-ppo) and process name or along with
    -- system, bday and process_name (bmi-ai)
    IF pi_sites_at_a_time IS NULL
    THEN
    v_code := NULL;
    v_errm := 'Site At A Time not defined';
    scimf_common.write_log (v_code, --Log error into the LOGFILE
    'E',
    'p_mfcst_transform_master',
    v_errm,
    vr_market.marketid,
    'I'
    po_error := TO_CHAR (SQLCODE) || ' -Error Message: ' || v_errm;
    po_status := -1;
    raise_application_error (-200002, v_errm);
    END IF;
    FOR v_idx_fcst_sites IN 1 .. vt_fcst_sites_tbl.COUNT
    LOOP
    BEGIN
    SELECT seq_ods_site_process_status.NEXTVAL
    INTO v_odssiteprocessid
    FROM DUAL;
    EXCEPTION
    WHEN OTHERS
    THEN
    ROLLBACK;
    DBMS_OUTPUT.put_line ( '[E]:0- Sequence :>'
    || 'seq_ods_site_process_status'
    || ' <Is Invalid>'
    || '<'
    v_errm :=
    SUBSTR ( 'Sequence seq_ods_site_process_status Error:'
    || SQLERRM,
    1,
    125
    scimf_common.write_log (v_code, --Log error into the LOGFILE
    'E',
    'p_mfcst_transform',
    v_errm,
    vr_market.marketid,
    'I'
    po_error :=
    TO_CHAR (SQLCODE) || ' -Error Message: '
    || v_errm;
    po_status := -1;
    raise_application_error (-200002, v_errm);
    END;
    v_pst_idx := v_pst_idx + 1;
    vt_proc_status_tbl (v_pst_idx).odssiteprocessid :=
    v_odssiteprocessid;
    vt_proc_status_tbl (v_pst_idx).SYSTEM := pi_system;
    vt_proc_status_tbl (v_pst_idx).process_name := pi_process_name;
    vt_proc_status_tbl (v_pst_idx).siteid :=
    vt_fcst_sites_tbl (v_idx_fcst_sites).siteid;
    vt_proc_status_tbl (v_pst_idx).bday := pi_transferday;
    vt_proc_status_tbl (v_pst_idx).is_no := pi_is_no;
    vt_proc_status_tbl (v_pst_idx).rest_status := c_status_unprocessed;
    vt_proc_status_tbl (v_pst_idx).batch_id := v_batch_id;
    v_cntr := v_cntr + 1;
    IF v_cntr = pi_sites_at_a_time
    THEN
    v_batch_id := v_batch_id + 1;
    v_cntr := 0;
    END IF;
    v_odssiteprocessid := NULL;
    END LOOP;
    IF v_pst_idx > 0
    THEN
    BEGIN
    FORALL v_proc_status_tbl_idx IN 1 .. vt_proc_status_tbl.COUNT
    INSERT INTO ods_site_process_status
    VALUES vt_proc_status_tbl (v_proc_status_tbl_idx);
    EXCEPTION
    WHEN OTHERS
    THEN
    ROLLBACK;
    v_error_count := SQL%BULK_EXCEPTIONS.COUNT;
    DBMS_OUTPUT.put_line
    ( '[E]:0- Bulk Insert Fail using FORALL Number of Failure:>'
    || v_error_count
    || '<'
    FOR v_i IN 1 .. v_error_count
    LOOP
    v_errm :=
    SUBSTR
    ( '[E]:Error Insert into ODS_SITE_PROCESS_STATUS table '
    || 'Insert Error: '
    || v_i
    || ' Array Index: '
    || SQL%BULK_EXCEPTIONS (v_i).ERROR_INDEX
    || SQLERRM
    (-SQL%BULK_EXCEPTIONS (v_i).ERROR_CODE),
    1,
    125
    DBMS_OUTPUT.put_line (v_errm);
    END LOOP;
    v_code := NULL;
    scimf_common.write_log (v_code, --Log error into the LOGFILE
    'E',
    'p_mfcst_transform_master',
    v_errm,
    vr_market.marketid,
    'I'
    po_error :=
    TO_CHAR (SQLCODE) || ' -Error Message: '
    || v_errm;
    po_status := -1;
    END;
    ELSE
    v_code := NULL;
    SELECT SUBSTR ( '[M]:0- No Site Available for the '
    || pi_process_name
    || ' Process For '
    || DECODE (pi_process_name,
    c_transform_bmi_ppo, 'IS_NO '
    || pi_is_no,
    'TransferDay ' || pi_transferday
    || '..',
    1,
    125
    INTO v_errm
    FROM DUAL;
    DBMS_OUTPUT.put_line (v_errm);
    scimf_common.write_log (v_code, --Log error into the LOGFILE
    'E',
    'p_mfcst_transform_master',
    v_errm,
    vr_market.marketid,
    'I'
    END IF;
    END IF;
    COMMIT;
    po_status := NVL (po_status, 0);
    EXCEPTION
    WHEN e_market_not_found
    THEN
    ROLLBACK;
    v_code := NULL;
    v_errm := SUBSTR ('[E]:Error Market Not Found ' || SQLERRM, 1, 125);
    scimf_common.write_log (v_code, --Log error into the LOGFILE
    'E',
    'p_mfcst_transform_master',
    v_errm,
    vr_market.marketid,
    'I'
    raise_application_error (-200001,
    'Market parameter not found for system'
    || pi_system
    po_error := TO_CHAR (SQLCODE) || ' -Error Message: ' || SQLERRM;
    po_status := -1;
    WHEN OTHERS
    THEN
    ROLLBACK;
    DBMS_OUTPUT.put_line ( '[E]:0-ERROR :-- '
    || ' --SQLCODE: '
    || SQLCODE
    || ' -Error Message: '
    || SQLERRM
    po_error := TO_CHAR (SQLCODE) || ' -Error Message: ' || SQLERRM;
    po_status := -1;
    END;

  • URGENT:how to get the error table populated in ODI

    Hello all,
    I am working on an interface of ODI where mapping is from a XML file to the database tables. I want, when there is any bad data (having length size greater than the target table's column length or data type mismatch) the bad data should get rejected or separated.
    I am using LKM, CKM, and IKM knowledge modules, but the erroneous record is not getting populated in even in the error table.
    when I try to insert lets say 4 records and 2nd record is erroneous then it is only inserting the 1st record. i want that the erroneous record should get inserted in the error table.
    Please suggest, if anybody is having any related information to get this done. That would be really helpful.
    Thanks in advance!

    Hello Phil,
    Thanks for your update.
    The option which you have mentioned having cloumn as char 4000, I can not do that as my target tables are seeded tables.
    I have also tried to get the data atleast in C$ tables having their length as varchar 4000. but it is not allowing to insert in C$ tables also.
    In my case I am getting data for ex: date_of_birth in VARCHAR datatype from the source XML and I have converted it ot DATE while mapping it to target column having DATE as the datatype.
    what if the DATE in xml source is invalid? its giving me the error while execution "Invalid datetime format". how would I identify that this error is for a particular record. If I can get this erroneous record atleast in C$ table I can find a work around for this correction then.
    I hope you have solution for this problem :)
    Thanks.

  • DHCP table population on E4200

    We've got an E4200 that seems to work pretty well (except with Apple AirPlay).  (latest firmware installed.) However, whenever we have to reboot the router for any reason (i.e.-- changing certain settings), it takes a very, very long time to repopulate the DHCP table. 
    We have 27 wired and wireless devices on the network.  They appear to get assigned IP addresses quickly (because the devices do work and access the Internet) but the devices do not show up in the DHCP table list.  They slowly appear over a period of hours and hours.
    The REFRESH button on the DHCP table updates the entries already in the list but does not add additional items to the list.
    Is this normal?  Is there anyway to speed up the process of populating the table? (Live Chat support was absolutely no help)

    The DHCP table works the same on both of our computers (desktops running Windows 7).  All the devices in the network were powered on.  It just takes a couple of hours for everything to show up in the DHCP table.  Some devices appear instantly upon a reboot of the router (maybe 5 or 6 devices) but to see the full population takes about 2 hours.
    Its not the end of the world, but it seems odd that the IP numbers ARE all assigned right away-- they just take a long time to show up in the table.

Maybe you are looking for