Problem when try to get the next refresh date of a materialized view

I have a materialized view set to auto refresh(e.g hourly), I need to query this date and display in the report. I create a procedure which return the NEXT_DATE from the ALL_REFRESH_CHILDREN table, the procedure and the view all in schema HK3XDDB.
If I login as sys, dba in the sql plus and query the procedure, it return the next date, but if I login as normal user which has permission to execute all procedures, it didn't return anything, so I change ALL_REFRESH_CHILDREN to USER_REFRESH_CHILDREN, still no luck. But the details from the USER_MVIEWS can be returned, just won't return anything in the REFRESH one. How to query the next date out?
Another strange thing is, if I login as sys dba, it return the next date, but if I use a select next_date into statement in the procedure it will throw a data not found error.
I stuck here for several hours just can't figure it out, any suggestions are welcome,
Cheers

Thank you for the reply. It's same with USER_REFRESH_CHILDREN, I can get the result when I run the procedure in SQL PLUS login as sys dba, but if I run the procedure using normal user which has permission to run any procedure, then nothing return. It might be a permission problem but I just can't figure out why.
Let me explain in detailed:
Schema HKXDDB, this schema has procedure TestProcedure, in the procedure, I have two ref cursor return, one is for select * from USER_JOBs (or from USER_REFRESH_CHILDREN, I have tried both), one is for select * From USER_MVIEWS, this schema has the materialized view. User HKDWUser has permission to run any procedures, so when this user run the TestProcedure which is own by HKXDDB, the cursor that select from USER_MVIEWS can return results which are materialized views owned by HKXDDB, but the cursor that select form USER_JOBS or USER_REFRESH_CHILDREN always return no rows.
Any permission I need to assign to HKDWUSER to get the jobs or fresh group that owned by HKXDDB?
Cheers

