The reference to the table, view, or the sequence is not allowed in this context

Hello

I am triying to run the SP that I describe below and the OS gives me an error:
CREATE OR REPLACE PROCEDURE DWARE.P_CSCV_AGR_MONTH_REVENUE
(
    TBL_NAME VARCHAR2,
    START_DATE DATE,
    RESULT_ OUT NUMBER
  ) AS
  BEGIN
  
  DECLARE 
  
    v_tbl_name VARCHAR2(30);
    v_start_date DATE;
    v_result NUMBER := 0;
    
    v_select_aux VARCHAR2(32767) := ' ';
    v_temp_table VARCHAR2(30);
    v_exists NUMBER;

  BEGIN
    v_tbl_name := TBL_NAME;
    v_start_date := START_DATE;
  
    v_temp_table := 'temp_' || v_tbl_name;
    
    SELECT count(*) INTO v_exists FROM tab WHERE lower(tname) = lower(v_temp_table);
    IF (v_exists = 1) THEN
      v_select_aux := '
        DROP TABLE ' || v_temp_table || ' CASCADE CONSTRAINTS PURGE
      ';
      EXECUTE IMMEDIATE (v_select_aux);
      COMMIT;
    END IF;
    
    v_select_aux := 'CREATE TABLE ' || v_temp_table || ' AS 
                              SELECT ch.date_ month_revenue,
                                   s.date_sub month_sub,
                                   s.codpromoter,
                                   u.OPERATOR,
                                   SUM (ch.total) AS TOTAL_OK
                                   FROM cscv_sub_charges_' || to_char(v_start_date, 'YYYY_MM')|| ' ch
                                   INNER JOIN cscv_subs s
                                   ON ch.id_sub = s.ID
                                   INNER JOIN cscv_users u
                                   ON s.id_user    = u.ID
                            WHERE ch.STATUS = 0
                            GROUP BY ch.date_, s.date_sub, s.codpromoter, u.OPERATOR';
                            
    EXECUTE IMMEDIATE (v_select_aux);
    COMMIT;  
     v_select_aux := '
 INSERT INTO ' || v_tbl_name || ' (
         month_revenue,
         month_sub,
         codpromoter,
         operator,
         TOTAL_0,
         TOTAL_1,
         TOTAL_2,
         TOTAL_3,
         TOTAL_4,
         TOTAL_5,
         TOTAL_6,
         TOTAL_7,
         TOTAL_8,
         TOTAL_9,
         TOTAL_10,
         TOTAL_11
      )
        SELECT 
         month_revenue,
         month_sub,
         codpromoter,
         operator,
         TOTAL_0,
         TOTAL_1,
         TOTAL_2,
         TOTAL_3,
         TOTAL_4,
         TOTAL_5,
         TOTAL_6,
         TOTAL_7,
         TOTAL_8,
         TOTAL_9,
         TOTAL_10,
         TOTAL_11
        FROM 
        (
           SELECT 
              month_revenue,
              month_sub,
              codpromoter,
              operator,
              sum(total_ok) total_0,
              0 total_1,
              0 total_2,
              0 total_3,
              0 total_4,
              0 total_5,
              0 total_6,
              0 total_7,
              0 total_8,
              0 total_9,
              0 total_10,
              0 total_11
             FROM '|| v_temp_table ||'
          WHERE to_char(month_sub,''mm/yyyy'') = to_char(sysdate,''mm/yyyy'')
          GROUP BY month_revenue,month_sub,codpromoter, operator
          UNION ALL
          SELECT 
              month_revenue,
              month_sub,
              codpromoter,
              operator,
              0,
              sum(total_ok),
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0
             FROM '|| v_temp_table ||'
          WHERE to_char(month_sub,''mm/yyyy'') = to_char((to_date(sysdate,''dd/mm/yy'') - INTERVAL ''1'' MONTH),''mm/yyyy'')
          GROUP BY month_revenue,month_sub,codpromoter, operator
          ) 
        GROUP BY month_revenue,
         month_sub,
         codpromoter,
         operator
           ';    
    
    EXECUTE IMMEDIATE (v_select_aux);
    v_result := v_result + SQL%ROWCOUNT;
    COMMIT;
    
    v_select_aux := '
      DROP TABLE ' || v_temp_table || ' CASCADE CONSTRAINTS PURGE
    ';
    EXECUTE IMMEDIATE (v_select_aux);
    COMMIT;
    
    RESULT_ := v_result;
  END;
  END P_CSCV_AGR_MONTH_REVENUE;
