Connect by level using the count of the records collection

Hello:

PROBLEM:
...
), (select rownum number months of double connect by level < = Cnt)

Causes not valid ORA-00904 identifier. Why can I not use "Cnt" of my main as request by using a constant in the works?

The value of count is determined for each date range in the section, I return the records that I need?

Thank you, Sidney

BACKGROUND:
I have to be able to display a list of tax returns to my users and the status of these statements. There's no physical feedback so it is necessary to create data dynamically records using appropriate selection. It's not hard and I thought that would be enough to use a connection by level to give me the date, statements of information so that I can calculate and display the individual. However oracle gives me an ORA-00904 when I try to send the "Cnt" value to connect by level. Everything works fine when I provided a constant instead of "CNT". The "CNT" value is determined by a complex process that calculates start and end for several types of return dates, etc as well as the number of periods and frequency of production. The data must be generated dynamically using a master record, which then gives the history of coding in which my collection of basic records is selected. Here is the result of this process:

TaxpayerNo, TaxClass TaxCode, FilingFequency, StartDate, StopDate, Cnt, frequency

10 S 1 M 12-18 6/1/2007-11/30/2008
10 S 2 M 12 10 30/11/2008-9/30/2009
10 S, 2 Q 4 3 11/30/2010-8/18/2011
L 10 8 6/1/2007 9/30/2009 3 1
L 10 8 11/30/1 / 2010 8/18/2011 1

According to the results, I have needs a record for each every month, quarter, etc. ie:

10 S 1 M 6/1/2007 11/30/2008 18 12 6/1/2007
10 S 1 M 6/1/2007 11/30/2008 18 12 7/1/2007
10 S 1 M 6/1/2007 11/30/2008 18 12 8/1/2007
10 S 1 M 6/1/2007 11/30/2008 18 12 9/1/2007
...
10 S 2 M 30/11/2008-9/30/2009 10 12 11/30/2008
10 S 2 M 30/11/2008-9/30/2009 10 12 12/30/2008
...
etc.

DOES NOT WORK
Select y.*, MonthNo, Add_Months(StartDate,MonthNo*Frequency) in)
Select x.*,
(case when FilingFrequency = am' then Ceil (Months_Between (StopDate, StartDate)))
When FilingFrequency = 'Q' then Ceil (Months_Between(StopDate,StartDate)/3)
When FilingFrequency = 'A' Ceil (Months_Between(StopDate,StartDate)/12) then
0 otherwise
end) NTC,
(case when FilingFrequency = am' then 1)
When FilingFrequency = 'Q' then 3
When FilingFrequency = 'A' then 12
end) frequency
de)
... a code complex to calculate values of start and stop dates required above...
) x
), (select rownum number months of double connect by level < = Cnt)
ERROR MESSAGE
The result is ORA-00904: "CNT": invalid identifier. I do not get an error if I use a constant:

WORK WITH THE HELP OF A CONSTANT, BUT MUST HAVE THE VALUE OF THE ACTUAL CNT
... Same code for generating data...
), (select rownum number months of double connect by level < = 3)

How can I get it works using the "CNT" value instead of a constant?

A technique like this should solve your problem.

TUBBY_TUBBZ?with data (col1, cnt) as
  2  (
  3    select 1, 3 from dual
  4      union all
  5    select 2, 2 from dual
  6  )
  7  select
  8    d.col1,
  9    t.column_value
 10  from
 11    data  d,
 12    table(cast(multiset(select level from dual connect by level <= d.cnt) as sys.OdciNumberList)) t;

              COL1       COLUMN_VALUE
------------------ ------------------
                 1                  1
                 1                  2
                 1                  3
                 2                  1
                 2                  2

5 rows selected.

Elapsed: 00:00:00.00
TUBBY_TUBBZ?

Contrary to what you have now, which is basically this

TUBBY_TUBBZ?with data (col1, cnt) as
  2  (
  3    select 1, 3 from dual
  4      union all
  5    select 2, 2 from dual
  6  )
  7  select
  8    d.col1,
  9    level
 10  from
 11    data  d
 12  connect by level <= d.cnt;

              COL1              LEVEL
------------------ ------------------
                 1                  1
                 1                  2
                 1                  3
                 2                  2
                 1                  3
                 2                  1
                 1                  2
                 1                  3
                 2                  2
                 1                  3

10 rows selected.

Elapsed: 00:00:00.00
TUBBY_TUBBZ?

Tags: Database

