Query returning diff values

Dear all,
We have EBS 11.5.10.2 installed on solaris
Apps schema holds all objects and public synonyms created for all the objects in apps schema.
now when I run the query from apps as :
select * from PA_REP_UTIL_ORG_GE_V;
am getting the error :
ERROR at line 1:
ORA-00600: internal error code, arguments: [kksfbc-reparse-infinite-loop],
[0xFFFFFFFF7C7432B8], [], [], [], [], [], []
whereas, when sys is querying the same. it gives the value..
raised a SR with oracle also and they told to apply one patch.. but issue still remains..
Please advise
Kai

Hi We have similar problem in one of our rac environment. Oracle asked us to upgrade, since business didn't allow we did a temporary work around of recompiling below object coming out of below query. We put this one in crontab and ran every hr. This worked perfectly fine for us.
set pagesize 10000
column d_name format a20
column p_name format a20
select do.obj# d_obj,do.name d_name, do.type# d_type,
po.obj# p_obj,po.name p_name,
to_char(p_timestamp,'DD-MON-YYYY HH24:MI:SS') "P_Timestamp",
to_char(po.stime ,'DD-MON-YYYY HH24:MI:SS') "STIME",
decode(sign(po.stime-p_timestamp),0,'SAME','*DIFFER*') X
from sys.obj$ do, sys.dependency$ d, sys.obj$ po
where P_OBJ#=po.obj#(+)
and D_OBJ#=do.obj#
and do.status=1 /*dependent is valid*/
and po.status=1 /*parent is valid*/
and po.stime!=p_timestamp /*parent timestamp not match*/
order by 2,1;
hth,
http://borndba.com
missed the script