/
------------------------------
BEGIN
DWARE.P_CSCV_AGR_MONTH_REVENUE(CSCV_AGR_MONTH_REVENUE,'01/01/2010');
END;
/
and the output is:
Error at line 1
ORA-06550: líne 2, column 32:
PLS-00357: The reference to the table, view or sequence 'CSCV_AGR_MONTH_REVENUE'  is not allowed in this context
ORA-06550: líne 2, column 1:
PL/SQL: Statement ignored
What could I do to fix the problem?

Thanks in advance...

Hello

Signature of the procedure is

CREATE OR REPLACE PROCEDURE DWARE.P_CSCV_AGR_MONTH_REVENUE
(
TBL_NAME VARCHAR2,
START_DATE DATE,
RESULT_ OUT NUMBER
) 

either he's expecting two input parameters, tbl_name in VARCHAR2 and the other START_DATE date format format. Also you need a variable with the number data type to store the value of the PARAMETER RESULT_

Now, look at the way you call this procedure

 BEGIN
DWARE.P_CSCV_AGR_MONTH_REVENUE(CSCV_AGR_MONTH_REVENUE,'01/01/2010');
END;
/

first parameter must be a VARCHAR2, so place CSCV_AGR_MONTH_REVENUE in single quotes.
second parameter must be a date, so use to_date() function.
Finally declare a variable with the data type of number to maintain the value of the parameter RESULT_

Something like this:

declare
t_num number;
begin
a('CSCV_AGR_MONTH_REVENUE',to_date('01/01/2010','MM/DD/YYYY'),t_num);
dbms_output.put_line(t_num);
end;

Vivek L

Tags: Database

