Trouble Creating View Using Derived Values From With

I want to use the two values derived from the sql statements in my WITH to use in a view. This is my code:
WITH a AS(
SELECT
CASE
WHEN (SELECT stvterm_code
FROM stvterm
WHERE sysdate >= stvterm_start_date
AND sysdate <= stvterm_end_date) IS NOT NULL
THEN (SELECT stvterm_code
FROM stvterm
WHERE sysdate >= stvterm_start_date
AND sysdate <= stvterm_end_date)
ELSE
(SELECT min(stvterm_code)
FROM stvterm
WHERE stvterm_start_date > sysdate)
END cur_term
FROM dual),
b AS (
SELECT
CASE
WHEN (SELECT substr(cur_term,5, 2) FROM a) = '60' OR (SELECT substr(cur_term,5, 2) FROM a) = '40'
THEN (SELECT substr(cur_term,0, 4)||'20' FROM a)
WHEN (SELECT substr(cur_term,5, 2) FROM a) = '20'
THEN (SELECT to_char(to_number(cur_term)-100) FROM a)
END endof_prior_aidy_term
FROM dual
CREATE OR REPLACE VIEW jbartling.current_term AS
SELECT cur_term, endof_prior_aidy_term
FROM a,bHowever, I get the error ORA-00928: missing SELECT keyword. Is it possible to use WITH like this in creating a view? If not can someone show me another way to accomplish what I'm trying to do?

Hi,
You need to put the CREATE at top, i.e
CREATE OR REPLACE VIEW jbartling.current_term AS
WITH a
SELECT ..  FROM a,bRegards
Peter

Similar Messages

  • Can you use the value from a numeric indicator in a numeric control?

    Hi!
         I have to develop a code where I have to find the maximum value of a waveform and draw a line at 50% of the value. So I chose to find the amplitude of say 10 cycles of waveforms and found the maximum value out of the amplitudes. 
    But my real problem is, I have to use the maximum amplitude value that I get from the max. array VI and put it back in program to calculate the 50% value. 
    So is it possible to use the value from a numeric indicator and put it in a numeric control? Like in MATLAB or C, you give the variable a name and use it later to do any computations. Is it possible to do something similar in LabVIEW? 
    Solved!
    Go to Solution.

    Hi!
         Thank you very much for taking some time out. I have been trying to do this since 2 months and I am stuck right where I am.
    The situation is, I have to calculate the amplitude of the irregular waveform for a few trials and then find the maximum amplitude out of the trials and display a line at whatever % of amplitude the user chooses. I tried using property nodes but I am getting Error 1055 for some unknown reason. Then I decided to draw the line using DC offset but it turns out it calculates the amplitude each time and so the line keeps dancing everytime. Now my challenge is to have the amplitude calculated for say, 20 loops and then calculate the max from that. I ran out of ideas so I am posting here. I am using LabVIEW version 8, and I'll upload a few of my attempts. I hope I am not troubling you'll much.
    Attachments:
    amplitude display.vi ‏217 KB
    amplitude display 1.vi ‏148 KB
    Using property node.vi ‏56 KB

  • How to use Special value set with Column clause to display addtional column

    hi
    can anyone tell me
    How to use Special value set with Column clause to display addtional column
    how can i use FND POPID and with COLUMN clause ?

    Dear Yaseen,
                To get the value in formula cumulative,after you have created the formula for that particular key figure,go to edit and click on tab "calculations".
    In that select overall result as 'count all values not equal to zero' and single result as 'count all values not equal to zero' .
    And mark the cumulative check box underneath.
    I hope you get the desired result and please do me favour .
    Sumit goomber

  • How to derive value from another variable and use it to read master data?

    Hi,
    I have following case:
    First I need to read the value from Cost Center -variable (ZIPCC) and then I need to use that value to determine the home currency of that cost center from the cost center master data table (field: OBJ_CURR).
    I know to basic idea on how to do this, but don't seem to get the syntax correct. Could someone point me in the right direction?
    So the objects in play are:
    ZIPCC = Cost center selection variable (mandatory, single value)
    ZIPCUR = Cost Center Currency variable (customer exit, single value)
    0COSTCENTER
    0OBJ_CURR = Field in cost center master data
    Help will be greatly appreciated!
    -m

    Hi,
    Thank you very much for your example I can see that this logic works! However I'm experiencing trouble in selecting the 0OBJ_CURR
    This kind of declaration isn't working: "D1 Like /BIC/0OBJ_CURR."
    And the same goes for the Selection:
    "Select single OBJ_CURR into D1 from /BI0/PCOSTCENTER where COSTCENTER = i_t_var_range-low."
    This is where my syntax also went wrong.
    0OBJ_CURR is a unit, is there a special way to declare it and use it in the code?
    (and 0CURRENCY is a reference unit for 0OBJ_CURR).
    Do you have adivce on this?
    -miikka

  • Trouble Creating View on External Table in Diff Schema

    I am unable to create a view in a different schema on an external table in a different schema, even when I am connected to my database as SYS as SYSDBA.
    CREATE VIEW WH1.EXT1VIEW AS SELECT * FROM WH1.EXT1VIEW;
    returns the error:
    ORA-06564: object ER_ADMIN_DIR does not exist
    I created a directory:
    CREATE DIRECTORY ER_ADMIN_DIR AS 'C:\ER_Init';
    Granted privs:
    grant read,write on directory ER_ADMIN_DIR to public;
    Created the external table EXT1 in a different schema WH1:
    CREATE TABLE WH1.EXT1 (TABLE_NAME VARCHAR2(100), COLUMN_NAME VARCHAR2(100))
    ORGANIZATION EXTERNAL (TYPE ORACLE_LOADER DEFAULT DIRECTORY SYS.ER_ADMIN_DIR
    ACCESS PARAMETERS
    (RECORDS DELIMITED BY NEWLINE
    FIELDS TERMINATED BY ','
    MISSING FIELD VALUES ARE NULL
    LOCATION ('FILE1.TXT')
    REJECT LIMIT UNLIMITED;
    I can query from the table successfully connected as SYS:
    SQL> select count(*) from wh1.ext1;
    1008
    1 row selected.
    However when I try to create a view on that table connected as SYS:
    CREATE VIEW WH1.EXT1VIEW AS SELECT * FROM WH1.EXT1VIEW;
    I get the following error:
    ORA-06564: object ER_ADMIN_DIR does not exist
    I can connect over to the WH1 schema and create the view successfully, however due to a specific situation I need to be able to create the view from the SYS schema. I can create the view FORCE and it creates with compilation errors, however the view cannot be compiled successfully from SYS.
    Is there a known bug on creating views on external tables remotely?
    Thanks for any help!
    Tina

    I have been able to reproduce your error, using scott instead of sys, and resolve it, as demonstrated below. The combination that I found that worked consisted of having wh1 grant select on ext1 to scott explicitly and using set current_schema to wh1, so that ext1view did not require the wh1 qualifier.
    scott@ORA92> CREATE USER wh1 IDENTIFIED BY wh1
      2  /
    User created.
    scott@ORA92> GRANT CONNECT, RESOURCE TO wh1
      2  /
    Grant succeeded.
    scott@ORA92> CREATE OR REPLACE DIRECTORY er_admin_dir AS 'c:\er_init'
      2  /
    Directory created.
    scott@ORA92> CREATE TABLE wh1.ext1
      2    (table_name  VARCHAR2(100),
      3       column_name VARCHAR2(100))
      4  ORGANIZATION EXTERNAL
      5    (TYPE ORACLE_LOADER
      6       DEFAULT DIRECTORY er_admin_dir
      7       ACCESS PARAMETERS
      8         (RECORDS DELIMITED BY NEWLINE
      9          FIELDS TERMINATED BY ','
    10          MISSING FIELD VALUES ARE NULL)
    11       LOCATION ('file1.txt'))
    12  REJECT LIMIT UNLIMITED
    13  /
    Table created.
    scott@ORA92> CREATE OR REPLACE VIEW wh1.ext1view AS SELECT * FROM wh1.ext1
      2  /
    CREATE OR REPLACE VIEW wh1.ext1view AS SELECT * FROM wh1.ext1
    ERROR at line 1:
    ORA-06564: object ER_ADMIN_DIR does not exist
    scott@ORA92> CONNECT wh1/wh1
    Connected.
    scott@ORA92> @ LOGIN
    scott@ORA92> SET ECHO OFF
    GLOBAL_NAME
    [email protected]2
    wh1@ORA92> GRANT SELECT ON ext1 TO scott
      2  /
    Grant succeeded.
    wh1@ORA92> CONNECT scott/tiger
    Connected.
    wh1@ORA92> @ LOGIN
    wh1@ORA92> SET ECHO OFF
    GLOBAL_NAME
    [email protected]A92
    scott@ORA92> ALTER SESSION SET CURRENT_SCHEMA = wh1
      2  /
    Session altered.
    scott@ORA92> CREATE OR REPLACE VIEW ext1view AS SELECT * FROM wh1.ext1
      2  /
    View created.
    scott@ORA92> ALTER SESSION SET CURRENT_SCHEMA = scott
      2  /
    Session altered.
    scott@ORA92> SELECT * FROM wh1.ext1view
      2  /
    TABLE_NAME
    ---------------------------------------------------------COLUMN_NAME
    ---------------------------------------------------------tab1
    col1
    tab2
    col2
    scott@ORA92>

  • Creating Views using XSU PL/SQL API.Urgent please.

    Folks,
    I need some help in creating a View.
    I am using XSU PL/SQL to generate an XML Document.
    I have a table (SDI) with 2 cols CMPY_NUM and CPTY_BORG_NUM.
    If the values in these 2 cols are equal then the xml
    value to be returned is 'OURS' else return 'THEIRS'.
    How do I Create this View please?
    The XSU PL/SQL I am using to generate the XML is:
    declare
    queryCtx DBMS_XMLquery.ctxType;
    xmlResult CLOB;
    begin
    queryCtx := DBMS_XMLQuery.newContext('select CMPY_NUM,CPTY_BORG_NUM from SDI');
    xmlResult := DBMS_XMLQuery.getXML(queryCtx);
    DBMS_XMLQuery.closeContext(queryCtx); -- you must close the query handle..
    end;
    Output
    <?xml version='1.0'?>
    <ROWSET>
         <ROW num="1">
         <CMPY_NUM>1</CMPY_NUM>
    <CPTY_BORG_NUM>2/CPTY_BORG_NUM>
         </ROW>
    <!-- additional rows ... -->
    </ROWSET>
    Please can any one tell me how to create a view that will be used in place
    of the select statement,and returns back OURS or THEIRS
    Create View XML AS

    This is a duplicate of this posting Creating a View to check for 2 conditions.. This is a particularly heinous case because some of our finest minds have already responded in that thread.
    Lose ten culture points.
    Regards, APC

  • Trouble Creating Views

    I'm not sure if this is a SQL Developer issue or a SQL issue, so if I'm in the wrong place, someone please let me know.
    Using SQL Developer 1.5.0.53, I'm trying to create a view. I've written my SQL for the view and I can run it in a SQL worksheet and it works just like I expect. So I go to my "Views" folder, right click and choose "New View" and enter the exact same SQL (without a semicolon at the end) that works in the SQL worksheet into the "SQL Query" window of the "Create View" dialog box. Then when I press the "Test Syntax" button I get the following error message
         The SQL syntax is valid, however the query is invalid or uses functionality that is not supported.
    This error sort of ticks me off, so I go to the SQL Worksheet and do a
         CREATE OR REPLACE FORCE VIEW… bla bla bla
    And it creates my view, and it seems to work just like I expect it to. Does anyone have any ideas why I can manually create this view in a SQL worksheet, but not through the "New View" dialog box?
    Below is the exact SQL I use to create my view
    SELECT
    "HS_FPR_ACCOUNT_T"."PARENT" "PARENT",
    "HS_FPR_ACCOUNT_T"."CHILD" "CHILD",
    "HS_FPR_ACCOUNT_T"."CHILD_ALIAS" "CHILD_ALIAS",
    "HS_FPR_ACCOUNT_T"."CHILD_STORAGE" "CHILD_STORAGE",
    "HS_FPR_ACCOUNT_T"."CHILD_AGG" "CHILD_AGG",
    "HS_FPR_ACCOUNT_T"."VAR_REPORTING" "VAR_REPORTING",
    "HS_FPR_ACCOUNT_T"."TIME_BALANCE" "TIME_BALANCE",
    "HS_ACCOUNT_MEMBER_V"."MEMBERFORMULA" "MEMBERFORMULA",
    level "PARENT_GEN"
    FROM
    "HS_FPR_ACCOUNT_T" "HS_FPR_ACCOUNT_T" left outer join "HS_ACCOUNT_MEMBER_V"
    on "HS_FPR_ACCOUNT_T"."CHILD" = "HS_ACCOUNT_MEMBER_V"."NAME"
    start with PARENT = 'Account'
    connect by prior CHILD= PARENT
    order by level,
    decode(CHILD, 'ZZZZZZ', '0',
    'COP', '1',
    'ZZZZ'),
    CHILD
    and it gives me this error:
    The SQL syntax is valid, however the query is invalid or uses functionality that is not supported.
    Cannot find relation "HS_ACCOUNT_MEMBER_V".
    Any insight anyone might have on this would be appreciated.
    Thanks

    I had this same problem.
    You have a corrupted file somewhere in this directory:
    C:\Documents and Settings\<your_user_name>\Application Data\SQL Developer
    Before you read further, recognize that this may be the default directory where sql developer will put your sql files, so make sure you don't harm those! Plus, you will lose your preferences and database connections, so make sure you know how to set them up again before you continue. Backups of this directory would be wise. :)
    I solved this problem (and a host of others, by the way), by deleting this directory (after backing up my sql files elsewhere) and running sql developer again.
    Of course, I lost all the preference settings, database connections, etc., so I had to type those in again.
    I believe it happened by importing a set of preferences built on another machine, but I haven't had time to go back and prove that.

  • How to use Boolean values from 2 different sources to stop a while loop?

    I am working on a program for homework that states E5.4) Using a single Whil eLoop, construct a VI that executes a loop N times or until the user presses a stop button. Be sure to include the Time Delay Exress Vi so the user has time to press the stop botton. 
    I am doing this right now but it seems as though I can only connect one thing to the stop sign on th while loop. It won't let me connect a comparision of N and the iterations as well as the stop button to the stop sign on the while loop. So how would I be able to structure it so that it stops if it receives a true Boolean value from either of the 2 sources (whichever comes first)? 
    Basically, I cannot wire the output of the comparison of N and iterations as well as the stop button to the stop button on the whlie loop to end it. Is there a solution?
    Thanks!
    Solved!
    Go to Solution.

    Rajster16 wrote:
    Using a single Whil eLoop, construct a VI that executes a loop N times or until the user presses a stop button. 
    Look in the boolean palette for something similar to the word hightlighted in red above.
    LabVIEW Champion . Do more with less code and in less time .

  • Select option "Show this View : in Folder of Content type : {Custom Content Type Name}" while creating view using CSOM

    Hi,
    I am trying to create "View" in a Document Library and need to enable following:
    1. Mark as default View
    2. Folders -> Show this view : in Folders of Content Type : {Custom Content Type name}
    I am using following code which sets "in Folders of Content Type : " to "Folder" rather than selecting custom content type despite passing Content Type ID of custom content type.
    code:
    var itemContentTypes = clientContext.LoadQuery(web.AvailableContentTypes.Where(ct => ct.Name == viewContentType));
    clientContext.ExecuteQuery();
    var itemContentType = itemContentTypes.FirstOrDefault();
    view.ContentTypeId = itemContentType.Id;
    view.DefaultViewForContentType = true;
    view.Update();
    clientContext.ExecuteQuery();
    Please highlight what seems to be missing?
    Thanks
    Sonal

    Hi,
    Before you set the content type ID for the view, you need to add the custom content type to the library firstly.
    You can add the content type to library using OOTB feature “Add from existing site content types” in library settings or using Client Object Model.
    Here is a code snippet for your reference:
    var list = context.Web.Lists.GetByTitle(listTitle);
    list.ContentTypesEnabled = true;
    var contentType = context.Site.RootWeb.ContentTypes.GetById("0x0120");
    list.ContentTypes.AddExistingContentType(contentType);
    context.ExecuteQuery();
    More information about add exist content type using Client Object Model:<o:p></o:p>
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.contenttypecollection.addexistingcontenttype%28v=office.15%29.aspx
    Best regards,
    ZhengyuGuo
    Zhengyu Guo
    TechNet Community Support

  • Displaying Customer Exit Variable with derived value from another ODS

    Hi All,
    Sorry if this question has been answered before.  I searched the forums and could not find anything specific to my problem.
    I am new to BEx Query.  Customer is requesting a variable(s) be created which will be displayed as a column along with other CKF and RKF.  This query is a payroll query for US/Canada.  This new variable will be based on the user input date for the query.  We are to take this date and go look up the actual pay date for the pay period to which the user input date belongs.  The pay date is stored in another ODS.
    So far, as far as the changes to the Customer Exit ZXRSRU01 are concerned, I would perform the logic when I_STEP = 2.  Do a basic selection off the second ODS, derive the pay date, and store in range table E_T_Range.
    The data displayed off the user input date is displayed in rows.  This is done six times, going back seven days for each row (first row is data for period user entered date to user entered date - 7 days; second row is data for period user entered date - 7 days to user entered date - 14 days; etc ...).  For this to happen  correctly, I am assuming the variable(s) are to to have characteristic types 'Not ready for input', 'Mandatory', 'Customer Exit', and 'Single Value'.
    My question is ... How do I display the six variables in columns (how are they to be defined in the query) and the characteristics I list above, are they correct? Does this need to be a replacement path variable?
    Thanks.
    Edited by: Amir Hasan on Jun 11, 2009 6:24 PM
    Edited by: Amir Hasan on Jun 11, 2009 6:25 PM

    Hi Amir,
    What i can understand from u r requirement is you want to few columns that will show something like below,
    User entered date = x
    Period of X to Period of (X-7)       Period of X to Period of (X-14).....
    This can be done by CMOD for variable only.
    Logic steps :
    1) Take the user input.
    2) Find out the period by using T009B table and store in temp variable.
    3) Do day -7 and find out period for the same
    4) Assing period of X to ls_range-high range and X-7 to ls_range-low.
    Let me know if you have any doubt
    Regards,
    Viren

  • Trying to create table using Union All Clause with multiple Select stmts

    The purpose of the query is to get the Substring from the value for eg.
    if the value is *2 ASA* then it should come as ASA
    where as if the value is *1.5 TST* the it sholud come as TST like wise for others too.
    I am trying to execute the below written SQL stmt but getting error as:
    *"ORA-00998 must name this expression with the column alias 00998.00000 - Must name this expression with the column alias"*
    CREATE TABLE TEST_CARE AS
    SELECT row_id, old_care_lvl,SUBSTR(old_care_lvl,3), len FROM test_care_lvl
    WHERE LENGTH(old_care_lvl) =5
    UNION ALL
    SELECT row_id, old_care_lvl,SUBSTR(old_care_lvl,3), len FROM test_care_lvl
    WHERE LENGTH(old_care_lvl) =7
    UNION ALL
    SELECT row_id, old_care_lvl,SUBSTR(old_care_lvl,3), len FROM test_care_lvl
    WHERE LENGTH(old_care_lvl) =14
    UNION ALL
    SELECT row_id, old_care_lvl,SUBSTR(old_care_lvl,3),LEN FROM test_care_lvl
    WHERE LENGTH(old_care_lvl) =7 AND old_care_lvl ='Regular'
    I want to create the table using the above given multiple select using the Union ALL clause but when trying to create run the query getting error as "ORA-00998 must name this expression with the column alias 00998.00000 - Must name this expression with the column alias"
    Please guide me how to approach to resolve this problem.
    Thanks in advance.

    When you create a table using a SELECT statement the column names are derived from the SELECT list.
    Your problem is that one of your columns is an expression that does not work as a column name SUBSTR(old_care_lvl,3)What you need to do is alias this expression and the CREATE will pick up the alias as the column name, like this:
    CREATE TABLE TEST_CARE AS
    SELECT row_id, old_care_lvl,SUBSTR(old_care_lvl,3) column3, len FROM test_care_lvl
    WHERE LENGTH(old_care_lvl) =5
    UNION ALL
    SELECT row_id, old_care_lvl,SUBSTR(old_care_lvl,3), len FROM test_care_lvl
    WHERE LENGTH(old_care_lvl) =7
    UNION ALL
    SELECT row_id, old_care_lvl,SUBSTR(old_care_lvl,3), len FROM test_care_lvl
    WHERE LENGTH(old_care_lvl) =14
    UNION ALL
    SELECT row_id, old_care_lvl,SUBSTR(old_care_lvl,3),LEN FROM test_care_lvl
    WHERE LENGTH(old_care_lvl) =7 AND old_care_lvl ='Regular'
    );You may not like the name "column3" so use something appropriate.

  • Using the values from a drop down list to display in a separate cell

    Hi all,
    I must apologise if I don;t use the right 'terminology' as I am just an ordinary guy who uses a mac. I am also deaf which means I am totally dependant on the internet for fixing solutions.
    Basically, I wanted to create a drop down list which I had no problem doing.
    In the drop down, I have the options One-Piece, Two-Piece and Three-Quarter.
    I would like to get it so that when I select the One-Piece, the value of 160 appears in a separate cell. If I select Two-Piece, then I would need 130 to appear in that separate cell. Likewise, Three-Quarter to produce 150.
    Just to clarify, if we had a two-column and one row table, then the drop-down would be in A1, which the values would appear in B1.
    I do not know the formula, and cannot find any instructions anywhere as I am probably using the wrong terminology or function name!
    Any help would be much, much appreciated..
    Carl

    I don't guess what I may add.
    The contents of the table named lookup appear on the screenshot.
    cell A1 contains the string One-Piece, cell B1 contains the 'associated' value 160.
    cell A2 contains the string Two-Piece, cell B2 contains the 'associated' value 130.
    cell A3 contains the string Three-Quarter, cell B3 contains the 'associated' value 150.
    Now table Main
    In column B the cells contain a pop_up menu with four items like the ones described by Jerrold.
    In column C of the cells contain the formula :
    =IFERROR(VLOOKUP(B,Tableau 2 :: A:B,2,FALSE),"")
    I enhanced it since yesterdays because I forgot to treat the case when cell is blank in column B.
    I apologize but as I'm using my machine in French, the screenshot display the French formulas.
    I repeat that you may find useful infos in the PDFs files which we may download from the menus:
    Help > Numbers User Guide
    Help > iWork Formulas and Functions User Guide
    As you are in Stoke-on-Trent maybe your system is set to use the comma as decimal separator.
    If it's that, you must replace the comma by semi-colons in the formulas (you may see them in my screenshot).
    Yvan KOENIG (VALLAURIS, France) mercredi 24 mars 2010 09:27:53

  • Can we create LOV using free hand sql with out hardcoding

    Hi gurus,
    Dear All,
    For some of the reporst we don't have universe, so we use to get the report with the help of free hand sql,
    but here I have to hardcode the list of values by using @prompt, but instead of hardcoding is there any ways to get the list of vaues  by using @prompt, if then can any one help me out.

    Yes and no.
    When we use a LOV in a universe, the SQL is generated from the object definition. With Free Hand SQL (FHS) there is no universe. However...
    If you create a very simple universe to host your LOV, and then reuse the same prompt text in your FHS then you can fake the LOV. This is not a great solution, but to be honest, FHS is never really a solution that I would consider. You might consider using Crystal to replace Deski in these cases.

  • Connect by Level using count value from record collection

    Hello:
    PROBLEM:
    ) y,(select rownum MonthNo from dual connect by level <= Cnt)
    Causes ORA-00904 Invalid identifier. Why can’t I use “Cnt” from my main query as using a constant works?
    The count value is determined for each date range in How can I return the records I need?
    Thanks, Sidney
    BACKGROUND:
    I need to be able to display a list of tax returns to my users and the status of those returns. Physical returns do not exist so it is necessary to create the data records dynamically using appropriate selects. This is not difficult and I thought I could then just use a connect by level to give me the date information so I could calculate and display the individual returns. However oracle is giving me an ORA-00904 when I try to send the “Cnt” value to connect by level. Everything works fine when I provide a constant instead of “CNT”. The “CNT” value is determined by a complex process that computes the start and stop dates for multiple return types, etc. as well as the number of periods and filing frequency. The data has to be dynamically generated using a master record which then yields the coding history from which my basic record collection is selected. Here is the result of that process:
    TaxpayerNo,TaxClass,TaxCode,FilingFequency,StartDate,StopDate,Cnt,Frequency
    10 S 1 M 6/1/2007 11/30/2008 18 12
    10 S 2 M 11/30/2008 9/30/2009 10 12
    10 S 2 Q 11/30/2010 8/18/2011 3 4
    10 L 8 A 6/1/2007 9/30/2009 3 1
    10 L 8 A 11/30/2010 8/18/2011 1 1
    From this data, I need a record for each individual 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 11/30/2008 9/30/2009 10 12 11/30/2008
    10 S 2 M 11/30/2008 9/30/2009 10 12 12/30/2008
    etc.
    DOES NOT WORK
    select y.*,MonthNo,Add_Months(StartDate,MonthNo*Frequency) from (
    select x.*,
    (case when FilingFrequency = 'M' then Ceil(Months_Between(StopDate,StartDate))
    when FilingFrequency = 'Q' then Ceil(Months_Between(StopDate,StartDate)/3)
    when FilingFrequency = 'A' then Ceil(Months_Between(StopDate,StartDate)/12)
    else 0
    end) Cnt,
    (case when FilingFrequency = 'M' then 1
    when FilingFrequency = 'Q' then 3
    when FilingFrequency = 'A' then 12
    end) Frequency
    from (
    ... complex code to calculate the values of the start and stop dates needed above...
    ) x
    ) y,(select rownum MonthNo from dual connect by level <= Cnt)
    ERROR MESSAGE
    This returns ORA-00904: "CNT": Invalid Identifier. I don't get an error if I use a constant:
    WORKS USING A CONSTANT BUT MUST HAVE THE ACTUAL CNT VALUE
    ... Same code to generate data ...
    ) y,(select rownum MonthNo from dual connect by level <= 3)
    How can I get this to work using the "CNT" value instead of a constant?

    A technique like this should fix 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?As opposed 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?

  • Filtering a sharepoint 2010 list using Multiple values from Multi-Select Filtering In Infopath 2010 form

    I am creating a browser based InfoPath 2010 form Calendar Filtering
    using SharePoint 2010 Calendar List (All Events) and InfoPath 2010.  This form has data connection to the Calendar list. Goal is to
    compare Calendar Events from Current Year to Previous Year. I have 2 columns called - Previous Year and Current Year. I have 2 drop-down controls in each columns called
    Select Year  and Select Week. I also have common drop down called
    Select Category which holds category of the events such as weather, power outages and so on. I wish to display specific events on specific date and specific week on both columns.
    I am able to filter the list based upon Year and Week
    on both these columns by applying rules in the InfoPath 2010 form. The real issue is that I want to apply category filter on the search result of
    Year and Week. Or it needs to show all the values if I
    select Category value as All. So I wish to apply filter on Search results using Category drop-down list selection.
    Hope I could explain this better but I tried to do the best here. Any suggestions, hint, or pointers
    Thanks
    Snehal H Rana
    Thanks Snehal H.Rana SharePoint Consultant

    I am creating a browser based InfoPath 2010 form Calendar Filtering
    using SharePoint 2010 Calendar List (All Events) and InfoPath 2010.  This form has data connection to the Calendar list. Goal is to
    compare Calendar Events from Current Year to Previous Year. I have 2 columns called - Previous Year and Current Year. I have 2 drop-down controls in each columns called
    Select Year  and Select Week. I also have common drop down called
    Select Category which holds category of the events such as weather, power outages and so on. I wish to display specific events on specific date and specific week on both columns.
    I am able to filter the list based upon Year and Week
    on both these columns by applying rules in the InfoPath 2010 form. The real issue is that I want to apply category filter on the search result of
    Year and Week. Or it needs to show all the values if I
    select Category value as All. So I wish to apply filter on Search results using Category drop-down list selection.
    Hope I could explain this better but I tried to do the best here. Any suggestions, hint, or pointers
    Thanks
    Snehal H Rana
    Thanks Snehal H.Rana SharePoint Consultant

Maybe you are looking for