Similar Messages

  • Getting the next valid date (jump holidays and weekends)

    Hello,
    I have a column table where I have all holidays of the year in the format "yyyymmdd,yyyymmdd,...", for example, "20091012,20091225".
    I'd like to do a query where I pass a date and a increment of days and it returns the next valid date, excluding weekends and the holidays that I have in the column holidays that I show above.
    P.S: Instead of pass a date and a increment of days, I could pass just a already incremented date, and this query just validate this date, adding 2 days for each weekend and one day for each holiday.
    Is there a way to do that?
    Thanks

    Hi,
    Ranieri wrote:
    Hello,
    I have a column table where I have all holidays of the year in the format "yyyymmdd,yyyymmdd,...", for example, "20091012,20091225".Dates should always be stored in DATE columns. If you really want to, your can also store the formatted date in a separate column.
    I'd like to do a query where I pass a date and a increment of days and it returns the next valid date, excluding weekends and the holidays that I have in the column holidays that I show above.For convenience, you can't beat a user-defined function, such as Etbin's.
    If you really want a pure SQL solution, you can
    (a) generate a list of all the days that might be between the start date and end date (sub-query all_days below)
    (b) outer join that to your holiday table (sub-query got_dnum, below)
    (c) rule out the holidays and weekends (sub_query got_dnum, WHERE clause)
    (d) return the nth remaining day (main query below)
    WITH     all_days     AS
         SELECT  TO_DATE (:start_date, 'DD-Mon-YYYY') + LEVEL     AS dt
         FROM     dual
         CONNECT BY     LEVEL <= 3           -- 3 = max. consecutive non-work days
                   + (:day_cnt * 7 / 4)     -- 4 = min. work days per week
    ,     got_dnum     AS
         SELECT     a.dt
         ,     ROW_NUMBER () OVER (ORDER BY a.dt)     AS dnum
         FROM          all_days     a
         LEFT OUTER JOIN     holidays     h     ON     a.dt = TO_DATE (txt, 'YYYYMMDD')
         WHERE     h.txt               IS NULL
         AND     TO_CHAR (a.dt, 'Dy')      NOT IN ('Sat', 'Sun')
    SELECT     dt
    FROM     got_dnum
    WHERE     dnum     = :day_cnt
    ;This assumes :day_cnt > 0.
    The tricky part is estimating how far you might have to go in sub-query all-days to be certain you've included at leas :day_cnt work days.
    Where I work, holidays are always at least 7 days apart.
    That means that there can be, at most, 3 consective days without work (which happens when there is a holiday on Monday or Friday), and that thee are at least 4 work days in any period of 7 consecutive days. That's where the "magic numbers" 3 and 4 come from in the CONNECT BY clause of all_days. Depending on your holidays, you may need to change those numbers.
    P.S: Instead of pass a date and a increment of days, I could pass just a already incremented date, and this query just validate this date, adding 2 days for each weekend and one day for each holiday.Good thought, but it won't quite work. How do you know how many holidays were in the interval? And what if the first step produces a Saturday before a Monday holioday?
    You might be interested in [this thread|http://forums.oracle.com/forums/message.jspa?messageID=3350877#3350877]. Among other things, it includes a function for determining if a given date (in any year) is a holiday, without reference to a table.

  • How to get the next working date?

    Hi,
    I need to extract data between the 2nd of the month, and second working date of the following month.
    Here is the code I have to check if the date is a weekend, and check if it is in the Holidays table (for UK Holidays):
    (This code is to check against Easter 2014, so Good Friday was on the 18th of April, Easter Monday was on the 21st, and the date I want returned is Tuesday the 22nd but I cannot get it working correctly).
    declare @LatestDate datetime
    set @LatestDate = DATEADD(m,-9,getdate()) -- cast('01/11/2014' as datetime) --dateadd(m,1,datediff(d,0,'01/11/2014'))
    set @LatestDate = DATEADD(d,13,@LatestDate)
    print @LatestDate
    if datepart(dw,@LatestDate) in (1,7)
    Begin
    while datepart(dw,@LatestDate) in (1,7)
    OR
    exists (select * from Hermes_Rep..Holidays where Holiday =right(CONVERT(CHAR(10), @LatestDate, 101),4) + '-' + left(CONVERT(CHAR(15), @LatestDate, 101),2) + '-' + SUBSTRING(CONVERT(CHAR(15), @LatestDate, 101),4,2))
    Begin
    set @LatestDate=DATEADD(d,1,@LatestDate)
    End
    End
    What I need is for my code to always return the 2nd working day of any month, taking into account weekends, and Holidays in the Holidays table.
    The Holidays table has dates in the format '2014-04-18 00:00:00' (for Good Friday 2014)

    Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI-ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. 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-
    >>Here is the code I have to check if the date is a weekend, and check if it is in the Holidays table (for UK Holidays): <<
    Do you know what a calendar table is?
    >> (This code is to check against Easter 2014, so Good Friday was on the 18th of April, Easter Monday was on the 21st, and the date I want returned is Tuesday the 22nd but I cannot get it working correctly). <<
    Catholic or Orthodox Easter?  This is one of many reasons we do not use computations in SQL. What you did is the wrong approach  done with bad programming. For example, we do not use the old Sybase getdate() now. The only display format allowed in
    ANSI/ISO Standard SQL, but you used a local dialect! 
    COBOL treats dates as strings like you did; SQL has a temporal data type. 
    >> What I need is for my code to always return the 2nd working day of any month, taking into account weekends, and Holidays in the Holidays table. <<
    The idea of a Holiday table is bad; why are these dates totally different entities from other dates? Would you split Personnel on sex and have “Male_Personnel” and “Female_Personnel”? 
    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'; 
    --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

  • I get the next mistake (fout is the dutch word for Mistake): "Fout: uncaught exception: [Exception... "Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED) [nsIDownloadManager.userDownloadsDirectory]" nsresult: "0x80520015 (NS_ERROR_

    OS: win XP pro SP 2
    I tried to download a pictures at a number of sites, but I never succeed.
    I installed some suggested add-ons to help the download proces: 'downthemall' and 'downloadhelper' but they didn't help. I went to help and did the suggested action by means of 'about:config' to fix the problem but still I get the next failure. I would be pleased if anyone can explain what it means. I would be even more pleased if anyone could solve this.
    == This happened ==
    Every time Firefox opened
    == from the moment I installed firefox

    Additional info: the following message is repeatedly logging in my error console:
    Security Error: Content at http://googleads.g.doubleclick.net/ may not load data from http:...
    The info following the second http:// depends on the website. I am getting this message at google.com, userscripts.org, digitalopint.com, and others.

  • I am experiencing some major problems with my MacBook Pro. I have had some issues with it turning on/off at random times, but today, when starting, I get the grey start-up screen and a recovery bar. After filling in approx 1/4 of the way, the machine dies

    I am experiencing some major problems with my MacBook Pro. I have had some issues with it turning on/off at random times, but today, when starting, I get the grey start-up screen and a recovery bar. After filling in approx 1/4 of the way, the machine dies. After starting it in recovery mode, it will not allow me to download OS X Mavericks- it says the disk is locked. Any ideas? I do not have a back-up and do not want to erase everything before I have explored my options. Help?

    try forcing internet recover, hold 3 keys - command, option, r - you should see a spinning globe
    most people will tell you to do both pram and smc resets (google) and if you still have issues, either clean install (easy) or troubleshoot (hard)

  • Any one have any idea when the next refresh of the Mac Mini will be?

    Hey, guys!  I currently have a 1.87 Ghz Core Duo Mac Mini which I've done a few upgrades to.  RAM, Hard drive, etc., but OSX Lion requires a Core 2 Duo to be able to install it.  Therefore, I've been eyeing up the current Mini, but I was hoping that someone might have some information on when the next refresh if the Mini is expected. And sort of wondering if I should wait or just go ahead and get a current model.
    thanks in advance!
    Jeff

    I understand, but consider that Apple is stepping up OS Major releases & look what get's left out of the next update, then what will be left out on the next update???
    Macs that will support OS X 10.8 Mountain Lion
    As usual, the newer the Mac the better:
    • MacBook Pro – 13″ from mid 2009 or later, 15″ from late 2007 and newer, 17″ from late 2007 and newer
    • MacBook Air – late 2008 and newer
    • iMac – models from mid 2007 and newer
    • MacBook – 13″ aluminum from 2008, 13″ from 2009 and newer
    • Mac Mini – early 2009 and newer
    • Mac Pro – early 2008 models and newer
    • XServe – early 2009 models and newer
    Macs that are NOT expected to support OS X Mountain Lion
    Older Macs and those with weaker GPU’s will likely be left behind:
    • Anything with an Intel GMA 950 or x3100 integrated graphics card
    • Anything with an ATI Radeon X1600
    • MacBook models released prior to 2008
    • Mac Mini released prior to 2007
    • iMac models released prior to 2007
    • Original MacBook Air
    This list of compatible and incompatible Macs and system requirements are based off of the first OS X Mountain Lion Developer Preview and may be subject to change, we will update when we learn more about the specifics. OS X Mountain Lion will be released this summer but presumably long before that we will know precise system requirements and what Macs are and are not supported by the new version of OS X. Stay tuned.
    http://osxdaily.com/2012/02/16/os-x-10-8-mountain-lion-system-requirements/

  • HT5625 My daughter and I were both on same Apple ID. We are trying to change hers but when we do, it says her email is already associated with an Apple ID but when we try to get the password, it says that it could not be verified. How do we correct this?

    My daughter and I were both on same Apple ID. We are trying to change hers but when we do, it says her email is already associated with an Apple ID but when we try to get the password, it says that it could not be verified. How do we correct this?

    Not from your end. Click here and ask the iTunes Store staff for assistance.
    (126716)

  • I have an old iPhone 3Gs with software version 4.3.5,  I am trying to use it again, and it works fine, but I have not been able to update the software.  Every time I try, I get the following message: "there was a problem downloading the software for the i

    I have an old iPhone 3Gs with software version 4.3.5,  I am trying to use it again, and it works fine, but I have not been able to update the software.  Every time I try, I get the following message:
    "there was a problem downloading the software for the iPhone, the network connection could not be established".  This happens even though I have a working internet connection.
    Besides that, all the other functions work properly, even synchronize apps and library.
    Will I be able to update the software?

    look around the forum tons of people repport that they can't update
    makes you suspect that apples update servers can't meet the depand of too many users
    trying to update at once

  • Why can't I see my data which was entered and saved on a form when i try to reopen it? it always worked before until this spring 2014. The data is actually there when I click on a box but disappears when I go to the next box. I have a Mac.

    I am using a Mac and I have always filled out the same form (ocf-6 from ontario insurance companies, application for expenses)  It stopped letting me go back and open the previously saved forms which i filled out and I have saved monthly for the past 5 years. Now when I open a previously saved month /file I cannot see the data I inputed.  The data is there because when i highlight a box the data appears. then when i move onto the next field/box it disappears. I tried to highlight the whole document but nothing shows up. This problem started in the spring ,2014.

    Once you save that to a location on your system.
    Make sure Acrobat is Quit and then do this:
    1.  In the Finder go to the "Go" menu.
    2. Select Go to Folder
    3.  Paste this path into the "Go to the Folder:" field
    /Applications/Adobe Acrobat XI Pro/Adobe Acrobat Pro/Contents/Resources/JavaScripts/
    4. Copy the file into the JavaScripts folder.
    5. Launch Acrobat
    Now you should see the menu spoken of in the blog and web page.

  • So I bought an iphone 4 from ebay and when I got it it was already signed into an icloud account. When I contacted the seller he said he would try to get the password but i haven't heard from him. How can I sign out of her icloud w/out the password

    So I bought an iphone 4 from ebay and when I got it it was already signed into an icloud account. When I contacted the seller he said he would try to get the password but i haven't heard from him. How can I sign out of her icloud w/out having to have the last users password

    Bmscotr5 wrote:
    How can I sign out of her icloud w/out having to have the last users password
    You cannot.
    Removing a device from a previous owner’s account
    Try and get a Refund.

  • When I try to get the key code for office it tells me its already been used.  My mac had a new hard drive in its first year, could it be because of this?  How can I get the office I've paid for but never used?

    My mac had to have a new hard drive in its first year.  Now, when I try to get the key code for office it tells me its already been used.  How do i get the office I've paid for but never used?

    The product key is sent to you by email as part of the purchase confirmation.
    If you have lost it, log into your Microsoft account.

  • Texting on iPhone 5.  When texting to multiple people why does the contact list return to the "A"s after you select a contact and try to add the next one in order?

    Texting on iPhone 5.  When texting to multiple people why does the contact list return to the "A"s after you select a contact and try to add the next one in order?  This really slows you down when trying to contact 50 people with information.  iPhone 4 worked just fine.  Any suggestions on how to fix this?

    None of my pictures that I uploaded into iPhoto are in my Finder under Pictures.  Should I copy and paste my folders from iPhoto into here, in case something happens to my iPhoto program (in addition to backing them up onto an external hard drive like I already do)?
    No, that's just wasting space.  A back up needs to be on a different disk.
    Your photos are within the iPhoto Library.

  • Trying to import cd, it only shows tracks, not song titles. when i try and get the titles it says im not registered for online use even though im signed in. how can i fix this?

    Im trying to import songs from a cd, but it only shows track numbers, no title of songs.when it try to get the titles it gives error code saying im not registered for online use. i am signed into my account so i dont know how to fix this.

    The "not recognized for on-line use" error is associated with the Gracenote service that iTunes uses to look up and retrieve metadata for CDs.  Some users have reported that this error occurs when trying to import from CD, subsequent to upgrading to version 12.  A number of slightly different solutions have been reported (though all of a similar nature).
    Try walking through the following steps - before starting you may have to enable hidden files and folders to be viewed - in Windows 7 / Windows Explorer select Organize > Folder and search options, then on the View tab make sure that Show hidden files, folders and drives is selected.  Without this you won't see the AppData folder in C:\Users\username\.
    Exit iTunes
    In Windows Explorer, go to the folder C:\Users\username\AppData\Roaming\Apple Computer\iTunes
    Delete the following files:
    CD Info.cidb
    com.apple.iTunes.Gracenote.plist
    Restart iTunes
    Insert a CD and see if details are now correctly retrieved from Gracenote
    If this doesn't work: 
    In iTunes, select Edit > Preferences and make a note (or take a screenshot) of your preferences settings in all relevant tabs
    Exit iTunes
    In Windows Explorer, go to the folder C:\Users\username\AppData\Roaming\Apple Computer\iTunes
    Delete the following file:iTunesPrefs.xml
    Restart iTunes
    Insert a CD and see if details are now correctly retrieved from Gracenote
    If this second procedure does work, you'll need to restore other iTunes preferences settings to those that you noted in step 1.
    If this one didn't work: 
    Exit iTunes
    Check the following folders:
    C:\Users\username\AppData\Local\Apple Computer\iTunes
    C:\Users\username\AppData\LocalLow\Apple Computer\iTunes
    Delete any copies of the following files:
    CD Info.cidb
    com.apple.iTunes.Gracenote.plist
    iTunesPrefs.xml
    Restart iTunes
    Insert a CD and see if details are now correctly retrieved from Gracenote
    Again, if this procedure does work, you'll need to restore other iTunes preferences settings to those that you noted in step 1 of the second procedure. 
    If you're still not able to retrieve CD info: 
    Exit iTunes
    In Windows, select Start > Control Panel > Programs and Features.  Find the entry for iTunes, right-click and select Repair.
    When this process has finished, restart iTunes
    Insert a CD and see if details are now correctly retrieved from Gracenote
    If none of these have worked (and almost everything I've seen suggests you should be OK by this point), you may have an issue with the installation and configuration of iTunes itself.  If you have got this far, see turingtest2's notes on Troubleshooting issues with iTunes for Windows updates for advice on how to remove and replace of all components of iTunes.

  • My creative cloud desktop screen is blank. I apparently have a OOBE problem but my chat session was interupted  right when I was getting the steps to fix it.

    My creative cloud desktop screen is blank. I apparently have a OOBE problem but my chat session was interupted  right when I was getting the steps to fix it.

    >desktop screen is blank
    Or, the steps in these links
    BLANK Cloud Screen http://forums.adobe.com/message/5484303 may help
    -and step by step http://forums.adobe.com/thread/1440508?tstart=0
    -and http://helpx.adobe.com/creative-cloud/kb/blank-white-screen-ccp.html

  • I have a JVC GY-HM100U and when I try to get the video files (MP4 format) off of the the SD card I get the error message OSStatus error -12909...any thoughts?

    I have a JVC GY-HM100U and when I try to get the video files (MP4 format) off of the the SD card I get the error message OSStatus error -12909...any thoughts?

    To be more precise: You MUST shoot in mov. Then drag the Clip bins from the card to you hard drive. Then drag the clips to FCP timeline and FCP asks you if you want to change to the right codec and of course you say YES. Now you can start editing. Can not be more simple. This camera was specially designed for use with FCP.

Maybe you are looking for

  • Address in a Drop Down Menu?

    Is it possible to have multiple lines in a drop down menu.  I am creating letterhead for my Company.  We have six locations.  Instead of having them choose each part of the address, line by line, I would like them to be able to choose the whole addre

  • Aperture to iPad syncing original, not adjusted

    Im pretty sure all setting are correct in previews as both top boxes are ticked, then "Always" and "half size" and on the Gear tab "Maintain Previews for Projects" has a tick next to it, Although it is greyed out when i click on a album. So I try and

  • Translate Report Painter

    Hi! Can anyone explain me how to translate a report painter to another language? I've tried se63, but can't figure out how to do it... Thanks! Catia

  • Uni Student looking for a MacBook Pro for Music Production.

    I'm sorry if a thread like this is already up but i couldn't find one. Anyway, basically i'm university student studying Audio Engineering w/ Electronics and i am just currently entering my second year. After the first year of uni i have come to the

  • Help Requested on Previous Zero Response Question.

    +This must have been a dumb question, but I'm asking again anyhow in the hope that someone will take pity on this Aperture newbie. Thanks in advance.+ Hello: I've just purchased Aperture 3 and moved over my iPhoto libraries (2), which I first merged