Hi how will get subquery returns multiple values for main query

Hi all ;
here i given one sql query
1)select decode(a.FLG,'Y','yes','N','no','null')||'] '||a.p_type||' : '|| initcap(replace(substr(b.mgr,0,instr(b.mgr,'@')-1),'.',' '))||' - '||
b.name||' ('|| substr(a.name,0,instr(a.name,'-')-1)||')'
from table1 a
join table3 c on c.emptype = a.emptype
left outer join table2 b on a.name = b.name
where a.mgrid = 100;
if i run this above query returning multiple values depend on sa.mgr values.
like output coming like this
yes:2000-anbarasan
yes:2700-anb
yes:2000-rasan
yes:2807-anbarasan
yes:2700-anbanu
yes:2000-null
2) this sub query i am passing with main query
select sa.mgrid,sa.sal,(select decode(a.FLG,'Y','yes','N','no','null')||'] '||a.p_type||' : '||
initcap(replace(substr(b.mgr,0,instr(b.mgr,'@')-1),'.',' '))||' - '||
b .name||' ('|| substr(a.name,0,instr(a.name,'-')-1)||')'
from table1 a
join table3 c on c.emptype = a.emptype
left outer join table2 b on a.name = b.name
where a.mgrid = 100)" test " from table4 sa,table5 te ,table6 ft where sa.id(+)=te.id and sa.mgr=ft.mgr;
my final out put required like this:
mgrid sal test
100 20000 yes:2000-anbarasan
yes:2700-anb
yes:2000-rasan
yes:2807-anbarasan
yes:2700-anbanu
yes:2000-null
but i am getting erro:
1)missing paranths
2)single row subquery return more then one row.
hi kindly give me answer to me as soon as possible
Edited by: anbarasan on Sep 29, 2008 9:48 PM

I refuse to read all of that code and guess what error message you are getting. Apparently others feel the same way.
Run the final SQL statement and then cut and paste the code and full error statement into a post.
Also include your full version number to three decimal places.
My refusal is not an unwillingness to help you but rather an unwillingness to spend 10 minutes reconstructing what you could have pasted in in a fraction of a second. We are all volunteers here and there are many people that need help. I hope you understand.