Similar Questions

  • How I can corect the following protocols (rtsp) is not associated with any program or is not allowed in this context

    The address was not included

    Firefox doesn't know how to open this address, because one of the following protocols (rtsp) is not associated with any program or is not allowed in this context.

       You might need to install other software to open this address.
    

    I'm not a Curmudgeon, so please keep it simple.

    Thank you

    Firefox 32.0.3 has this security update.
    You can check the version in "> about".

  • I am installing CC on an iMac late 2015. I get the following error message: Firefox doesn't know how to open this address, because one of the following protocols (aam) is not associated with any program or is not allowed in this context.      You mi

    I am installing CC on an iMac late 2015. I get the following error message: Firefox doesn't know how to open this address, because one of the following protocols (aam) is not associated with any program or is not allowed in this context.      You may need to install additional software to open this address. "Someone knows what's going on?

    Please try to download from: https://helpx.adobe.com/creative-cloud/help/install-apps.html. You can also try to download using the different browser.

  • XmlValidate() - the content is not allowed in prolog

    I posted in another thread, but I think that the problem described, it is resolved, so I'm starting a new thread with this new number.

    XmlValidate always returns "content is not allowed in prolog" I searched this forum and google and I've seen where this problem has been solved for some. It seems that the most common cause was a hidden character (BOP I think) in the file. However, I checked that my xml has not just in it.
    I'm a Loos as to how to proceed. I hope someone out there saw it and that fixed it. I need serious help.

    Quote:
    Posted by: newsgroup user
    How do check you this?

    I ran a very useful code Ben Nadel at http://www.bennadel.com/index.cfm?dax=blog:1206.view who basically Gets the first characters of the parsed XML and outputs with Asc(). After executing this code, I had no extra character in there.

    I have to sort this issue however. I had the first parameter in quotes:
    (" http://www.myserver.com/MyXsd.xsd") >. When I removed the quotes the error "the content is not allowed in prolog" disappeared, but I came back to the original problem that I mentioned in another thread. Namely, the code runs about 30 seconds and then a JRun Servlet error returns with "500 null" on the page.
    It turns out that it was because I had in the file xsd is called in XmlValidate. Once I copied and pasted the code in DocumentCommon.xsd in the called xsd, replacing the , it worked.

    Very frustrating.

  • "Look for the update is not available at this time. Try again later. »

    I use a Photon on the Sprint 3 G EVDO network. When I open the settings app and click the option to check the software update from Motorola, the following screen appears: "look for the update is not available at this time. Try again later. "When I'm on a Wi - Fi network, a similar message appears (no screenshots):" your device is up to date! No update is necessary at this time. "Can someone please provide more information about what exactly is the message originally in my screenshot below to appear? Thank you for your help.

    If you go to Menu > settings > Data Manager > delivery data > social apps > Sync only over wifi. If this box is checked, and that you are connected to 3g / 4g and no wifi, you will get the server is not available because you are not connected to our servers. As soon as you connect to the wifi it reconnect to our servers and see no upgrade is available or an update if one is available. Your phone works as expected.

    Mark

    Support Forums Manager

  • niDMM.cs exception: "the device was not recognized. The device is not supported with this driver or version. »

    Hi all!

    I have a question about using a DMM (PXI-4065) with VStudio 2008 and Measurement Studio 2009.

    Because DMM are not always supported in .net, I downloaded niDMM.cs 3.0 wrapper of the web site of NOR.

    I also downloaded example c# measure DC Voltsto compare with my request.

    Both an example and my application fail trowing the exception [-1074118656] 'the device was not recognized.  The device is not supported with this driver or version. " class constructor is called.

    DMM = new InstrumentDriverInterop.Ivi.nidmm ("PXI3::12:INSTR", true, true);

    I guess it is function of device PXI!

    I also tried to use a VISA alias as "pippo" and then I tried to insert a device unexistent name. In any case the same exception was trown.

    NOR-DAQmx 8.9.5

    NOR-DMM 3.0.1

    NI-VISA 4.6.1

    NOR-MAX 4.6.2f1

    Roberto

    Hello Robson,

    Maybe you areusing an incorrect descriptor itrument, try please the instructions contained in the following document:

    KB 33A96PCW: receive error-1074118656 when running OR DMM screws

    Let me know if this might help.

    Best regards.

  • Receive error message "you are not allowed to this directory or this page" using the identification information you have provided to the struggle. when upgrading to SP3.

    403-Forbidden: access denied

    While trying to upgrade to XP SP2, SP3, a server error message appeared as the title with the text "you not may to this directory or page using the credentials you provided for the fight."

    ????

    Hi ZRay,

    1. You use Windows update or manual download to install service pack 3 on the computer?
    2. During the process of upgrading to how you receive the error message?
    3. You have security software installed on the computer?

    I suggest you check out the article below and try the steps mentioned, check if it helps.

    When you try to install Windows XP Service Pack, you receive the error message "Access denied" or "installing the Service Pack has not completed"

    http://support.Microsoft.com/kb/949377

    Steps to take before you install Windows XP Service Pack 3

    http://support.Microsoft.com/kb/950717

  • The area is blocked: * siteremoved * is not allowed on this network.

    I go to a site that I go to every day and all of a sudden, I'm being re-directed to http://block.opendns.com/main, and the page reads:

    THIS DOMAIN IS BLOCKED.
    Www.xxxxxx.com site is blocked is not allowed on this network. OpenDNS

    I checked my router settings and nothing is blocked. I checked this first because I recently opened Upnp to allow a game.

    I do not use a DNS service and I can't understand how to 'allow' this site on my network.

    Can someone tell me where to click to allow a site on my network?

    original title: THIS FIELD IS BLOCKED.__Site blocked www.xxxxxx.com is not allowed on this network. OpenDNS

    192.168.1.1 is the local address of your modem or router.  In turn, your router or modem gets its information from your ISP DNS, unless ignore you it with a manual setting.
     
    I have a Vista computer handy, but on my computer Windows 7 I would right-click on the connection in the task bar icon, select "Open network and sharing Center." Then click "edit card settings. Right-click on the adapter used (without wireless or LAN), select Properties, then 'Protocol Internet Version 4 (TCP/IPv4)', then properties. Instead of "Obtain DNS server address automatically" click "use the following DNS server address". Enter 8.8.8.8 and 8.8.4.4 in two spaces, click OK and restart. Did that fix the problem?

    Gary van, Microsoft MVP (Mail)
    ------------------------------------------------------

    "LanCyfer" wrote in the new message: * e-mail address is removed from the privacy... *

    ... DNS server: 192.168.1.1

    "LanCyfer" wrote in the new message: * e-mail address is removed from the privacy... *

    where should I click to check the settings of the DNS on my PC?

    Vista

    Gary van, Microsoft MVP (Mail)

  • Log on to the method not allowed on this computer

    original title: Error Window Vista.

    You cannot connect because the logon method, you use is not allowed on this computer. Please, see your network administrator for more information. This is the response I get when I try to log on my Windows Vista computer on a domain. I removed all the newspapers deny on policies affecting the comments. Always the same. Can anyone help.

    Hello

    I suggest you to ask your question at the following link.

    http://social.technet.Microsoft.com/forums/en-us/w7itpronetworking/

    I would also ask you to contact your IT Department.

  • In an attempt tp install I-tunes, I said "the administrator will not allow him" - what can I do?

    I try to install I-Tunes, but my Vista system does not end.  At the end of installation, I get a message indicating that the administrator will not allow the program to add.  I have had no problem in the installation of I-Tunes on my other PC with a system 7.

    Hello

    (1) did you of recent changes to the system before the show?

    (2) are you connected to the system as an administrator?

    (3) what is the exact error message?

    Method 1:

    Follow the links below to solve problems and then try to install iTunes and check if it helps.

    http://Windows.Microsoft.com/en-us/Windows-Vista/Troubleshoot-installing-or-uninstalling-programs

    http://support.Microsoft.com/mats/Program_Install_and_Uninstall

    Method 2: Uninstall and reinstall iTunes.

    Follow the article mentioned below to uninstall and reinstall iTunes in high mode and check if this solves the problem.

    Uninstall and reinstall iTunes.

    http://support.Apple.com/kb/HT1923

    Also visit the below mentioned link.

    http://support.Apple.com/kb/ht1926

    http://support.Apple.com/kb/TS1331

    It will be useful.

  • You cannot connect because the logon method, you use is not allowed on this computer. Please, see your network administrator for more information.

    Whenever I enter my correct password in my windows account it rejects a message and it comes up saying: "you cannot connect because the logon method, you use is not allowed on this computer." See your network administrator for more information. "I can't seem to be able to enable or disable anything because the profile I'm using on my computer is the profile of"Guest ".

    Karima,

    Applicable to Windows 7.

    The following steps require administrator credentials.

    • Use the Windows + R or "Run" in the start menu, then type gpedit.msc.
    • Navigate to Computer Configuration > Windows settings > local policies > user rights assignment > consider all policies "prohibit the newspaper on" to check if your guest account is listed. Remove account from the list, and you should be fine to continue using your guest profile.

    Good luck.

    James

  • can not connect because the logon method, you use is not allowed on this computer.

    I have a new computer that is joined to the domain, but in trying to have a user login, I get the following error:

    can not connect because the logon method, you use is not allowed on this computer.

    The only way for him to connect is to change its parameters from the user to the administrator. I tried power users and other options and did not work.

    is there any solution for this?

    Hi Snidera,

    The question you posted would be better suited in the TechNet Forums. I would recommend posting your query in the TechNet Forums.

    http://social.technet.Microsoft.com/forums/en-us/category/w7itpro

    It will be useful.

  • By mistake, I downloaded a program called driver of dog. But now the program does not allow me the 'uninstall '. Help! Thank you

    Recently downloaded a program called 'dog driver.  It was a mistake.  But when I went into Control Panel to use the feature to "Uninstall" to remove the program... the program will not allow the uninstall feature to remove it.  Any suggestions?  Thank you

    If the Control Panel does not remove the software, you can use an uninstall program:

    Revo Uninstaller - if she is not fully removed - follow the link and download the free version:

    http://www.revouninstaller.com/revo_uninstaller_free_download.html

  • Sony Mini DV DCR-TRV18E camcorder to my computer laptop 64 bit Windows 7. The camera is not compatible with this version of Windows.

    I can't connect my Sony Mini DV DCR-TRV18E camcorder to my computer laptop 64 bit Windows 7. The camera is not compatible with this version of Windows. Does this mean that I can't import my old videos? Thank you.

    Yes, this says it's not compatible. So I don't think it'll work in Win7. There a firewire connection? If this is the case you can use it if the laptop has firewire top. All you need is a cable

  • APEX4.1: MasterDetail case id form, add details, (the sequence is not filled)

    Hello. Here's my problem. I created a form master detail but I Heve the following during operation error message.

    When I press the button Add a LINE an additional record becomes editable and insert data I need. Then, when I select the button APPLY the CHANGES, error

    1 errors occurred

    • Column must have a value. (Line 5)'

    is displayed.

    I created the form using the wizard, but specifying the use of ROWID in the beginning, I changed the configurations in order to use a primary key with an existing sequence.

    I tried to delete also the region and create using the wizard and selecting the modality of primary key, but the result is the same. It seems that the value of the sequence is not assigned to IF field.

    I guess I don't need to define something more. What can be the cause of this behavior? (Removal and update properly).

    I join with the configuration of the key field and the screenshot of the error and the page layout.

    Thank you

    Daniele

    Hi DanieleT,

    I think you should also consult the validation section.

    There is a chance of validation not null for IDs model of effort, if it is available and then delete.

    or create a sample on apex.oracle.com, which will be easier for users to solve your problem.

    hope this helps you,

    Kind regards

    Jitendra

Maybe you are looking for