Change a query to be dynamic

Hello

Query of the following view shows the months of the year I got it with the help of a Member here Zerathul.
Well, I put it in a view, select month_code and month_desc in a report.
CREATE OR REPLACE VIEW FINANCIAL_YEAR_MONTHS
(MONTH_CODE, MONTH_DESC)
AS 
select  to_char(add_months(FROM_DATE,rn-1),'MM/YYYY') as financial_month, 
month_desc
from (select * from cde_fin_year where fin_year_code = *2007*)
 cross join (select rownum rn from dual connect by rownum <= 12) x
 join cde_month on (cde_month.month_code = to_char(add_months(FROM_DATE,x.rn-1),'MM'))
order by x.rn;
All I want to do is make a dynamic statement not only specified for the year 2007, but throughout the year if I want to change this line to accept any parameter as follows:
from (select * from cde_fin_year where fin_year_code = *2007*)
Kind regards

Abdetu...

from (select * from cde_fin_year where fin_year_code = * 2007 *)

Try this->

from (select * from cde_fin_year where fin_year_code = '&code')

Kind regards.

LOULOU.

Tags: Database

Similar Questions

  • Need to change the name on a dynamic stamp

    How can I change the name on a dynamic stamp in Adobe Acrobat Reader ms? I use the APPROVED stamp and on my computer, it says ' check in time, date "but on other computers of colleague, he made his name. Does anyone know how can I fix?

    I just find it! He was under "Edit identity" when I right click on the stamp!

  • Trying to change stamps to take account of what I mean. How can I change the name of a dynamic stamps

    How can I change the name of the dynamic stamp?

    The name of stamp is part of the name of the page template in the file stamp, so to change it, you can open the stamp file and change the name of the template for the stamp in question. Exactly how do you this depends on which version of Acrobat you are using.

    Acrobat 9: Advanced > Document processing > models

    Acrobat 10/11: Tools > Document processing > models

    Acrobat DC: Tools > organize Pages > more > models

  • How can I change this query to generate a sequence

    This query
     
     select 
     SZSTCLA_PIDM, 
      SZSTCLA_TERM_CODE,
      SZSTCLA_LAST_NAME
      from SZSTCLA,SHRTGPA
     where SZSTCLA_PIDM IN ( 120125,186114)
     AND SHRTGPA_TERM_CODE = SZSTCLA_TERM_CODE
     AND  shrtgpa_pidm  = SZSTCLA_PIDM 
      AND SZSTCLA_RECORDED_EARNED_CRED > 0 
      ORDER BY SZSTCLA_TERM_CODE
    Returns the following results
    SZSTCLA_PIDM     SZSTCLA_TERM_CODE      SZSTCLA_LAST_NAME
    186114     198810     Johnson
    186114     198820     Johnson
    186114     198910     Johnson
    186114     198920     Johnson
    186114     199010     Johnson
    186114     199020     Johnson
    186114     199110     Johnson
    186114     199120     Johnson
    120125     200720     Smith
    120125     200810     Smith
    120125     200820     Smith
    120125     200910     Smith
    120125     200920     Smith
    120125     201010     Smith
    120125     201020     Smith
    120125     201110     Smith
    120125     201120     Smith
    Notice that ruptures in every szstcla_pidm, I need to change the query, so it can display a sequence number for each SZSTCLA_TERM_CODE
    so, it will be like
    SZSTCLA_PIDM     SZSTCLA_TERM_CODE      SZSTCLA_LAST_NAME                                    seq 
    186114                     198810                                     Johnson                         1
    186114                     198820                                     Johnson                         2
    186114                    198910                                     Johnson                         3
    186114                    198920                                     Johnson                         4
    186114                    199010                                     Johnson                         5
    186114                    199020                                     Johnson                         6
    186114                    199110                                     Johnson                         7
    186114                    199120                                     Johnson                         8 
    then
    SZSTCLA_PIDM     SZSTCLA_TERM_CODE      SZSTCLA_LAST_NAME                                      seq 
    
    120125                  200720                                   Smith                             1
    120125                  200810                                    Smith                             2
    120125                  200820                                   Smith                              3
    120125                  200910                                   Smith                              4
    120125                  200920                                   Smith                              5
    120125                  201010                                   Smith                              6
    120125                  201020                                   Smith                              7
    120125                  201110                                   Smith                              8
    120125                  201120                                   Smith                              9

    Looks like below, this is what you are looking for, but I can't understand why some documents are missing from the sample output

        COL1 COL2     SZSTCLT_LAST_NAME              RN
    -------- -------- ------------------------------ --
    
      120125 200920   Smith                           1
      120125 201010   Smith                           2 
    

    Maybe, if you could explain it, the query can be modified to exclude these folders as well. But, for now, downwards should suffice.

    select szstclt_pidm col1, szstclt_term_code col2, szstclt_last_name, row_number() over (partition by szstclt_pidm order by szstclt_term_code) rn
      from szstclt a
           join shrtgpt b on a.SZSTCLT_PIDM = b.SHRTGPT_PIDM and a.SZSTCLT_TERM_CODE = b.SHRTGPT_TERM_CODE
     where SZSTCLT_PIDM IN ( 120125,186114);
    
        COL1 COL2     SZSTCLT_LAST_NAME              RN
    -------- -------- ------------------------------ --
      120125 200920   Smith                           1
      120125 201010   Smith                           2
      120125 201020   Smith                           3
      120125 201110   Smith                           4
      120125 201120   Smith                           5
      186114 198810   Johnson                         1
      186114 198820   Johnson                         2
      186114 198910   Johnson                         3
      186114 198920   Johnson                         4
      186114 199010   Johnson                         5
      186114 199020   Johnson                         6
      186114 199110   Johnson                         7
      186114 199120   Johnson                         8 
    
     13 rows selected 
    
  • want to output changed to query

    SELECT acct.account_name AS $vendor_name,
    Sum (c.total_amt_decry * NVL(c.qty_offered_decry,0)) AS total_amt_offered,
    Sum(d.TOTAL_AMT * d.QTY_OFFERED) AS total_amt,
    b.OID AS oid,
    ACCT.account_ID AS argument account_id
    ACCOUNT acct.
    b payment,
    detail d,
    Description c,
    master has
    value tnc
    WHERE acct.account_id = b.supplier_user_id
    AND a.oid = b.number
    AND tnc.oid = b.oid
    AND b.oid = c.oid
    GROUP BY account_name, b.oid, acct.account_id


    in the above query, I want to choose total_amt_offered as a single column as total

    that contain the output as total_amt_offered if total_amt_offered not null and if the null value, then it should contail value of total_amt.

    I changed the query as below



    SELECT acct.account_name AS $vendor_name,
    (DECODE (f.total_amt_offered, NULL, f.total_amt, f.total_amt_offered, f.total_amt_offered)) AS a total,.

    -Sum (c.total_amt_decry * NVL(c.qty_offered_decry,0)) AS total_amt_offered,
    -SUM(d.TOTAL_AMT * d.QTY_OFFERED) AS total_amt_offered,
    b.OID AS oid,
    ACCT.account_ID AS argument account_id
    ACCOUNT acct.
    b payment,
    detail d,
    Description c,
    master has
    value tnc, (SELECT SUM (c.total_amt_decry * NVL(c.qty_offered_decry,0)) AS total_amt_offered,)
    Sum(d.TOTAL_AMT * d.QTY_OFFERED) AS total_amt OF c and d description details) f
    WHERE acct.account_id = b.supplier_user_id
    AND a.oid = b.number
    AND tnc.oid = b.oid
    AND b.oid = c.oid
    GROUP BY acct.account_name

    But how do you decode the column in the group by its giving error

    has tried?

    SELECT acct.account_name AS vendor_name,
    (DECODE (f.total_amt_offered,NULL,f.total_amt,f.total_amt_offered,f.total_amt_offered)) AS total,
    ...
    GROUP BY acct.account_name
         , DECODE (f.total_amt_offered,NULL,f.total_amt,f.total_amt_offered,f.total_amt_offered)
    
  • Change the query to a display object

    I have a view currently, object based on an entity. It is the default view object, which means that the query the view object is frank, he grabs all the attributes of the table. And there is no WHERE clause.

    Actually, I only want to show a finite set of rows in my table. Whenever a record is modified/edited in this entity and committed, a new row in the database is created with the same information (I use CreateWithParams) with the exception of a few columns.

    I actually didn't really update it on this table, just creating new lines. But to the user, I want it 'looks' like they change something in the table.

    Example:

    12, 11:32, Thompson, 60 (changes to the user this information in a table of the adf and a new line is created in the comic book)

    12, 11:55, Thompson, 75





    I have a timestamp field (see above) in the database that is used as part of my primary key, while I know that is later.

    When executing the query of the VO, I want the user to only see as the last row of the db.

    12, 11:55, Thompson, 75

    Then...

    I went to my VO, and I changed the query WHERE to add this:

    where t1. TimeStamp = (Select MAX (t2. (TimeStamp) OF THE rcl.x t2 where t1.uid = t2.uid);


    Now, this isn't a question of mysql/sql. There is actually a better query I was running, but the editor of the VO does not allow me to change the query itself...

    When I save the new WHERE to my VO, rerun my page, I get the expected result (showing me only the latest recordings).

    However, when I try and do a sort on the table in which are displayed my data, I get now ORDER BY errors.

    I don't want my VO SQL read-only basis. I want to be able to update my table, so I have my VO running out of the entity.



    Why don't the VO allows me to change the query itself? (As do a subquery instead of having my where clause to do the job)

    Why are sorted by errors are thrown when I sort on my adf table after changing the where clause in my opinion?

    I hope I was not too complicated in explanation of my problem...

    Thanks in advance,

    Joel

    Hello

    You can switch the VO query editor based on an EO to expert mode. This allows you to change the entire query. Unless you change the use of the attribute, the update through this VO work. Open the VO query and choose the Expert mode option of the query to see what I mean

    Frank

  • Change SQL database columns to dynamically display objects

    Hello

    I want to put the SQL query of the dynamic view where the number or the name of the column names in the SELECT statement can be different.

    I have a database with 300 columns view and I want to dynamically extract columns only 10 or 15 at a time.

    Is it possible to do?

    This is similar to DBMS_SQL in database to generate the dynamic SQLs.

    for example, the SQL statement may be:

    SELECT A, B from the TAB;

    Or

    SELECT A, B, C, D of the TAB

    Thank you
    Mitesh.

    Mitesh,
    you do not give a lot of information. You use jdev? What version? Using ADF?

    In the case where you use adf see the doc of java of the ApplicationModuleImpl class. This class has two methods to build VO requests (i.e. createViewObjectFromQueryStmt).

    Timo

  • Join the query in a dynamic list of values query

    I have a join query in a dynamic list of values query. The value does not return a value of text, but rather the value of the ID.

    Is it possible to use a join query in a dynamic list of values query?

    For example... in the query below, I expect to see ename in the drop-down list, but I see class_emp_id.

    Select b.ename d, a.class_emp_id r
    of class_emp a, b of the emp
    where a.class_cat_id =: CURR_CLASS_CAT_ID
    and a.emp_id = b.emp_id
    order by 1

    Thank you
    Reid

    Hey Reid,

    The structure of the pairings/value of the item is incorrect - it should be: item1, item2, etc.: value1, value2, etc, so:

    ' f ? p = & APP_ID.: 50: & SESSION. ": P50_LP_ID, P50_LP_NAME, CURR_CLASS_CAT_ID: #LP_ID #, #LP_NAME #, #CLASS_CAT_ID #"

    I guess that CURR_CLASS_CAT_ID does not use the prefix P50_?

    Andy

  • Extend the VO - need to change the query of VO - screen is off

    {Re-post the message in this forum (thanks to John Stegeman to lead me here...)   {Posted: August 28, 2009 04:27}

    Dear all,

    Thanks to this great body of knowledge, I ask my questions.

    I need to extend a VO to display the name of the country.
    The column is not in the VO. So, I need to get another table: FndTerritories

    I want to change the query, but the request frame is turned off (in the wizard the View - step 5 of 6 - Generated statement object substitution)

    Could you be it someone please let me know: how to change the application of the VO in this case?

    OR is there another solution for such cases, to maintain development standards

    Thank you very much

    Kind regards

    Hello

    I think that's when you just have to add an attribute, you should not click the expert mode checkbox... make use of
    Mix and add the button.

    But when you need to modify the query, and then we want to use to modify the query window...

    Thank you
    Gerard

  • How do I dynamically change the query VO

    Hello

    IAM trying to change the VO query dynamically. My forced, it is that I have 6 columns in a page header 3 columns (single default) for objective sort and another 3 columns (the default one) for querying data.

    Al, are in a single view so I created a VO.

    Sort of research
    AN A
    B B
    C C

    When I give all sort values and hit the query of VO submit button should change dynamically.
    I searched old post in this regard.

    My query is something like that

    SELECT * from cust_table where a = NVL (: 1, a)
    UNION
    SELECT * from cust_table where a <>NVL (: 1, a)
    order by one

    IAM not trying the Sub part dynamicaly in my AM method
    vo.setWherecaluse ("where a = NVL (: 1, a)")
    UNION
    SELECT * from cust_table where a <>NVL (: 1, a)
    order by one ").
    and trying to pass parameters to the query. But it does not work. In error "variable binding is not found.

    The one you suggest how to solve the problem.


    Thank you
    Mahesh

    Mahesh

    Please let me know the logic behind the union of the same query with it. What is the problem you are having with
    vo.setWhereClause

    Thank you
    AJ

  • How to query a Subvi dynamically loaded to its input terminals names?

    Hello

    I have an application where I use dynamically load the Subvi and I need a way to query the Subvi for its names of input terminals.  I'll use several different Subvi now and in the future and will not experience the terminals.

    Any help would be greatly appreciated.

    Thank you in advance!

  • PS CS6 video editing, change in position of the dynamic object

    Hello

    Correct me if I am mistaken in my project, I want to make a couple of small clips to appear on the screen and the change of position. I so in order for me resize a clip to convert object dynamic, right? But it seems that I can't use a 'position' function more on dynamic objects, (it disappeared). So, how can I transform an object while being able to use the tool "position? Is it work around?

    Kind regards

    Bart

    Instead of position, you will see " transformed" in the timeline that contains the positions and all other transformations.

    Transform of use both on the smart object

  • Changes to engage in all dynamic regions

    JDeveloper 11.1.1.6

    I have a main page with 6 links dynamic region, a region and the buttons Commit / Rollback.

    When I click on one of the links, a different workflow id is returned and the page fragment associated with that workflow is displayed in the region.

    Each page fragment has an af:table which is based on a VO/BC.

    When I try to validate a change in the fragment of the displayed page, nothing is saved.

    I assume this has something to do with the scopes, but I don't know where the problem may be.

    I also noticed that when I make a change (to a field in a table), click on another link and return to the first link, the change is no longer there.

    What would cause validation to not see the change within the region?

    Thank you.

    HU,

    1. What is the scope of the taskflows DC: shared or isolated?

    2. do the validation button has immediate = false set?

    3. where is the commit treated in the region?

    4. What is the parameters of the taskflow?

    5. make sure a validation before moving to an another taskflow?

    Frank

  • Trying to change a query to return funds and no values only. XMLELEMENT and used UNPIVOT

    So I have a request to work but I want to change it to provide some totals and not only RAW files the request is lower with the changes that I've made being in RED:

    ----------

    DECLARE

    letexte CLOB.

    BEGIN

    with test_table as)

    SELECT VM_REPORT_DATE,Sum (Quantity) quantotal, point,

    (CASE point

    WHEN "VM_HOSTS_NUM" AND THEN "

    WHEN "VM_NUMBER" AND THEN "

    WHEN "VM_CPU_COUNT" AND THEN "

    WHEN "VM_PHYS_MEM" THEN "y_axis_2".

    WHEN "VM_VIRT_MEM" THEN "y_axis_2".

    WHEN "VM_VIRT_MEM" THEN "y_axis_2".

    WHEN "VM_TOTAL_DISK" THEN "y_axis_3".

    WHEN "VM_PROVISIONED_DISK" THEN "y_axis_3".

    ELSE 'y_axis.

    Wser END)

    ,

    (CASE point

    WHEN "VM_HOSTS_NUM" THEN "#FF0000".

    WHEN 'VM_NUMBER', THEN '#AA0000 '.

    WHEN "VM_CPU_COUNT" THEN "#770000".

    WHEN "VM_PHYS_MEM" AND THEN "#0000FF".

    WHEN 'VM_VIRT_MEM' THEN ' #0000AA '.

    WHEN "VM_VIRT_MEM" AND THEN "#000077 '."

    WHEN "VM_TOTAL_DISK" AND THEN "#00FF00".

    WHEN "VM_PROVISIONED_DISK" AND THEN "#00AA00.

    ELSE 'y_axis.

    Colorr END)

    of VM_CORE unpivot)

    ITEM quantity in (VM_HOSTS_NUM, VM_NUMBER, VM_PHYS_MEM, VM_VIRT_MEM, VM_CPU_COUNT, VM_TOTAL_DISK, VM_PROVISIONED_DISK)

    () where VM_REPORT_DATE > (SELECT ADD_MONTHS (TRUNC (SYSDATE),-1) from DUAL) Group of VM_REPORT_DATE, item)


    SELECT XMLSERIALIZE)

    CONTENT XMLELEMENT ('data', XMLAGG (XMLELEMENT ("series", xmlAttributes (point as "name", "Line" as the "type", wser as "y_axis", colorr as "color"),

    XMLAGG)

    XMLElement ("point", xmlAttributes (VM_REPORT_DATE as 'name',quantotal 'y')) order by VM_REPORT_DATE

    )

    ))

    )

    )

    in the Group test_table letexte by order of point by point.

    dbms_output.put_line (TheText);

    END;

    ----------

    Select 'WITH TABLE AS' returns that I wait for him.

    VM_REPORT_DATEQUANTOTALAGENDAWSERCOLORR
    20 OCTOBER 13 00:00:005224.39VM_VIRT_MEMy_axis_2#0000AA
    20 OCTOBER 13 00:00:001789VM_CPU_COUNT#770000
    20 OCTOBER 13 00:00:00153348.16VM_PROVISIONED_DISKy_axis_3#00AA00
    NOVEMBER 12-13 00:00:00829VM_NUMBER#AA0000
    20 OCTOBER 13 00:00:0042VM_HOSTS_NUM#FF0000
    20 OCTOBER 13 00:00:007343.09VM_PHYS_MEMy_axis_2#0000FF
    4 NOVEMBER 13 00:00:00822VM_NUMBER#AA0000
    4 NOVEMBER 13 00:00:005243.38VM_VIRT_MEMy_axis_2#0000AA
    NOVEMBER 12-13 00:00:00190985VM_TOTAL_DISKy_axis_3#00FF00
    27 OCTOBER 13 00:00:0042VM_HOSTS_NUM#FF0000
    27 OCTOBER 13 00:00:00832VM_NUMBER#AA0000
    27 OCTOBER 13 00:00:00153423.89VM_PROVISIONED_DISKy_axis_3#00AA00
    4 NOVEMBER 13 00:00:00190444.75VM_TOTAL_DISKy_axis_3#00FF00
    NOVEMBER 12-13 00:00:0042VM_HOSTS_NUM#FF0000
    20 OCTOBER 13 00:00:00836VM_NUMBER#AA0000
    20 OCTOBER 13 00:00:00185519.5VM_TOTAL_DISKy_axis_3#00FF00
    27 OCTOBER 13 00:00:007343.09VM_PHYS_MEMy_axis_2#0000FF
    4 NOVEMBER 13 00:00:0042VM_HOSTS_NUM#FF0000
    NOVEMBER 12-13 00:00:00155937.43VM_PROVISIONED_DISKy_axis_3#00AA00
    27 OCTOBER 13 00:00:00186059.75VM_TOTAL_DISKy_axis_3#00FF00
    4 NOVEMBER 13 00:00:007343.09VM_PHYS_MEMy_axis_2#0000FF
    4 NOVEMBER 13 00:00:00154795.62VM_PROVISIONED_DISKy_axis_3#00AA00
    27 OCTOBER 13 00:00:005215.39VM_VIRT_MEMy_axis_2#0000AA
    NOVEMBER 12-13 00:00:005270.38VM_VIRT_MEMy_axis_2#0000AA
    27 OCTOBER 13 00:00:001781VM_CPU_COUNT#770000
    4 NOVEMBER 13 00:00:001782VM_CPU_COUNT#770000
    NOVEMBER 12-13 00:00:007343.09VM_PHYS_MEMy_axis_2#0000FF
    NOVEMBER 12-13 00:00:001797VM_CPU_COUNT#770000

    However the overall query returns:

    Error report:

    ORA-00979: not a GROUP BY expression

    ORA-06512: at line 6

    00979 00000 - "not a GROUP BY expression"

    * Cause:

    * Action:

    6 is the line "with test_table as.

    You need to group by all the columns at the same level of aggregation, i.e. WSER and COLORR thus:

    SELECT XMLSERIALIZE (CONTENT

    XMLELEMENT ("data"

    XMLAGG)

    XMLELEMENT ("series"

    xmlAttributes)

    element in the form 'name '.

    , 'Line' as 'type '.

    , wser as "y_axis.

    , colorr have "color".

    )

    XMLAGG)

    XMLElement ("point"

    xmlAttributes)

    VM_REPORT_DATE as 'name '.

    , quantotal 'y '.

    )

    )

    order of VM_REPORT_DATE

    )

    )

    )

    )

    )

    from test_table

    Group by element, wser colorr

    ;

  • Query on the dynamic view v$ parameter

    That means the column 'ISSYS_MODIFIABLE' in the parameter $ v? According to the documents, if it is 'FALSE' - parameter is not editable with ALTER SYSTEM unless a server settings file was used to start the instance. The change takes effect in subsequent instances. 'this means that it is a static parameter if the value is false, for example, I checked for the parameter 'db_file_name_convert', the value is considered as false when started with the pfiles and spfiles, until this means, a 'FALSE' value always indicates that the setting is static.

    False means that it cannot be changed dynamically.

    If you use a SPFILE you can change the setting and Oracle will save the new setting in the SPFILE, but it will not change the current instance.

    It will be used when this SPFILE alteration is used to start the instance, next time.

Maybe you are looking for