Similar Messages

  • How will get subquery return multiple values and passing to the main query

    Hi all ;
    here i given one sql query
    1)select decode(a.FLG,'Y','yes','N','no','null')||'] '||a.p_type||' : '|| initcap(replace(substr(b.mgr,0,instr(b.mgr,'@')-1),'.',' '))||' - '||
    b.name||' ('|| substr(a.name,0,instr(a.name,'-')-1)||')'
    from table1 a
    join table3 c on c.emptype = a.emptype
    left outer join table2 b on a.name = b.name
    where a.mgrid = 100;
    if i run this above query returning multiple values depend on sa.mgr values.
    like output coming like this
    [yes]:2000-anbarasan
    [yes]:2700-anb
    [yes]:2000-rasan
    [yes]:2807-anbarasan
    [yes]:2700-anbanu
    [yes]:2000-null
    2) this sub query i am passing with main query
    select sa.mgrid,sa.sal,(select decode(a.FLG,'Y','yes','N','no','null')||'] '||a.p_type||' : '||
    initcap(replace(substr(b.mgr,0,instr(b.mgr,'@')-1),'.',' '))||' - '||
    b .name||' ('|| substr(a.name,0,instr(a.name,'-')-1)||')'
    from table1 a
    join table3 c on c.emptype = a.emptype
    left outer join table2 b on a.name = b.name
    where a.mgrid = 100)" test " from table4 sa,table5 te ,table6 ft where sa.id(+)=te.id and sa.mgr=ft.mgr;
    my final out put required like this:
    mgrid sal test
    100 20000 [yes]:2000-anbarasan
    [yes]:2700-anb
    [yes]:2000-rasan
    [yes]:2807-anbarasan
    [yes]:2700-anbanu
    [yes]:2000-null
    but i am getting erro:
    1)missing paranths-it solved
    2)single row subquery return more then one row.
    give me the correct solution.how will solve this problem
    Edited by: anbarasan on Sep 29, 2008 6:49 AM
    Edited by: anbarasan on Sep 29, 2008 6:51 AM
    Edited by: anbarasan on Sep 29, 2008 6:53 AM
    Edited by: anbarasan on Sep 29, 2008 6:56 AM
    Edited by: anbarasan on Sep 29, 2008 6:58 AM

    Hi,
    It doesn't look like you posted either the complete query or the complete error message (including line number). Try again.
    "single row subquery return more then one row" usually means you are using a sub-query in a place where a single expression is expected, for example the column called avg_sal in this query:
    SELECT  ename
    ,       sal
    ,       (SELECT  AVG (sal) FROM scott.dept WHERE deptno = e.deptno) AS avg_sal  -- Scalar-sub-query
    FROM    scott.emp  e; The error occurs when the sub-query returns more than one row
    If the sub-querry really is supoosed to be returning only one row, the solution is to fix the sub-query, usually be adding something to the WHERE clause.
    If the sub-query is supposed to return more than one row, then the main query has to be re-written, perhaps as a join.
    Post a little sample data and the results you want from that data if you need help.

  • How to get the current month value for a customer exit variable?

    How to get the current month value for a customer exit variable? 
    And also if we have an InfoObject with date value (including date, month, year), then how to derive the month value from this date type of Char.?
    Thanks!

    Hi Kevin,
    Check here........
    Re: Customer Exist for "From Current Date To Month End"
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/25d98cf6-0d01-0010-0e9b-edcd4597335a
    Cal month
    Regards,
    Vijay.

  • How to get the list of values for a dynamic parameter using Web Services SDK?

    <p>I am struggling to get the list of values for a dynamic parameter of a report.</p><p>I am using Java Web Services SDK ... I tried to use PromptInfo.getLOV().getValues() method but it does not work.</p><p>First of all ... is this possible (to get the list of values for a dynamic param) using Web Services?</p><p>Second of all, if this is possible, how should I do it ... it seems it works fine when running the report from CMC. It asks for DB logon info and after that it provides a list of values.</p><p>Thx </p>

    <p>Your assumption is correct. We are trying to get the LOVs from the Crystal Report. I was not aware that this is not supported by Web Services SDK.</p><p>We used Web Services SDK to integrated the Crystal Reports in our web application. We implemented some basic actions for reports: schedule, view instances, run ad-hoc reports.</p><p>We encountered this problem when trying to run/schedule reports with dynamic parameters (a list of values from DB). We were unable to get the LOVs.</p><p>Please let me know if you can think of an alternative to look at.</p><p>Thanks a lot,</p><p>Catalin </p>

  • Error single row subquery returns multiple values

    Hi All,
    I have a below query. This is query is throwiing error like single row subquery is returing more than number of records. That subquery is in my SELECT statement query. I have a value like 'tests'. That test contains more than one record. I am fetching that 'tests' child values from this query. If the test contains only one child at that time it is working fine. Can anyone share with how update this query?
    SELECT
        czpn.FEATURE_TYPE,
        czci.PS_NODE_NAME,
        DECODE(czci.VALUE_TYPE_CODE,2,czci.ITEM_VAL,
                                    3, NVL((SELECT
                                             lines_config.PS_NODE_NAME
                                         FROM
                                             CZ_CONFIG_ITEMS lines_config
                                         WHERE
                                             lines_config.PARENT_CONFIG_ITEM_ID = czci.CONFIG_ITEM_ID
                                             AND lines_config.CONFIG_HDR_ID = czci.CONFIG_HDR_ID
                                             AND lines_config.CONFIG_REV_NBR = czci.CONFIG_REV_NBR),
                                        DECODE(czci.ITEM_NUM_VAL,1,'',czci.ITEM_NUM_VAL)),
                                    0,NVL(czci.ITEM_NUM_VAL,'')) NODE_VALUE  
    FROM
        CZ_CONFIG_ITEMS czci,
        CZ_PS_NODES czpn
    WHERE
        czpn.PERSISTENT_NODE_ID = czci.PS_NODE_ID
        AND czci.CONFIG_HDR_ID = 1827349
        AND czci.CONFIG_REV_NBR = 1
        --AND czci.VALUE_TYPE_CODE <> 4
        AND czpn.FEATURE_TYPE IS NOT NULL
        --AND czci.PS_NODE_ID = 356474       
        AND czpn.DEVL_PROJECT_ID = (SELECT MAX(ps_devl1.DEVL_PROJECT_ID) FROM CZ_DEVL_PROJECTS ps_devl1, CZ_PS_NODES ps_devl, CZ_CONFIG_ITEMS ps_config_sub
                                         WHERE (ps_devl.PERSISTENT_NODE_ID = ps_config_sub.PS_NODE_ID
                                         AND ps_config_sub.PARENT_CONFIG_ITEM_ID = (SELECT ps_config_sub1.CONFIG_ITEM_ID FROM CZ_CONFIG_ITEMS ps_config_sub1
                                                                                     WHERE ps_config_sub.CONFIG_HDR_ID = ps_config_sub1.CONFIG_HDR_ID
                                                                                    AND ps_config_sub.CONFIG_REV_NBR = ps_config_sub1.CONFIG_REV_NBR 
                                                                                     AND ps_config_sub1.PS_NODE_NAME = 'ACCESSORIES'))
                                        AND ps_devl1.DEVL_PROJECT_ID = ps_devl.REFERENCE_ID                                                                                 
                                         AND ps_config_sub.CONFIG_HDR_ID = czci.CONFIG_HDR_ID
                                         AND ps_config_sub.CONFIG_REV_NBR = czci.CONFIG_REV_NBR)
        AND czci.PS_NODE_NAME = 'tests'Thanks

    Hello,
    This should work:
    SELECT
        czpn.FEATURE_TYPE,
        czci.PS_NODE_NAME,
        DECODE(czci.VALUE_TYPE_CODE,2,czci.ITEM_VAL,
                                    3, NVL((SELECT
                                             lines_config.PS_NODE_NAME
                                         FROM
                                             CZ_CONFIG_ITEMS lines_config
                                         WHERE
                                             lines_config.PARENT_CONFIG_ITEM_ID = czci.CONFIG_ITEM_ID
                                             AND lines_config.CONFIG_HDR_ID = czci.CONFIG_HDR_ID
                                             AND lines_config.CONFIG_REV_NBR = czci.CONFIG_REV_NBR
                                             AND ROWNUM <= 1),
                                        DECODE(czci.ITEM_NUM_VAL,1,'',czci.ITEM_NUM_VAL)),
                                    0,NVL(czci.ITEM_NUM_VAL,'')) NODE_VALUE  
    FROM
        CZ_CONFIG_ITEMS czci,
        CZ_PS_NODES czpn
    WHERE
        czpn.PERSISTENT_NODE_ID = czci.PS_NODE_ID
        AND czci.CONFIG_HDR_ID = 1827349
        AND czci.CONFIG_REV_NBR = 1
        --AND czci.VALUE_TYPE_CODE  4
        AND czpn.FEATURE_TYPE IS NOT NULL
        --AND czci.PS_NODE_ID = 356474       
        AND czpn.DEVL_PROJECT_ID = (SELECT MAX(ps_devl1.DEVL_PROJECT_ID) FROM CZ_DEVL_PROJECTS ps_devl1, CZ_PS_NODES ps_devl, CZ_CONFIG_ITEMS ps_config_sub
                                         WHERE (ps_devl.PERSISTENT_NODE_ID = ps_config_sub.PS_NODE_ID
                                         AND ps_config_sub.PARENT_CONFIG_ITEM_ID = (SELECT ps_config_sub1.CONFIG_ITEM_ID FROM CZ_CONFIG_ITEMS ps_config_sub1
                                                                                     WHERE ps_config_sub.CONFIG_HDR_ID = ps_config_sub1.CONFIG_HDR_ID
                                                                                    AND ps_config_sub.CONFIG_REV_NBR = ps_config_sub1.CONFIG_REV_NBR 
                                                                                     AND ps_config_sub1.PS_NODE_NAME = 'ACCESSORIES'))
                                        AND ps_devl1.DEVL_PROJECT_ID = ps_devl.REFERENCE_ID                                                                                 
                                         AND ps_config_sub.CONFIG_HDR_ID = czci.CONFIG_HDR_ID
                                         AND ps_config_sub.CONFIG_REV_NBR = czci.CONFIG_REV_NBR)
        AND czci.PS_NODE_NAME = 'tests'Where this is restricting the records returned by your columnar subquery to one record with ROWNUM.

  • Return multiple values for the popup LOV

    Hi folks,
    I have one challange. I have a search engine and there is an popup lov and its having three Display and 3 Retun value such as
    select
    p.A || ', ' || pi.B|| ', ' || km.C|| ' ' d, p.A || ', ' || pi.B|| ', ' || km.C|| ' ' r
    from tableA km,tableB p,tableC pi
    where km.col1=p.id and km.col1=pi.id and km.C is not null
    when i click on the pop lov it will display 3 values shuch as SAP+DBA+HR and in popup lov iteam its will return 3 values
    such as SAP+DBA+HR this return values are from 3 cloumn names from same table ie. A column, B column, C column
    and when i click on submit button this return values from 3 columns values should assign to the 3 column such as
    A=SAP, B=DBA and C=HR and search fetchs the result in a Report.
    Its some thing new, is it possible..:)
    ok will be waiting for your reply..:D
    Regards,
    Suri
    Edited by: user634694 on Feb 25, 2009 3:14 AM

    Hi Varad,
    am facing problems i wrote dynamic sql its working fine for 2 and 3 fields like (SAP+ORCL) and (SAP+ORCL+HRA) but for the single value like SAP the results are not comming properly. my code is
    If (:P25_TEST Is not Null ) THEN
    V_Sql := V_Sql||q'!
    And
    (multipleInstr1(R.Pillar,:P25_TEST)&gt;0 )
    or INSTR ( '+' || Upper(:P25_TEST) || '+', Upper(R.Pillar))&gt;0 ) and
    ((multipleInstr1(R.Product_Line,:P25_TEST)&gt;0 )
    or INSTR ( '+' || Upper(:P25_TEST) || '+', Upper(R.Product_Line))&gt;0) and
    ((multipleInstr1(R.Category,:P25_TEST)&gt;0 ) or (R.Category is null)
    or INSTR ( '+' || Upper(:P25_TEST) || '+', Upper(R.Category))&gt;0 )
    End If;
    where multipleInstr1 is a function created to search results even its delimited by '+' it ignors '+' delimiter and
    :p25_test is the popup iteam which takes values like SAP+ORCL+HRA or SAP+ORCL or SAP how its possible to get this results.
    Its turning too complicated for cheking condetion for a single popup iteam, can we get any solution for this or not..
    Hope will do respond
    Thanks and Regards,
    Suri

  • Will a sequence return same value for two different sessions?

    Is there a possibility that a sequence will return same value to two different sessions when it is referred exactly at the same instance of time?

    @Justin... Thanks for your insight; indeed, we too feel this shouldn't ever happen and never heard of it either, but there it is. (No, we haven't logged a TAR yet -- whatever that is -- partly because it didn't occur to us and partly because we only recently came across the issue and sensibly want to do some testing before we cry foul.)
    However, the code is pretty straight-forward, much like this (inside a FOR EACH ROW trigger body):
    SELECT <seqname>.NEXTVAL INTO <keyvar> FROM DUAL;
    INSERT INTO <tblname> (<keyfield>, <... some other fields>)
    VALUES(<keyvar>, <... some other values> );
    (where <tblname> is NOT the table on which the trigger is fired). This is the only place where the sequence is ever accessed. The sequence state is way below its limits (either MAXVALUE or <keyfield>/<keyvar> datatype size).
    In this setup, end users sometimes got an out-of-the-blue SQL error to the effect that uniqueness constraint has been violated -- as I said, we used to have a unique index on <keyfield> -- which leads us to assume that the sequence generated a duplicate key (only way for the constraint to be violated, AFAIK). We released the constraint and indeed, using a simple SELECT <keyfield>, COUNT(*) FROM <tblname> GROUP BY <keyfield> HAVING COUNT(*)>1 got us some results.
    Unfortunately, the <tblname> table gets regularly purged by a consumer process so it's hard to trace; now we created a logger trigger, on <tblname> this time, which tracks cases of duplicate <keyfield> inserts... We'll see how it goes.
    @Laurent... winks at the CYCLE thing Our sequence is (needless to say) declared as NOCYCLE and the datatype is large enough to hold MAXVALUE.

  • Trigger how to get new and old value for nested table column?

    Hi,
    I have created a nested table based on the following details:
    CREATE TYPE typ_item AS OBJECT --create object
    (prodid NUMBER(5),
    price NUMBER(7,2) )
    CREATE TYPE typ_item_nst -- define nested table type
    AS TABLE OF typ_item
    CREATE TABLE pOrder ( -- create database table
    ordid NUMBER(5),
    supplier NUMBER(5),
    requester NUMBER(4),
    ordered DATE,
    items typ_item_nst)
    NESTED TABLE items STORE AS item_stor_tab
    INSERT INTO pOrder
    VALUES (800, 80, 8000, sysdate,
    typ_item_nst (typ_item (88, 888)));
    Now I would like to create a trigger on table pOrder for after insert or update or delete
    and I would like to track the new and old value for the columns inside nested table.
    Can anybody direct me how to do it?
    I would like to know the sytax for it like:
    declare
    x number;
    begin
    x := :new.nestedtablecolumn;--how to get the new and old value from nested table columns
    end;
    Hope my question is clear.
    Thanks,
    Lavan

    Hi,
    Try like this:
    CREATE OR REPLACE TRIGGER PORDER_I
    BEFORE INSERT
    ON PORDER
    REFERENCING OLD AS old NEW AS new
    FOR EACH ROW
    DECLARE
      items_new typ_item_nst;
      ordid_NEW NUMBER;
    BEGIN
    FOR i IN :new.items.FIRST .. :new.items.LAST LOOP -- For first to last element
      DBMS_OUTPUT.PUT_LINE(':new.items(' || I || ').prodid: ' || :new.items(I).prodid );
      DBMS_OUTPUT.PUT_LINE(':new.items(' || I || ').price:  ' || :new.items(I).price );
    END LOOP;
    END;Regards,
    Peter

  • How to get monthwise opening qty / value for previous years

    I do not get the month wise opening quantity and values for the items for the previous years using the below query. How i can modify this query to get opening qty / value of any year less than current year.
    Yogesh
    SELECT OPN_ITEM_CODE,
    ---------------------------------------OPENING QTY---------------------------------------------------
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),3)THEN ROUND(OPSTK,3) ELSE NULL END)APR_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),4)THEN ROUND(OPSTK,3) ELSE NULL END)MAY_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),5)THEN ROUND(OPSTK,3) ELSE NULL END)JUN_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),6)THEN ROUND(OPSTK,3) ELSE NULL END)JUL_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),7)THEN ROUND(OPSTK,3) ELSE NULL END)AUG_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),8)THEN ROUND(OPSTK,3) ELSE NULL END)SEP_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),9)THEN ROUND(OPSTK,3) ELSE NULL END)OCT_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),10)THEN ROUND(OPSTK,3) ELSE NULL END)NOV_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),11)THEN ROUND(OPSTK,3) ELSE NULL END)DEC_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),12)THEN ROUND(OPSTK,3) ELSE NULL END)JAN_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),13)THEN ROUND(OPSTK,3) ELSE NULL END)FEB_OPQ,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),14)THEN ROUND(OPSTK,3) ELSE NULL END)MAR_OPQ,
    ---------------------------------------OPENING VALUE----------------------------------------------------
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),3)THEN ROUND(OPVAL,3) ELSE NULL END)APR_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),4)THEN ROUND(OPVAL,3) ELSE NULL END)MAY_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),5)THEN ROUND(OPVAL,3) ELSE NULL END)JUN_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),6)THEN ROUND(OPVAL,3) ELSE NULL END)JUL_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),7)THEN ROUND(OPVAL,3) ELSE NULL END)AUG_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),8)THEN ROUND(OPVAL,3) ELSE NULL END)SEP_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),9)THEN ROUND(OPVAL,3) ELSE NULL END)OCT_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),10)THEN ROUND(OPVAL,3) ELSE NULL END)NOV_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),11)THEN ROUND(OPVAL,3) ELSE NULL END)DEC_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),12)THEN ROUND(OPVAL,3) ELSE NULL END)JAN_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),13)THEN ROUND(OPVAL,3) ELSE NULL END)FEB_OPV,
    SUM(CASE WHEN SL_DT < ADD_MONTHS(TRUNC(SYSDATE,'YEAR'),14)THEN ROUND(OPVAL,3) ELSE NULL END)MAR_OPV
    FROM( SELECT SL_ITEM_CODE OPN_ITEM_CODE, SL_DT,
    SUM(DECODE(SL_RCVD_ISSD,'R',1,'I',-1)*SL_QTY_BU/IU_CONV_FACTOR/IU_MAX_LOOSE_1)OPSTK,
    SUM(DECODE(SL_RCVD_ISSD,'R',1,'I',-1)*SL_VAL_1)OPVAL
    FROM OS_STK_LEDGER, OM_ITEM_UOM
    WHERE SL_ITEM_CODE = IU_ITEM_CODE
    GROUP BY SL_ITEM_CODE, SL_DT
    GROUP BY OPN_ITEM_CODE

    it think you need to look for [lag and lead|http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/analysis.htm#sthref1753]

  • APEX 4.0.1: $v() function doesn't return multiple values for checkbox?

    Hello,
    I have a report that uses apex_item.checkbox(...) to generate checkbox. This report correctly displays a checkbox for each row. The source code generated in the html page is:
    <input type="checkbox" name="f01" value="202" id="P1_CHECKBOX" />
    <input type="checkbox" name="f01" value="220" id="P1_CHECKBOX" />
    <input type="checkbox" name="f01" value="210" id="P1_CHECKBOX" />
    I want to use the javascript function $v() to get the values of the checked checkbox. I thought that this function return the values of all the checked checkbox separated by ':' but I notice that my code alert($v('P1_CHECKBOX')); returns each time only the value of the first checkbox if it is checked.
    It returns '202' if the first checkbox is checked but nothing if only the second checkbox is checked and '202' if the first and second checkbox are checked.

    Hi,
    first of all, $v, $x and $s are suppose to only work for page items and not for tabular form columns or manually generated HTML elements.
    Second, I think your HTML code is not correct, because each of your checkboxes has the same ID. But the ID has to be unique in the browser DOM tree. So the different checkbox elements should actually be named P1_CHECKBOX_1 .. P1_CHECKBOX_3. Just have a look what is actually generated for a real checkbox page item. BTW, I think you shouldn't name these checkbox elements like a page item, because they are actually not page items. I think that could be confusing for other developers.
    Hope that helps
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • How to get previous month's values for current month

    Hi..
    I have a requirement on a report, where for a particular month, the key figure value should be from the previous month.
    Eg: KF1 value for Sept 2007 should come from Aug 2007, KF value for Dec 2007 should be the value of Nov 2007, etc.
    There are other key figures on the report which do not need this logic. It is only for one key figure.
    Should we do this on the backend or front-end, and how? Any tips will be appreciated.
    Thanks
    R.

    hi,
    Use a Restricted Keyfigure.
    Drag your KF1 and Drag Calandar Month with a Variable Current Cal Month with variable Offset to -1.
    KEERTTHi

  • How to get an Net asset value for the Equipment from ERP in to BI

    Hi
    I am extracting the data from CRM to BI about the De installation information like
    Planned date of de installation, contract end date etc . But Ineed to extract Asset net value for that equipement. I think asset value should be extracyed from ERP but I dont know which tables and datsource stores
    Thanks,
    Sudha

    If you want the main tables within Assets :
    FI-AA-AA (AA)    Asset Accounting: Basic Functions u2013 Master Data
    ANKA             Asset Classes: General Data             ANLKL
    ANKP             Asset Classes: Fld Cont Dpndnt on Chart ANLKL / AFAPL
                     of Depreciation
    ANKT             Asset Classes: Description              SPRAS / ANLKL
    ANKV             Asset Classes: Insurance Types          ANLKL / VRSLFD
    ANLA             Asset Master Record Segment             BUKRS / ANLN1 / ANLN2
    ANLB             Depreciation Terms                      BUKRS / ANLN1 / ANLN2 / AFABE
                                                             / BDATU
    ANLT             Asset Texts                             SPRAS / BUKRS / ANLN1 / ANLN2
    ANLU             Asset Master Record User Fields         .INCLUDE /  BUKRS / ANLN1 /  ANLN2
    ANLW             Insurable Values (Year Dependent)       BUKRS / ANLN1 / ANLN2 / VRSLFD /
                                                             GJAHR
    ANLX             Asset Master Record Segment             BUKRS / ANLN1 / ANLN2
    ANLZ             Time Dependent Asset Allocations        BUKRS / ANLN1 / ANLN2 / BDATU
    FI-AA-AA (AA2)   Asset Accounting: Basic Functions u2013 Master Data 2.0
    ANAR             Asset Types                             ANLAR
    ANAT             Asset Type Text                         SPRAS / ANLAR
    FI-AA-AA (AB)    Asset Accounting: Basic Functions u2013
                     Asset Accounting
    ANEK             Document Header Asset Posting           BUKRS / ANLN1 / ANLN2 / GJAHR /
                                                             LNRAN
    ANEP             Asset Line Items                        BUKRS / ANLN1 / ANLN2 / GJAHR /
                                                             LNRAN / AFABE
    ANEV             Asset Downpymt Settlement               BUKRS / ANLN1 / ANLN2 / GJAHR /
                                                             LNRANS
    ANKB             Asset Class: Depreciation Area          ANLKL / AFAPL / AFABE / BDATU
    ANLC             Asset value Fields                      BUKRS / ANLN1 / ANLN2 / GJAHR /
                                                             AFABE
    ANLH             Main Asset Number                       BUKRS / ANLN1
    ANLP             Asset Periodic Values                   BUKRS / GJAHR / PERAF / AFBNR /
                                                             ANLN1 / ANLN2 / AFABER
    FI-SL-VSR (GVAL) Special Purpose Ledger: Validation, Substitution and Rules
    GB03             Validation / Substitution User          VALUSER
    GB92             Substitutions                           SUBSTID
    GB93             Validation                              VALID

  • Get a insert session value for SQL query at report

    Hi friends
    I created a global temp table and procedure to support web search form.
    and a search result report. The procudure
    gets search result from multip tables and
    insert into temp table --recordsearch. I can get value from temp table  by call procedure
    at SQL*Plus.
    However, I can not get this value by web report.
    How can I get this insert session value and pass to SQL query for report?
    Thanks,
    Newweb
    CREATE GLOBAL TEMPORARY TABLE recordsearch
    (emp_id          VARCHAR2(200),
    ssn               VARCHAR2(9),
    fname          VARCHAR2(200),
    lname           VARCHAR2(200),
    m_name          VARCHAR2(200)
    ) ON COMMIT PRESERVE ROWS;

    it possible that your web form does not have a persistent, dedicated connection. if you have connection pooling for example, multiple sessions will see the same instance of the GTT, so if one deletes it, then nobody sees it (or you can see others data). if the connections are not persistent, then they can disconnect between calls, deleting the GTT table.

  • Returning multiple values from a table

    Hi there i am working on a bit of sql which will return values when they exist in a table.
    The code I have returns the correct value when there is only one entry in the tbl_studentmodules table, as soon as there is more than one entry in this table it displays no rows at all :(.
    Can anyone point out how I go about returning multiple values?
                 select modulename from tbl_modulefeedback
    where 1 = (select count(*) from tbl_studentmodules
           where upper(:APP_USER) = upper(student_id))
    and 1 = (select count(*) from tbl_modulefeedback, tbl_studentmodules
          where tbl_modulefeedback.modulecode = tbl_studentmodules.modulecode)Thanks in advance!
    Ashleigh

    I'm not quite sure I understand what you are looking for, but I think a simple join may be what you need. something like:
    select modulename
    from tbl_modulefeedback mfb
       join tbl_studentmodules sm
          on mfb.modulecode = sm.modulecode
    where upper(sm.student_id) = upper(:APP_USER)This will return the module name for all modules that the given student has provided feeedback for. If there is a possibility that a student/module combination could appear in tbl_studentmodules more than once, something like this might be better to show the modulename only once.
    select modulename
    from tbl_modulefeedback mfb
    where mfb.modulecode in (select sm.modulecode
                             from tbl_studentmodules sm
                             where mfb.modulecode = sm.modulecode and
                                   upper(sm.student_id) = upper(:APP_USER))If this is not what you want, then post some sample data (preferrable in the form of insert statements or a with clause) and the results you expect rom that sample data.
    John

  • [UIX] How To: Return multiple values from a LOV

    Hi gang
    I've been receiving a number of queries via email on how to return multiple items from a LOV using UIX thanks to earlier posts of mine on OTN. I'm unfortunately aware my previous posts on this are not that clear thanks to the nature of the forums Q&A type approach. So I thought I'd write one clear post, and then direct any queries to it from now on to save me time.
    Following is my solution to this problem. Please note it's just one method of many in skinning a cat. It's my understanding via chatting to Oracle employees that LOVs are to be changed in a future release of JDeveloper to be more like Oracle Forms LOVs, so my skinning skills may be rather bloody & crude very soon (already?).
    I'll base my example on the hr schema supplied with the standard RDBMS install.
    Say we have an UIX input-form screen to modify an employees record. The employees record has a department_id field and a fk to the departments table. Our requirement is to build a LOV for the department_id field such that we can link the employees record to any department_id in the database. In turn we want the department_name shown on the employees input form, so this must be returned via the LOV too.
    To meet this requirement follow these steps:
    1) In your ADF BC model project, create 2 EOs for employees and departments.
    2) Also in your model, create 2 VOs for the same EOs.
    3) Open your employees VO and create a new attribute DepartmentName. Check “selected in query”. In expressions type “(SELECT dept.department_name FROM departments dept WHERE dept.department_id = employees.department_id)”. Check Updateable “always”.
    4) Create a new empty UIX page in your ViewController project called editEmployees.uix.
    5) From the data control palette, drag and drop EmployeesView1 as an input-form. Notice that the new field DepartmentName is also included in the input-form.
    6) As the DepartmentName will be populated either from querying existing employees records, or via the LOV, disable the field as the user should not have the ability to edit it.
    7) Select the DepartmentId field and delete it. In the UI Model window delete the DepartmentId binding.
    8) From the data controls palette, drag and drop the DepartmentId field as a messageLovInput onto your page. Note in your application navigator a new UIX page lovWindow0.uix (or similar) has been created for you.
    9) While the lovWindow0.uix is still in italics (before you save it), rename the file to departmentsLov.uix.
    10) Back in your editEmployees.uix page, your messageLovInput source will look like the following:
    <messageLovInput
        model="${bindings.DepartmentId}"
        id="${bindings.DepartmentId.path}"
        destination="lovWindow0.uix"/>Change it to be:
    <messageLovInput
        model="${bindings.DepartmentId}"
        id="DepartmentId"
        destination="departmentsLov.uix"
        partialRenderMode="multiple"
        partialTargets="_uixState DepartmentName"/>11) Also change your DepartmentName source to look like the following:
    <messageTextInput
        id=”DepartmentName”
        model="${bindings.DepartmentName}"
        columns="10"
        disabled="true"/>12) Open your departmentsLov.uix page.
    13) In the data control palette, drag and drop the DepartmentId field of the DepartmentView1 as a LovTable into the Results area on your page.
    14) Notice in the UI Model window that the 3 binding controls have been created for you, an iterator, a range and a binding for DepartmentId.
    15) Right click on the DepartmentsLovUIModel node in the UI Model window, then create binding, display, and finally attribute. The attribute binding editor will pop up. In the select-an-iterator drop down select the DepartmentsView1Iterator. Now select DepartmentName in the attribute list and then the ok button.
    16) Note in the UI Model you now have a new binding called DCDefaultControl. Select this, and in the property palette change the Id to DepartmentName.
    17) View the LOV page’s source, and change the lovUpdate event as follows:
    <event name="lovSelect">
        <compound>
            <set value="${bindings.DepartmentId.inputValue}" target="${sessionScope}" property="MyAppDepartmentId" />
            <set value="${bindings.DepartmentName.inputValue}" target="${sessionScope}" property="MyAppDepartmentName" />
        </compound>
    </event>18) Return to editEmployees.uix source, and modify the lovUpdate event to look as follows:
    <event name="lovUpdate">
        <compound>
            <set value="${sessionScope.MyAppDepartmentId}" target="${bindings.DepartmentId}" property="inputValue"/>
            <set value="${sessionScope.MyAppDepartmentName}" target="${bindings.DepartmentName}" property="inputValue"/>     
        </compound>
    </event>That’s it. Now when you select a value in your LOV, it will return 2 (multiple!) values.
    A couple things to note:
    1) In the messageLovInput id field we don’t use the “.path” notation. This is mechanism for returning 1 value from the LOV and is useless for us.
    2) Again in the messageLovInput we supply “_uixState” as an entry in the partialTargets.
    3) We are relying on partial-page-refresh functionality to update multiple items on the screen.
    I’m not going to take the time out to explain these 3 points, but it’s worthwhile you learning more about them, especially the last 2, as a separate exercise.
    One other useful thing to do is, in your messageLovInput, include as a last entry in the partialTargets list “MessageBox”. In turn locate the messageBox control on your page (if any), and supply an id=”MessageBox”. This will allow the LOV to place any errors raised in the MessageBox and show them to the user.
    I hope this works for you :)
    Cheers,
    CM.

    Thanks Chris,
    It took me some time to find the information I needed, how to use return multiple values from a LOV popup window, then I found your post and all problems were solved. Its working perfectly, well, almost perfectly.
    Im always fighting with ADF-UIX, it never does the thing that I expect it to do, I guess its because I have a hard time letting go of the total control you have as a developer and let the framework take care of a few things.
    Anyway, I'm using your example to fill 5 fields at once, one of the fields being a messageChoice (a list with countries) with a LOV to a lookup table (id , country).
    I return the countryId from the popup LOV window, that works great, but it doesn't set the correct value in my messageChoice . I think its because its using the CountryId for the listbox index.
    So how can I select the correct value inside my messageChoice? Come to think of it, I dont realy think its LOV related...
    Can someone help me out out here?
    Kind regards
    Ido

Maybe you are looking for