Similar Questions

  • Cannot connect to PayPal using the overdraft facility

    Whenever I try to pay for something (online shopping) by using the PayPal cheque made on another Web site, it will not open a session. I enter my email address and password and just get an error message saying wrong password or e-mail address, even though I know that both are correct. I can connect to PayPal using the facility successfully using Internet Explorer without any problem. I can also connect to PayPal successfully if I go on its website (www.paypal.com.au) in Firefox.

    I tried to clear the cache and cookies associated with Pay Pal, but that did not help at all.

    This problem occurred for months and is quite frustrating.

    I'm using Firefox 48.0.2 (current version). All my extensions and plug-ins are up-to-date. Using Windows 7.

    Update: the problem is probably caused by an extension/add on. I don't know which yet. I can only test it when I buy something, where the reason why it takes me a while to understand.

    Next time I buy something online, I'll test on all extensions / add ons until I find the one who is the cause of the problem. Once I figure out I'll post an answer here.

    Thanks for your help :)

  • To connect to vCenter using the same Session with PowerCLI

    Hi all

    Is it possible that we can establish multiple connections to vCenter using the same session with Powercli.

    As connect-viserver-Server "vcenter1" - domain\domainacnt of the username-password "Password".

    is to establish several connections and we want to limit, because we are in the process of report generation based on the web developing using Powercli with IIS.

    Please suggest.

    You can use the Session parameter on the cmdlet Connect-VIServer .

    I use this for the PowerShell Workflows, see workflow of PowerShell and PowerCLI

  • Hello, we have a company agreement and we are entittled to use the master collection package. Based on thi

    Hello

    We have business agreement and we are entittled to use the master collection package. Based on this, we want to upgrade Flash builder 4.7. Please let us know how can we do it and how to get the keys.

    -Med

    @Anamika018: please contact Adobe volume licensing representative technical support to access Fb 4.7 under a volume license business - they'll be able to give the right for the product.

  • Cannot connect Web site using the browser of Toshiba 32RL958

    Maybe this should not be «so smart TV...» »

    Trying to connect to any site that requires that a password fails. I know that I do not use the wrong password, but according to the website I am returned to the login screen or stay on as "guest".

    Any ideas please. I'm starting to get rather cut with what does not intelligent overall.

    Not clear why this is happening but maybe the browser can't save the cookie that is often necessary to connect to a Web site.
    Check in the settings, if something like this can change, but as much as I know the Internet browser via television does not provide the same options and performance as a common browser like internet explorer, chrome or firefox.
    You wait too long in most cases that you can use it only for common navigation and reading. For more activities smart tv, you need to use the apps.

  • internet connection sharing by using the switch

    I want to share the internet connection using the ethernet switch. the process is the dsl connection to connect to the switch, and then using the ethernet cable, I connect to the computer 1 & 2. the problem is when there is internet connection for comp 1, comp 2 did not and vice versa

    This is because you do not need a 'Switch' - instead, you need a "router".

    A router provides a NAT (NAT) function that will allow more than one device share an Ethernet connection.  If you wish, you can connect a switch out of your router, but cannot connect a switch directly to a DSL modem and expect it to work for multiple devices.

    HTH,
    JW

  • Computer stops connecting to Internet using the Quicken or Google Earth software

    Original title": when you use Quicken or Google Earth software, my computer turns off when you connect to the internet, then I turn on the system and its fine until I try to use Quicken to update my files.

    I use windows xp and a gateway computer

    Hello

    1. you receive an error message when you try to use the software Quicken or Google Earth?

    2. have you made any changes to system settings before the show?

    Try the methods provided below and see if they help to resolve the issue.

    Method 1:

    Perform a clean boot:

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

    How to configure Windows to use a Normal startup state

    After you have used the boot is a way to solve your problem, you can follow these steps to configure Windows XP to start normally.

    (a) click Startand then click run.

    (b) type msconfigand click OK.
    The System Configuration utility dialog box appears.

    (c) click on the general tab, click Normal Startup - load all device drivers and services, and then click OK.

    (d) when you are prompted, click restart to restart the computer.

    Method 2:

    You can uninstall and reinstall applications (software Quicken and Google Earth) and then check if the problem persists.

    To uninstall a program click on the link below.

    How to change or remove a program in Windows XP

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

    Method 2:

    This problem may also occur due to the infection of virus/malware on the computer, you can download and run a full scan using Microsoft Safety scanner and check if this is useful to resolve the issue.

    Microsoft safety scanner

    http://www.Microsoft.com/security/scanner/en-us/default.aspx

    Note:

    The data files that are infected must be cleaned only by removing the file completely, which means that there is a risk of data loss.

    The Microsoft Safety Scanner ends 10 days after being downloaded. To restart a scan with the latest definitions of anti-malware, download and run the Microsoft Safety Scanner again.

    In case you do not have any software Antivirus on the system, then you can download Microsoft Security Scanner which is a free software provided by Microsoft.

    http://www.Microsoft.com/en-us/security_essentials/default.aspx

    Check the event viewer for any error message.

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

  • Limited or No connectivity on XP using the Wi - Fi connection.

    Hello

    My husbands computer recently hit the skids. He was traveling for work and took his personal laptop with him. While trying to access wifi in his hotel room, there is no internet connection icon in the system tray and the connection to the folder in the start menu disappeared. I was able to solve that issue and now all the icons are there and connect to the folder is back. Now, I can't the computer to connect. has said has limited or no connectivity. I have run all kinds of things include reset the winsock and ipconfig and so on and so forth... I need help. I ran: cmd: ipconfig/all, and here's what I have:

    Microsoft Windows XP [Version 5.1.2600]

    Copyright (C) 1985-2001 Microsoft Corp.

    C:\Documents and CAB User > ipconfig/all

    Windows IP configuration

    Name of the host...: new-b34edd382cf

    Primary Dns suffix...:

    ... Node type: unknown

    Active... IP routing: No.

    Active... proxy WINS: No.

    Ethernet connection to the network space 2 card:

    State of the media...: Media disconnected

    ... Description: DP83815 national Semiconductor Corp.

    816 10/100 MacPhyter PCI adapt

    Physical address.... : 00-0D-9D-86-27-77

    Ethernet card 3 wireless network connection:

    The connection-specific DNS suffix. :

    ... Description: Broadcom 802. 11b / g WLAN

    Physical address.... : 00-90-4B-94-B6-95

    DHCP active...: Yes

    Autoconfiguration enabled...: Yes

    ... The IP address: 0.0.0.0

    ... Subnet mask: 0.0.0.0.

    ... Default gateway. :

    DHCP server...: 255.255.255.255

    C:\Documents and User cab >

    With this information, I have it in the hope that someone can help me get the media reconnected... Thank you in advance for your help!

    Susan

    You don't tell us how get you return (restoration or recovery system to factory setting or what?).

    The Ipconfig/all , it seems, your machine does not get the IP address of the router/modem. Try to go through the network card and see if the computer is configured to get anautomatic IP and DNS assigned automatically to the computer.

    Did you check with the hotel if their WIFI works as well as othercustomers using the connection Wireless successfully?

    Also ask them if they provide a password for the WIFI , just in case they are in an urban area and you don't want someone else to their customers access to the Internet.

    You tried to empty the DNS and renew theIP by following these steps:

    Run the command:

    ipconfig/flushdns click on [OK]

    ipconfig/release, click [OK]

    ipconfig / renew click [OK]

    netsh winsock reset click [OK]

    Restart your machine.

    Additionally, make sure that the Automatic Windows Configuration service is enabled in the service control panel:

    Run the command and then type:

    services.msc, click [OK]

    Locate the Automatic Windows Configuration and make sure that it is in auto-start, also disable the Wireless management tool customer utility for the manufacturer of wireless, it can interfere with the automatic configuration.

    You receive a message "Limited or no connectivity" on a computer that is connected to the Internet by a DSL modem or a modem cable after installing Windows XP Service Pack 2
    http://support.Microsoft.com/kb/892896

    Restart your machine.

    Let us know your finidings.

    NASS - http://www.nasstec.co.uk

  • Connect 2 routers using the Wi - Fi connection.

    I have a Netgear router with a wireless antenna connected to the internet via a cable. I want it to spread on my antenna wireless of my Lynksys WRT310N where I have a few computers.

    How could I go about this?

    I read somewhere that I need DD - WRT Firmware. Currently I use the firmware WRT310N parental control features.

    Any help would be appreciated.

    You want a wireless bridge. You cannot configure a wireless router Linksys into a bridge with the Linksys firmware. 3rd party like dd - wrt or tomato firmware should add this feature. Check a dd - wrt or tomato forum for instructions.

  • Unable to connect multiple computers using the router

    Original title: router WiFi has changed

    Hi, my router when initially set up allowed all our computers, phones etc to use the wireless connection, my brother connected to his laptop and now it will allow only one thing to connect both. If another device connects it disconnects one that was originally in line.  Do you know what it changed?

    Hello

    You can also try to contact the manufacturer of the router and try to reset the settings of the router and check if that helps you solve the problem.

  • my wireless connection says "restricted access" no network connection. I used the same key code to get my other computer online

    my wireless connection says "restricted access" no network connection, I used the same key code to get my other computer I can have up to 5 computers online at the same time online.

    Ideas:

    • You have problems with programs
    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem

    Hello

    This means that the computer cannot connect to the router.

    Try this process.

    Check the Device Manager for the wireless card valid entry.

    http://www.ezlan.NET/Win7/net_dm.jpg

    If there is no valid entry, remove any entry from fake and re - install the drivers for the wireless card.

    Check network connections to make sure that you have a network icon/entry wireless connection, and that the properties of the icon (right-click on the icon) are correctly configured with the TCP/IPv4 protocol in the properties of network connections.

    http://www.ezlan.NET/Win7/net_connection_tcp.jpg

    Make sure that if there is Wireless Utility a utility vendor is not running with the native Windows wireless utility.

    Make sure you firewall No. preventing / blocks wireless components to join the network.

    Stack TCP/IP work should look like.

    Right-click on the wireless network connection card, select status, details and see if she got an IP address and the rest of the settings.

    http://www.ezlan.NET/Win7/status-NIC.jpg

    Description is the data of the card making.

    The physical address is MAC of the card number.

    The xx must be a number between 0 and 255 (all xx even number).

    YY should be between 0 and 255

    ZZ should be between 0 and 255 (zz all the same number.)

    The date of the lease must be valid at the present time.

    * Note 1. IP that starts with 169.xxx.xxx.xxx isn't valid functional IP.

    * Note 2. There could be an IPv6 entries too. However, they are not functional for Internet or LAN traffic. They are necessary for Win 7 homegroup special configuration.

    ---------------------------------------------------

    Above everything is OK, you must be able to connect to the router.  A window that says connected does not mean that you are really connected. Connection to the router means that you can enter the IP of the router base in an address bar in one go, being able to connect and configure the router menus see. If it is not connected in the log to router from any computer that can connect to the router wirelessly with a wire, disable wireless security, (make sure that the wireless SSID broadcast) is on and try to connect with no. wireless security.

    --------------------------------------------------

    I really checked and configured every thing and it doesn't work.

    Software firewall application that is not configured to allow local traffic (between the computer and the router is also a possible problem.
    some 3rd party software firewall continue to block the same aspects it traffic Local, they are turned Off (disabled). If possible, configure the firewall correctly or completely uninstall to allow a clean flow of local network traffic. If the 3rd party software is uninstalled, or disables, make sure Windows native firewall is active .

    Jack-MVP Windows Networking. WWW.EZLAN.NET

  • I am unable to connect my system using the microsoft account.

    Separated from this thread.

    Hello

    Unable to connect to my system using microsoft account IAM. I forgot the password, so went online and reset it, try to connect with the new password still showing the error message "your pc is offline. Please sign in with the last password used on this C. P'?

    no idea about my old password and unable to connect with the new password too.

    What is the fix for this?

    Hi Deepika,

    Thanks for posting your query on Microsoft Community forum.

    I would be grateful if you can provide us with the following information to help us better understand the issue.

    1. Do you have any active account except your Microsoft account?
    2. Are able to connect to your e-mail you used as Microsoft account using the new password on the web?

    I suggest you refer to the following articles in order to retrieve your forgotten password.

    What to do if you forget your Windows password

    http://Windows.Microsoft.com/en-us/Windows/what-do-forget-Windows-password#1TC=Windows-8

    Note: When you reinstall Windows, make sure that you must back up all data.

    Return to your Microsoft account if it has been compromised

    http://Windows.Microsoft.com/en-us/Windows-8/get-back-blocked-hacked-account

    Hope this information is useful.

    Thank you.

  • Change an attribute value in a table of the tree at all levels using the control button.

    Hi all

    I use JDeveloper Version 11.1.1.7.0.

    I have set up on my Table from the tree only when selected in the parent level also chooses the checkbox on the levels of the child associated with a checkbox, see my below base schema.

    My method to achieve this was to follow this guide... Andrejus Baranovskis Blog: box support in ADF tree Table different levels

    1. [Checkbox] status. Name | Employee ID

    -> 2 status [Checkbox] | Name | Employee ID | etc. | etc.

    -> 3 status [Checkbox] | Name | Employee ID | etc. | etc. | etc.

    What I want to do now, is once the box is checked at the parent level and all child nodes checkboxes are also selected, is on pressure of a command button, the value of my 'Status' column has changed through all the levels where the check box is checked.

    The default of my column 'State' is 'untrusted', it should be replaced by "Approved" once the Parent level checkbox is checked (which causes the child nodes also be checked) and you press a command button.

    I searched for some pointers on how to do so for some time,

    I was trying to think of a way to use the attribute of checkboxes that is a Boolean data type, there may be a way to create a method that checks if the Boolean attribute = true and where is the value of the Status column should be changed, the problem is to make it through all three levels of the table from the tree. But I can't understand it, any help would be greatly appreciated.

    Thank you

    Kind regards

    Jamie.

    Hi Jamie,

    I guess that you can apply the same idea that you used to update the Boolean attribute box of your iterator. This time you need to do is to iterate exactly same way but update the Status attribute. Have you tried to do this? So while the first course you'll hand over your boolean, check and update status accordingly.

    What keeps you from doing this?

    Concerning

  • How to connect from Twitter (using the API of Twitter ME v 1.9)?

    Hello..

    I am doing an application with twitter and I use the API Twitter ME v1.9

    I am already able to post tweet with her... But is it possible to log on to the twitter application?

    Kind regards

    Eric

    Why not.. When you save the access token. You use any file Storetoken.java for the registration of access token. You can have a method to clear the access token...

  • How to use the record type as a parameter IN PL/SQL procedure or package

    Hi people,

    I need help on the record as the OUT parameter type. I am able to get out a single line as a parameter, but not getting do not idea how to get a multi ranks as output parameter.

    I have the code that works very well for a single line. Please see CODE1.

    But when I try to get several lines, I'm failing to do. Please see the CODE2. I get the error of compilation as


    Error report:

    ORA-06550: line 11, column 35:

    PLS-00487: Invalid reference to the variable "P_NAME.

    ORA-06550: line 11, column 1:

    PL/SQL: Statement ignored

    06550 00000 - "line %s, column % s:\n%s".

    * Cause: Usually a PL/SQL compilation error.

    Any help or a sample execution of script would be really useful.

    Thanks in advance.

    YZ

    --------------------------CODE1------------------------------------------

    -------------------------Package Spec-------------------------------

    CREATE OR REPLACE

    PACKAGE xx_sample_pkg as

    --

    Xx_sample_table_rectype RECORD TYPE IS

    (p_name varchar2 (40))

    number of p_emp_id

    );

    PROCEDURE xx_sample_prc (xx_sample_rec1, OUT xx_sample_table_rectype);

    END xx_sample_pkg;

    ------------------------------Package Body------------------------

    create or replace

    PACKAGE xx_sample_pkg AS BODY

    --

    PROCEDURE xx_sample_prc (xx_sample_rec1 OUT xx_sample_table_rectype) IS

    BEGIN

    SELECT ename, empno

    IN xx_sample_rec1

    FROM scott.emp

    WHERE ename = 'SMITH ';.

    END xx_sample_prc;

    END xx_sample_pkg;

    -------------------------------------------Execute----------------------

    DECLARE

    l_rec_type xx_sample_pkg.xx_sample_table_rectype;

    BEGIN

    dbms_output.put_line ('xx_sample_prc appeal');

    xx_sample_pkg.xx_sample_prc (l_rec_type);

    dbms_output.put_line ('YZ' | l_rec_type.p_name |') '|| l_rec_type.p_emp_id);

    END;

    ---------------------------------------------------------------

    -------------------------CODE2-------------------------------------------

    -------------------------Package Spec-------------------------------

    CREATE OR REPLACE

    PACKAGE xx_sample_pkg as

    --

    Xx_sample_table_rectype RECORD TYPE IS

    (p_name varchar2 (40))

    number of p_emp_id

    );

    PROCEDURE xx_sample_prc (xx_sample_rec1, OUT xx_sample_table_rectype);

    END xx_sample_pkg;

    ------------------------------Package Body------------------------

    create or replace

    PACKAGE xx_sample_pkg AS BODY

    --

    PROCEDURE xx_sample_prc (xx_sample_rec1 OUT xx_sample_table_rectype) IS

    BEGIN

    SELECT ename, empno

    IN xx_sample_rec1

    FROM scott.emp;

    END xx_sample_prc;

    END xx_sample_pkg;

    -------------------------------------------Execute----------------------

    DECLARE

    l_rec_type xx_sample_pkg.xx_sample_table_rectype;

    BEGIN

    dbms_output.put_line ('xx_sample_prc appeal');

    xx_sample_pkg.xx_sample_prc (l_rec_type);

    for l_rec in 1.l_rec_type.p_name.count

    loop

    dbms_output.put_line ('YZ' | l_rec_type.p_name (l_rec) |) » '|| l_rec_type.p_emp_id (l_rec));

    end loop;

    end;

    ---------------------------------------------------------------

    bb8c573a-6ca3-4d7c-90ed-e55c2df67201 wrote:

    But now, my question would be why the record type could not be used? My understanding is missing some concept between use of type type array collection record vs. Please specify.

    Do not confuse the folder with the collection.

    SY.

Maybe you are looking for