Similar Messages

  • Query returnining diff values

    Dear all,
    I have this query
    This query retuns the right value for other users.. whereas the same query returns no value for some other user.. (this user has select privileges on the tables department,invoice_rec)..
    What could be the reason ?
    Kai
    Edited by: KaiS on Mar 4, 2009 10:00 AM

    Does the other user have a copy of the current schema? I mean is he looking at his own data and not from the schema that you are connected to?

  • Single query return multiple value

    Hi ALL,
    I have a sql query as below :
    select order_number,
    (select decode(hcp.contact_point_purpose,'ABC',hcp.email_address,'CDE',hcp.email_address,null)
    from hz_contact_points,
    hz_parties hz
    WHERE hz.party_id=hcp.owner_table_id) Email
    FROM oe_order_headers_all h
    WHERE h.order_number='102'
    Actually the problem i am facing is the inner select query is returning multiple row , so my main query is erroring out, i need to capture the multiple row.
    in the above example the inner decode statement returning two mail address, i need to capture that, but while executing the whole query it is erroring out as saying single query returns multiple values.
    please help me on this to capture multiple values
    Thanks

    >
    select order_number,
    (select decode(hcp.contact_point_purpose,'ABC',hcp.email_address,'CDE',hcp.email_address,null)
    from hz_contact_points,
    hz_parties hz
    WHERE hz.party_id=hcp.owner_table_id
    /* a join is missing here that points to table oe_order_headers_all h*/) Email
    FROM oe_order_headers_all h
    WHERE h.order_number='102'
    >
    I can see a join missing in your select sub query.
    However, if you you are still getting the single query return multiple value error then you need to replace the sql sub query
    select decode(hcp.contact_point_purpose,'ABC',hcp.email_address,'CDE',hcp.email_address,null)
    from hz_contact_points,
    hz_parties hz
    WHERE hz.party_id=hcp.owner_table_id)by decode(hcp.contact_point_purpose,'ABC',hcp.email_address,'CDE',hcp.email_address,null)
    and join the two tables in you main query..
    Regards
    Biju
    ED: Provide test script and your expected output to get what you want exacly!
    Edited by: biju2012 on Sep 7, 2012 12:06 AM

  • Why Doesn't Query Return Date Values On Eval Table?

    Using Oracle 11.2.0.1 with XMLType Secure File Table named Eval.
    An interesting situation is occurring when attempting to query. A couple of things are going on.
    These queries do not have registered schemas.
    1. This query works fine
    SELECT xmlcast(xmlquery('declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03";
    declare namespace ns7="http://www.cigna.com/acme/domains/derived/fact/2010/03";
    $p/eval/derivedFacts/ns7:derivedFact/ns7:defId' passing e.object_value AS "p" RETURNING CONTENT)
    AS varchar2(100)) "Definition ID"
    FROM eval e;When adding a condition in the query to get defId=52657, get all nulls - even though this record exists - see sample data below.
    SELECT xmlcast(xmlquery('declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03";
    declare namespace ns7="http://www.cigna.com/acme/domains/derived/fact/2010/03";
    $p/eval/derivedFacts/ns7:derivedFact[/ns7:defId=888]/ns7:defId' passing e.object_value AS "p" RETURNING CONTENT)
    AS varchar2(100)) "Definition ID"
    FROM eval e;
    <?xml version = '1.0' encoding = 'UTF-8' standalone = 'yes'?><eval createdById="1957" acmeMemberId="3df55bd8-b3a6-4ba3-85e7-e8a188b7b4ed" category="external" eval_dt="2012-02-11T23:45:10.266Z" evalId="876d4035-aaf9-4f09-ae40-43498ec4973b" xmlns="http://www.cigna.com/acme/domains/eval/2010/03" xmlns:ns2="http://www.cigna.com/acme/domains/derived/fact/2010/03" xmlns:ns3="http://www.cigna.com/acme/domains/common/2010/03">
       <derivedFacts>
          <ns2:derivedFact>
             <ns2:defId>52657</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:52657:1</ns2:defUrn>
             <ns2:factSource>CCDR Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>boolean</ns2:type>
                <ns2:value>true</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>52600</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:52600:2</ns2:defUrn>
             <ns2:factSource>CCDR Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>string</ns2:type>
                <ns2:value>null</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>52599</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:52599:1</ns2:defUrn>
             <ns2:factSource>CCDR Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>string</ns2:type>
                <ns2:value>INT</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>51400</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:51400:1</ns2:defUrn>
             <ns2:factSource>CCDR Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>integer</ns2:type>
                <ns2:value>34</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>52177</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:52177:3</ns2:defUrn>
             <ns2:factSource>CCDR Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>string</ns2:type>
                <ns2:value>null</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>52075</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:52075:1</ns2:defUrn>
             <ns2:factSource>CCDR Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>string</ns2:type>
                <ns2:value>M</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>51391</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:51391:1</ns2:defUrn>
             <ns2:factSource>CCDR Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>boolean</ns2:type>
                <ns2:value>true</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>51473</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:51473:1</ns2:defUrn>
             <ns2:factSource>CCDR Product</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>date</ns2:type>
                <ns2:value>2011-01-01</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>51474</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:51474:1</ns2:defUrn>
             <ns2:factSource>CCDR Product</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>date</ns2:type>
                <ns2:value>9999-12-31</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>52151</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:52151:3</ns2:defUrn>
             <ns2:factSource>CCDR Product</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>boolean</ns2:type>
                <ns2:value>true</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>51048</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:51048:5</ns2:defUrn>
             <ns2:factSource>CCDR ProfileFact</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>boolean</ns2:type>
                <ns2:value>true</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>60380</ns2:defId>
             <ns2:defUrn>urn:coderunner:Medical:Definition:DerivedFact:60380:1</ns2:defUrn>
             <ns2:factSource>CCDR ProfileFact</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:45:10.266Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>boolean</ns2:type>
                <ns2:value>true</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
       </derivedFacts>
    </eval>Seem to be missing something conceptually, as to why this is not working.
    2. When replacing defId with origInferred_dt and adjust for the datatype; the query returns all nulls
    SELECT xmlcast(xmlquery('declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03";
    declare namespace ns7="http://www.cigna.com/acme/domains/derived/fact/2010/03";
    $p/eval/derivedFacts/ns7:derivedFact/ns7:origInferred_dt' passing e.object_value AS "p" RETURNING CONTENT)
    AS TIMESTAMP WITH TIME ZONE) "Original Inferred Date"
    FROM croutreach.eval e;Same here, seem to be missing something conceptually...
    Ultimately hoping to get this query to correctly work:
    SELECT xmlcast(xmlquery('declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03";
    declare namespace ns7="http://www.cigna.com/acme/domains/derived/fact/2010/03";
    $p/eval/derivedFacts/ns7:derivedFact[/ns7:defId=52657]/ns7:origInferred_dt' passing e.object_value AS "p" RETURNING CONTENT)
    AS TIMESTAMP WITH TIME ZONE) "Original Inferred Date"
    FROM croutreach.eval e;Any assistance would be much appreciated to say the least! :)
    Regards,
    Rick Blanchard

    Hi Rick,
    Ultimately hoping to get this query to correctly work:
    SELECT xmlcast(xmlquery('declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03";
    declare namespace ns7="http://www.cigna.com/acme/domains/derived/fact/2010/03";
    $p/eval/derivedFacts/ns7:derivedFact[/ns7:defId=52657]/ns7:origInferred_dt' passing e.object_value AS "p" RETURNING CONTENT)
    AS TIMESTAMP WITH TIME ZONE) "Original Inferred Date"
    FROM croutreach.eval e;
    Remove the initial slash in the predicate [ns7:defId=...] :
    xmlcast(
      xmlquery(
        'declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03"; (::)
         declare namespace ns7="http://www.cigna.com/acme/domains/derived/fact/2010/03"; (::)
         $p/eval/derivedFacts/ns7:derivedFact[ns7:defId=52657]/ns7:origInferred_dt'
         passing e.object_value AS "p"
         RETURNING CONTENT
      AS TIMESTAMP WITH TIME ZONE
    ) "Original Inferred Date"

  • Query returns no values

    Hiii,
    ich want to get a query result for a certain adress. I have used the search object "COBYADDRQuery". In the transaction GENIL_BOL_BROWSER I get results for this search object, when I type the city in the search object field "CITY1".
    But in my coding below the entities in the query result return no values.
    Here is my codng:
    DATA:
           core                  TYPE REF TO cl_crm_bol_core,
           ls_adress         TYPE  crm_isu_tec_co,
           lr_query            TYPE REF TO cl_crm_bol_query_service,
           lr_addr_obj       TYPE REF TO if_bol_entity_col
    core = cl_crm_bol_core=>get_instance( ).
    core->start_up( 'ALL' ).
    ls_adress-city1 = 'Amsterdam'.
    lr_query = cl_crm_bol_query_service=>get_instance( 'COBYADDRQuery' ).
    lr_query->if_bol_bo_property_access~set_properties( is_attributes = ls_adress).
    lr_addr_obj  = lr_addr_query->get_query_result( ).
    As I said before, the entities in my result object lr_addr_obj has no valus. Can anyone explain why the entities has no values? The GENIL_BOL_BROWSER return the correct values which matches with the search criteria.
    Kind Regards,
    John

    Hi John,
    Change the lr_addr_query to lr_query as below:
    lr_query->if_bol_bo_property_access~set_properties( is_attributes = ls_adress ).
    lr_addr_obj  = lr_query->get_query_result( ).
    try to copy paste the code above and try it..
    Regards,
    Madhumitha

  • Puzzle why query returned wrong value for last record in update.

    Hi all,
    10.2.0.4, Windows 32 bit.
    Apply 15% dis.count to related 5 items ( total amount 522 ) sorted by lowest amount first (amount = 1).
    Last record ( amount = 200 ) will be the total dis.count amount ( 78.3 ) less applied accumulated dis.count amount ( 48.50 ).
    Query runs fine without update clause but wrong result for last record with update.
    CREATE TABLE "T1"
        "ID"       NUMBER NOT NULL ENABLE,
        "ITEM_ID"  VARCHAR2(20 BYTE) NOT NULL ENABLE,
        "AMOUNT"   NUMBER(10,2) NOT NULL ENABLE,
        "dizcount" NUMBER(10,2)
    INSERT INTO T1 ( ID, ITEM_ID, AMOUNT, dizcount )  VALUES ( 65, '101', 1, NULL ) ;
    INSERT INTO T1 ( ID, ITEM_ID, AMOUNT, dizcount )  VALUES ( 65, '102', 1, NULL ) ;
    INSERT INTO T1 ( ID, ITEM_ID, AMOUNT, dizcount )  VALUES ( 65, '201', 200, NULL ) ;
    INSERT INTO T1 ( ID, ITEM_ID, AMOUNT, dizcount )  VALUES ( 65, '215', 155, NULL ) ;
    INSERT INTO T1 ( ID, ITEM_ID, AMOUNT, dizcount )  VALUES ( 65, '111', 165, NULL ) ;
    UPDATE t1 a
    SET a.dizcount =
      (SELECT
        CASE
          WHEN rec_count = row_count
          THEN (78.3 - NVL(lag(temp_total,1) over ( order by rec_count) ,0))-- 78.3 is total dizcount amount from 522 * .15
          ELSE disc_amt
        END amt
      FROM
        (SELECT id,
          item_id,
          disc_amt,
          rec_count,
          row_count,
          CASE
            WHEN rec_count != row_count -- accumulate dizcount amount except for last record
            THEN SUM(disc_amt) over (order by rec_count)
            ELSE 0
          END temp_total
        FROM
          (SELECT ID ,
            item_id,
            amount amt,
            ROUND(amount * .15,1) disc_amt, -- dizcount is 15%
            row_number () over (order by amount) rec_count,
            COUNT ( *) over () row_count
          FROM t1
          WHERE ID = 65
        GROUP BY id,
          item_id,
          disc_amt,
          rec_count,
          row_count
        )b
      WHERE a.item_id = b.item_id
      );Regards
    Zack
    Edited by: Zack.L on Jul 26, 2010 1:26 AM

    Zack.L wrote:
    Query runs fine without update clause but wrong result for last record with update.Not sure why but looks like another case in favour of MERGE.
    MERGE INTO T1
    using (SELECT id, item_id,
        CASE
          WHEN rec_count = row_count
          THEN (78.3 - NVL(lag(temp_total,1) over ( order by rec_count) ,0))-- 78.3 is total dizcount amount from 522 * .15
          ELSE disc_amt
        END amt
      FROM
        (SELECT id,
          item_id,
          disc_amt,
          rec_count,
          row_count,
          CASE
            WHEN rec_count != row_count -- accumulate dizcount amount except for last record
            THEN SUM(disc_amt) over (order by rec_count)
            ELSE 0
          END temp_total
        FROM
          (SELECT ID ,
            item_id,
            amount amt,
            ROUND(amount * .15,1) disc_amt, -- dizcount is 15%
            row_number () over (order by amount) rec_count,
            COUNT ( *) over () row_count
          FROM t1
          WHERE ID = 65
        GROUP BY id,
          item_id,
          disc_amt,
          rec_count,
          row_count
        ))b
    on (t1.id = b.id and t1.item_id = b.item_id)
    when matched then update set dizcount = b.amt ;This worked for me. I tested on 11.2 but should work on 10.2.0.4
    SQL> select * from t1 order by amount ;
            ID ITEM_ID                  AMOUNT   DIZCOUNT
            65 101                           1         .2
            65 102                           1         .2
            65 215                         155       23.3
            65 111                         165       24.8
            65 201                         200       29.8p.s. BTW, not sure if you want the column names in different cases, but your script, as it is, gave me an error (on 11.2)

  • Updating a table with a query that return multiple values

    Hi,
    I'm trying to update a table which contain these fields : ItemID, InventoryID, total amounts
    with a query that return these values itemId, inventoryid and total amounts for each items
    Mind you, not all the rows in the table need to be updated. only a few.
    This what i wrote but doesn't work since the query return multiple values so i can't assign it to journalAmounts.
    UPDATE [bmssa].[etshortagetemp]
    SET JournalAmounts = (SELECT sum(b.BomQty) FROM [bmssa].[Bom] b
    JOIN [bmssa].[SalesLine] sl ON sl.ItemBomId = b.BomId
    JOIN [bmssa].[SalesTable] st ON st.SalesId = sl.SalesId
    WHERE st.SalesType = 0 AND (st.SalesStatus IN (0,1,8,12,13)) AND st.DataAreaId = 'sdi'
    GROUP BY b.itemid, b.inventdimid)
    Any advise how to do this task?

    Remember that link to the documentation posted above that explains exactly how to do this. When you read it which part exactly were you having trouble with?

  • 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.

  • 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 check the sql:query is return null value

    I have use :
    <sql:query var="sql1" dataSource="${db}">
    select col_name from table_name
    where a=<c:out value="${row.test1}"/>
    and b='<c:out value="${row.test2}"/>'
    </sql:query>
    So, how can I check this statement return null value which is no record within this table?

    The Result should never be null but can be empty. You can check if the Result is empty using an if tag and checking the rowCount property:
        <sql:query var="books"
          sql="select * from PUBLIC.books where id = ?" >
          <sql:param value="${bookId}" />
        </sql:query>
         <c:if test="${books.rowCount > 0}">
         </c:if>http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSTL7.html#wp84217
    Look for query Tag Result Interface

  • 'Query not returning string values as expected

    Hi
    Why would this be happening?
    I have an insert statement that looks like this;
    UNION ALL
    SELECT '59','','last','first','','','','WILLIAMTA','BEB92C5B52566E6594707C69729624BE','','','Senior Officer','Town Name','2','','SUSTAINABLE FOREST MANAGEMENT DIVISION','NAME BRANCH','CURRENT' FROM DUAL
    ...I then want to create an conditional display statement in an apex application that looks like this;
    PLEASE NOT I HAVE REPLACED (the symbols that will not render for not equal to) WITH THE TEXT "NOT EQUAL TO"
    SELECT USERNAME
      FROM sfm_common.sct_parties
    WHERE division NOT EQUAL TO 'SUSTAINABLE FOREST MANAGEMENT DIVISION'
       AND username = :app_userBut it doesnt return anything and I know it should so I do some tests, below;
    1. You will see the first statement returns no records.
    2. In the second statement there is a space between N and the quote, and it returns a record
    3. In the third test if I make the gap really big it still returns a value.
    SQL*Plus: Release 10.2.0.1.0 - Production on Tue Sep 8 14:27:55 2009
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    SQL> SELECT DISTINCT null
      2    FROM sfm_common.sct_parties
      3   WHERE division NOT EQUAL TO 'SUSTAINABLE FOREST MANAGEMENT DIVISION'
      4  /
    no rows selected
    SQL> SELECT DISTINCT null
      2    FROM sfm_common.sct_parties
      3   WHERE division NOT EQUAL TO 'SUSTAINABLE FOREST MANAGEMENT DIVISION '
      4  /
    N
    SQL> SELECT DISTINCT NULL
      2    FROM sfm_common.sct_parties
      3   WHERE division NOT EQUAL TO 'SUSTAINABLE FOREST MANAGEMENT DIVISION                 '
      4  /
    N
    SQL>Would anyone know why this has happened, I have checked my insert scripts and there is no space at the end of the text in the column named 'division'.
    Ben
    Edited by: Benton on Sep 8, 2009 2:59 PM

    The table contains attributes like this;
    Col_1
    TOMATO
    ORANGE
    APPLE
    NULLSo what I was attempting to do was something like this;
    SELECT col_1 FROM table WHERE col_1 != 'TOMATO'
    I would then expect to see;
    Col_1
    ORANGE
    APPLE
    NULLBut instead I had the following returned;
    no rows selected
    Which is not correct.
    Apparently the fact that the column is 255 characters long is causing a problem, but I really dont understand why because I have other tables where I execute columns that are not the exact length of the content and yet the sort of query that I have used as an example work perfectly fine. For example;
    SQL> SELECT name
      2    FROM table_name
      3   WHERE name != 'HYGIENE MANAGEMENT'
      4  /
    NAME
    ACTION
    APPROVALS
    AUDITING
    BURNING
    COLLECTION
    COMMUNICATION
    COMPLIANCE
    DEVELOPMENT
    DISTURBANCE
    DOCUMENT CONTROL
    ERADICATION
    11 rows selected.
    SQL>And the ddl for the table looks like this;
      CREATE TABLE "TABLE_NAME"
       (     "ACT_ID" NUMBER,
         "NAME" VARCHAR2(50 BYTE) NOT NULL ENABLE,
         "CREATED_BY" VARCHAR2(50 BYTE) DEFAULT 'USER',
         "CREATED_ON" DATE DEFAULT SYSDATE,
         "EFF_FROM" DATE DEFAULT SYSDATE,
         "EFF_TO" DATE,
         "DEFINITION" VARCHAR2(4000 BYTE),
         "STATUS" VARCHAR2(15 BYTE) DEFAULT 'CURRENT' NOT NULL ENABLE,
          CONSTRAINT "TABLE_NAME_CHK1" CHECK ( status IN ('CURRENT','NOT CURRENT')) ENABLE,
          CONSTRAINT "TABLE_NAME_PK" PRIMARY KEY ("ACT_ID");The name field in this instance is 50 characters long and the words 'HYGIENE MANAGEMENT' make up 18 characters.
    Ben

  • SQL query returns value but EXEC SQL Task fails to assign variable

    I have an execute SQL task to get an identifier from an Oracle database and assign it to a variable (the variable is used in subsequent query's where clauses to transfer the data to a SQL Server database). If I copy the query from the SSIS
    package to the Oracle SQL Developer interface and run the query; I get the expected single identifier. If I run the execute SQL task I get the error "[Execute SQL Task] Error: An error occurred while assigning a value to variable "VariableName":
    "Single Row result set is specified, but no rows were returned."
    I can create phony/simpler versions of the query that will return the wrong identifier that will successfully assign the value to the variable, so the problem isn't with the variable itself or the way the result set is set up in the task (Result
    Set/Single Row in the General panel; Result Name 0/VariableName in the Result Set panel).
    How can two queries that return a single value produce different results with respect to the variable assignment process?

    Perhaps you can trap (profile) the query in Oracle to see what it gets submitted,
    thing is this query
    select id from table where ProcessedStatusColumn is null and DateColumn = (sub select to get most recent date in table where ProcessedStatusColumn is null)
    is not guaranteed to return a value, you need a default returned in case the search failed e.g.
    select
    NVL(id, 0)
    from table where ProcessedStatusColumn is null and DateColumn =
    (sub select to get most recent date in table where
    ProcessedStatusColumn is null)
    Arthur My Blog

  • Return each value only once using cfloop query

    Hi,
    I have some code that dynamically populates a cfselect list and then populates a second list based on those values. Everything seems to be working fine, except that all values are being pulled from the database, and there are duplicates in most cases. For example, value 1S1W diplays in the drop-down menu 10 times, where I would only like it there once.
    Is there a way to have one of each value in my list?
    <cfif isDefined('form.select_Main_Group')>
        <cfset page.select_Main_Group = form.select_Main_Group>
    </cfif>
    <cfoutput>
      <form name="DropDown" method="post">
      <!--- query DB for the first drop down list --->
    <CFQUERY name="get_Main_Group" datasource="ds" dbtype="odbc">
    SELECT *
              FROM  slco_sire.dbo.area_reference_plats_doc INNER JOIN slco_sire.dbo.area_reference_plats_page
              ON    slco_sire.dbo.area_reference_plats_doc.doc_id = slco_sire.dbo.area_reference_plats_page.doc_id
              ORDER BY page_description
    </CFQUERY>
      <!--- first drop down list --->
      <!--- NOTICE the onChange javascript event in the select tag, this is what submits the form after the first selection --->
      <select name="select_Main_Group" required="yes" onchange="this.form.submit()">
         <option>Select Township/Range</option>
         <!--- dynamically populate the first drop down list based on the get_Main_Group query --->
         <!--- NOTICE the CFIF within the option tag, this says, if the first selection has been made, display the chosen option when the page reloads --->
         <cfloop query="get_Main_Group">
             <option value="#SECTION#" <cfif isDefined('form.select_Main_Group')><cfif form.select_Main_Group eq "#SECTION#">selected</cfif></cfif>>#TOWNSHIP_RANGE#</option>
               </cfloop>
    </select>
    <p>
    <!--- if the first selection has been made, display the second drop down list with the appropriate results --->
    <cfif isDefined('page.select_Main_Group')>
       <!--- query DB for second drop down list, based on the selected item from the first list --->
       <cfquery name="get_Sub_Group" datasource="ds" dbtype="odbc">
            SELECT TOWNSHIP_RANGE, SECTION
            FROM  slco_sire.dbo.area_reference_plats_doc INNER JOIN slco_sire.dbo.area_reference_plats_page
                        ON    slco_sire.dbo.area_reference_plats_doc.doc_id = slco_sire.dbo.area_reference_plats_page.doc_id
            WHERE SECTION = '#page.select_Main_Group#'
       </cfquery>
       <!--- second drop down list --->
       <select name="select_Sub_Group" required="yes">
          <option>Select Section</option>
          <!--- dynamically populate the second drop down list based on the get_Sub_Group query --->
          <cfloop query="get_Sub_Group">
             <option value="#SECTION#">#SECTION#</option>
          </cfloop>
       </select>
    </cfif>
    </form>
    </cfoutput>

    Emily,
    OK.  Yes it is possible.  Change your first query to:
    SELECT  DISTINCT TOWNSHIP_RANGE
              FROM  slco_sire.dbo.area_reference_plats_doc INNER JOIN slco_sire.dbo.area_reference_plats_page
              ON    slco_sire.dbo.area_reference_plats_doc.doc_id = slco_sire.dbo.area_reference_plats_page.doc_id
              ORDER BY TOWNSHIP_RANGE
    </CFQUERY>
    Notice I removed any mention of SECTION, because it's irrelevant to generating a unique list of TOWNSHIP_RANGE.  Also, GROUP BY is not needed, but an ORDER BY will sort the records in alphanumeric order.
    Then you need to modify your code where you generate the option list for the first pulldown:
    <option value="#get_Main_Group.TOWNSHIP_RANGE#" <cfif StrucKeyExists(form,'select_Main_Group') AND form.select_Main_Group eq "#get_Main_Group.TOWNSHIP_RANGE#">selected</cfif>>#get_Main_Group.TOWNSHIP_RANGE#</option>
    Here I did a couple of things beside changing SECTION references to TOWNSHIP_RANGE .  It's a good idea to add the query name prefix to column names when you output them so that you avoid collisions with variables that have the same name.  I also reduced your <CFIF> statements to one compound statement for simplicity, and replaced the IsDefined with a StructKeyExists function.  This is considered to be better practice and won't throw an error when used in a compound statement (if you kept the IsDefined statement and tried that in a compound selection, it can sometimes throw errors if the variable in the IsDefined doesn't exist).
    Now, your second query should be something like:
    <cfquery name="get_Sub_Group" datasource="ds" dbtype="odbc">
            SELECT DISTINCT SECTION
            FROM  slco_sire.dbo.area_reference_plats_doc INNER JOIN slco_sire.dbo.area_reference_plats_page
                        ON    slco_sire.dbo.area_reference_plats_doc.doc_id = slco_sire.dbo.area_reference_plats_page.doc_id
            WHERE TOWNSHIP_RANGE = '#page.select_Main_Group#'
            ORDER BY SECTION
       </cfquery>
    Here I changed the WHERE clause to filter based on the TOWNSHIP_RANGE you selected in the first pull-down.  This should now return a list of SECTIONs that match the TOWNSHIP_RANGE selected in the first pull-down.
    Lastly, some minor changes to the option list for the second pulldown:
      <option value="#get_Sub_Group.SECTION#">#get_Sub_Group.SECTION#</option>
    One other thing I noticed.  If you are on ColdFusion 8 or 9, the dbytpe="odbc" is no longer needed.  I'm assuming you are using an ODBC database connection to something like MS Access.  If so, you can omit the dbytype entirely.  It's only needed now if you do query-of-query queries, where it would be dbtype="query".
    HTH,
    -Carl V.

  • SQL query returns varchar - default value type!!!

    On a field in my portal form there is a default value type of 'SQL query returns varchar', where can I put this sql to get a default value from a table?

    Hi again
    I have this code in 'additional pl/sql code' - '...before displaying the page'. But it comes up with an error when I run the form.
    declare
    prop_v varchar2(20);
    group_v varchar2(3);
    el1_v varchar2(3);
    blk varchar2(10) := 'DEFAULT';
    begin
    prop_v := p_session.get_value_as_varchar2(p_block_name=>'DEFAULT', p_attribute_name => 'l_property_p');
    group_v := p_session.get_value_as_varchar2(p_block_name=>'DEFAULT', p_attribute_name => 'l_group_p');
    select element_code
    into el1_v
    from eh_risk_element_detail
    where property_ref = prop_v
    and group_code = group_v
    and line_no = 1;
    p_session.set_value(p_block_name => blk, p_attribute_name => 'L_ELEMENT1_P', p_value => el1_v);
    end;
    Rich

  • Percentage pie chart whose query return just one value

    Hi,
    I have a requirement which is to display a pie chart that shows the relative percentage of based on a particular row's values.
    Here the SQL query return just one value to generate the chart, however Apex is creating its own seemingly random value to draw the rest of the chart and dividing the region.
    Is there any way for Apex to take the single value that the query returns as a percentage and generate the chart by calculating the other value to be as (100 - queried value) and split the region in the chart accordingly.
    Of course one method is to store both the value that the query returns as well as 100 - that value in a table and then write the query in the chart that references both these values.. but I'd like to know if there is a way to go about it without storing this extra bit of information in a table
    Thanks!

    you create a hidden page item and populate with total value and percentile calculated value and use it in dial chart as querry.

Maybe you are looking for

  • FB01 BDC Program Posting Error in a coding block

    Hi, I am trying to write a BDC for fb01 transaction with posting key 31 and 40. But I am getting a coding block as a popup in FB01 trsanction on screen number 'SAPLKACB' '0002'. I am passing costcentre and Internal Order and then passing an Enter f c

  • Windows Server 2012 R2 File Server

    I updated my file server to Server 2012 R2 and everything went ok except now my windows 8 clients cannot connect to the file server.  I get a generic error An extended error has occurred when I try to unc to it and none of my drives will map.  Did an

  • Time machine restore to newly setup system

    I have a TM backup I took prior to reinstalling system. I now want to restore my iTunes library from this backup after doing a reinstall of Mac OSX. When I startup TM, I get the option to use other TM backup. I select this and can navigate to my iTun

  • MuVo Sport C100 - Neck St

    Anyone else having a problem with the neck strap on the Muvo Sport? I just got deli'very of mine today and noticed that if you attach the player to the neck strap it's possible for the player to easily unhook itself from the strap...as I found when i

  • Cant see a simple video on macbook pro. Please help!!

    I have a macbookpro 17" 2.2 Ghz Intel corei7 with 4 gb ram and from mid 2010 but cant see any video, non youtube, not games, not vcl!! it stops, freeze, and continues. I think it might be ram or graphic card problem... any help please?? I am a poor d