Select count(*) and blank element tags

Is there a way other than column aliases to produce and return an element tag for the following xsql query.
<xsql:query
connection="{@cxn}"
xmlns:xsql="urn:oracle-xsql">
select count(*) from emp
</xsql:query>
Some databases such as SQL Server via a JDBC driver will return a blank column name, thus you'll have an invalid XML document, however SQL Server allows one to use column aliases, such as select count(*) as "count" from emp.
However some databases such as Progress via a JDBC-ODBC bridge and ODBC driver does NOT allow column aliases. Thus I'll always get the following response:
<ERROR>oracle.xml.sql.OracleXMLSQLException: String index out of range: </ERROR>
Question. Can I substitute an element tag when I encounter a blank column name using an action handler? Any ideas? Sample code?
Steve.

Please have the data structure as below:
<datastructure>
<GROUP name="G_1" source="Q_TEMP">
<element value="DEPTNO" name="DEPTNO" />
<element value="DNAME" name="DNAME" />
<element value="LOC" name="LOC" />
<GROUP name="G_2" source="Q_TEMP1">
<element value="ENAME" name="ENAME" />
<element value="SAL" name="SAL" />
*</GROUP>*
*<element value="G_2.ENAME" name="TOTL_DETAILS" dataType="number" function="COUNT()" />*
*<element value="G_2.SAL" name="TOTL_SAL" function="SUM()"/>*
*</GROUP>*
</datastructure>
Aggregate functions to be placed at the level you require it. Here you need at G_1, so place it there.

Similar Messages

  • "select count(*)" and "select single *" returns different result

    Good day!
    product version SAP ECC 6.0
    oracle10
    data transfers from external oracle db into customer tables using direct oracle db link
    sometimes I get case with different results from 2 statements
    *mytable has 10 rows
    *1st statement
    data: cnt type I value 0.
    select count( * ) into cnt from mytable WHERE myfield_0 = 123 and myfield_1 = '123'.
    *cnt returns 10 - correct
    *2nd statement
    select single * from  mytable WHERE myfield_0 = 123 and myfield_1 = '123'.
    *sy-dbcnt returns 0
    *sy-subrc returns 4 - incorrect, 10 rows are "invisible"
    but
    1. se16 shows correct row number
    2. I update just one row from "invisible" rows using se16 and 2nd statement returns correct result after that
    can not understand why
    thank you in advance.

    Thank you, Vishal
    but,
    general problem is that
    1. both statements have the same WHERE conditions
    2. 1st return resultset with data (sy-dbcnt=10), 2nd return empty dataset, but must return 1 in sy-dbcnt
    Yes, different meaning, you are right, but must 2nd must return 1, because of "select single *" construction, not 0.
    Dataset to process is the same, WHERE conditions are equal...
    I think the problem is that how ABAP interperets select count(*) and "select single *".
    Maybe "select count (*)" scans only PK from index page(s)? and "select single *" scans data pages? and something is wrong with that?
    I'm new in SAP and didn't find any SAP tool to trace dump of data and indexes pages with Native SQL.
    se16 shows all records.
    And why after simple manual update of just one record using se16 "select single *" returns 1?
    I've just marked one row to update, didn't change any data, then pressed "save".

  • Select Count(*) and actual row are differ: 136 rows vs 65k x 7 rows

    Dear All,
    Good morning. Need your advices. We had a view which is running and producing output to excel files. But recently after one of ours database migration, it were producing differ result: Select Count(*) and actual row are differ: 136 rows vs 65k x 7 rows. Error happen when we export out the row to csv file is produced 65000 rows x 7 worksheep. But when perform select count(*) from RTNEWWIP, result return: 136 rows.
    Is there any way to trace below sql to find where go wrong?
    The Veiw as below:
    CREATE OR REPLACE VIEW RTNEWWIP
    (FAB_ID, PO, PRD_NO, SHP_PRD_NO, LOT,
    WIP_QTY, ROUTEDESC, IN_TIME, STAY_DAY, BACK_DAY,
    WO_FCST_DATE, SHIP_FCST_DATE, SHIP_CONF_DATE, WS_DATE, ROUTERATIO,
    PROCESS, LOTSTATUS, LOTTYPE, RETICLEVERSION, PROCESSVERSION,
    ROUTESEQUENCE, PRIORITY, PROCESSGEN, PROCESSFAMILY)
    AS
    select
    --ord.order_no,
    'SILTERRA' FAB_ID,
    wip.PO_NUMBER PO,
    wip.FW_DEVICE PRD_NO,
    wip.USER_ITEM_DESCRIPTION SHP_PRD_NO,
    wip.LOT_ID LOT,
    wip.CURR_QTY WIP_QTY,
    wip.STEP_DESC ROUTEDESC,
    to_char(wip.RECORD_START_DATE,'DD-MON-YYYY HH24:MI:SS') IN_TIME,
    to_char((sysdate - wip.RECORD_START_DATE),'9999D99') STAY_DAY,
    to_char((wip.SCHEDULED_COMPLETE_DATE - sysdate),'9999D99') BACK_DAY,
    -- (sysdate - wip.RECORD_START_DATE) STAY_DAY,
    -- (wip.SCHEDULED_COMPLETE_DATE - sysdate) BACK_DAY,
    to_char(wip.SCHEDULED_COMPLETE_DATE,'DD-MON-YYYY') WO_FCST_DATE,
    to_char((wip.SCHEDULED_COMPLETE_DATE + 1),'DD-MON-YYYY') SHIP_FCST_DATE,
    --nvl(oel.attribute15, to_char(sysdate+3650,'DD-MON-YYYY')) SHIP_CONF_DATE,
    to_char(nvl(to_date(oel.attribute15,'DD-MON-YYYY'), sysdate+3650),'DD-MON-YYYY') SHIP_CONF_DATE,
    to_char(wip.LOT_START_DATE,'DD-MON-YYYY') WS_DATE,
    --wip.MASK_NO || '/' || wip.MASK_TOTAL ROUTERATIO,
    '''' ||wip.MASK_NO || '/' || wip.MASK_TOTAL ROUTERATIO,
    wip.PLAN_NAME_ACTIVE PROCESS,
    wip.LOT_STATUS LOTSTATUS,
    wip.LOT_TYPE LOTTYPE,
    0 RETICLEVERSION,
    wip.PLAN_VERSION_ACTIVE PROCESSVERSION,
    0 ROUTESEQUENCE,
    wip.PRIORITY PRIORITY,
    ' ' PROCESSGEN,
    ' ' PROCESSFAMILY
    from wip_report wip, lot_fact lf, order_fact orf, order_dim ord,
    apps.oe_order_headers_all@prod_myfabetl oeh,
    apps.oe_order_lines_all@prod_myfabetl oel
    where wip.CUSTNAME like 'Realtek%'
    --AND WIP.FW_DEVICE like '%R25C'
    and wip.ACTIVE_FACT_KEY = lf.RECORD_KEY
    and lf.ORDER_FACT_KEY = orf.RECORD_KEY
    and orf.ORDER_KEY = ord.RECORD_KEY
    and ord.ORDER_NO = to_char(oeh.order_number)
    and oeh.header_id = oel.header_id
    and orf.LINE_ITEM_NUMBER = to_char(oel.line_number)
    and orf.ITEM_SCHEDULE = to_char(oel.shipment_number)
    and wip.LOT_TYPE in ('ENX','PRA','PRD','PRT','CSK','MPW')
    union all
    select --od.order_no,'
    'SILTERRA' FAB_ID,
    od.CUST_PO PO,
    imd.FW_DEVICE_ID PRD_NO,
    nvl(orf.USER_ITEM_DESCRIPTION, nvl(imd.CUST_DEVICE_ID, imd.FW_DEVICE_ID)) SHP_PRD_NO,
    sfl.LOTID LOT,
    sfl.currentcompqty WIP_QTY,
    'CREATED' ROUTEDESC,
    to_char(to_date(substr(recordstartdate,1, 14), 'yyyymmddhh24miss'), 'DD-MON-YYYY HH24:MI:SS') IN_TIME,
    --sysdate - to_date(substr(recordstartdate,1, 14), 'yyyymmddhh24miss') STAY_DAY,
    --to_date(sfl.scheduledcompletedate,'yyyymmdd') - sysdate BACK_DAY,
    to_char(sysdate - to_date(substr(recordstartdate,1, 14), 'yyyymmddhh24miss'),'9999D99') STAY_DAY,
    to_char(to_date(sfl.scheduledcompletedate,'yyyymmdd') - sysdate,'9999D99')BACK_DAY,
    to_char(to_date(sfl.scheduledcompletedate,'yyyymmdd'),'DD-MON-YYYY') WO_FCST_DATE,
    to_char(to_date(sfl.scheduledcompletedate,'yyyymmdd') + 1, 'DD-MON-YYYY') SHIP_FCST_DATE,
    --nvl(oel.attribute15, to_char(sysdate+3650,'DD-MON-YYYY')) SHIP_CONF_DATE,
    to_char(nvl(to_date(oel.attribute15,'DD-MON-YYYY'), sysdate+3650),'DD-MON-YYYY') SHIP_CONF_DATE,
    to_char(to_date(sfl.startdate,'yyyymmdd'), 'DD-MON-YYYY') WS_DATE,
    ' ' ROUTERATIO,
    sfl.tempprocessplan PROCESS,
    sfl.currentstatus LOTSTATUS,
    sfl.currenttype LOTTYPE,
    0 RETICLEVERSION,
    0 PROCESSVERSION,
    0 ROUTESEQUENCE,
    ' ' PRIORITY,
    ' ' PROCESSGEN,
    ' ' PROCESSFAMILY
    from SIL_FW_LOTCREATED_VIEW sfl, order_dim od, order_fact orf, item_master_dim imd,
    apps.oe_order_headers_all@prod_myfabetl oeh,
    apps.oe_order_lines_all@prod_myfabetl oel
    where substr(sfl.salesorderno,1,instr(sfl.salesorderno,'-',1,1)-1)= to_char(od.ORDER_NO)
    and od.RECORD_KEY = orf.ORDER_KEY
    and od.RECORD_CURRENT_FLAG = 1
    and orf.RECORD_CURRENT_FLAG =1
    and to_char(orf.LINE_ITEM_NUMBER) = substr(sfl.salesorderno,instr(sfl.salesorderno, '-',1,1) +1, (instr(sfl.salesorderno, '.',1,1) -1) - instr(sfl.salesorderno, '-',1,1))
    and to_char(orf.ITEM_SCHEDULE) = substr(sfl.salesorderno,instr(sfl.salesorderno, '.',1,1) +1, length(salesorderno) - instr(sfl.salesorderno, '.',1,1))
    and orf.ITEM_MASTER_KEY = imd.RECORD_KEY
    and sfl.customername = 'Realtek'
    and od.ORDER_NO = to_char(oeh.order_number)
    and oeh.header_id = oel.header_id
    and orf.LINE_ITEM_NUMBER = to_char(oel.line_number)
    and orf.ITEM_SCHEDULE = to_char(oel.shipment_number);
    select count(*) from rtnewwip;
    COUNT(*)
    136
    1 row selected

    query might be referring to different environment/schema as you are using database link to access some tables.
    getting result/count from view means executing query which forms that view. try to run that query separately and see the output.
    it may help you to debug

  • Selection text and text elements contents not displayed

    I have a language related problem
    I have 2 servers .
    In first server I logged in english language and the selection text and text elements are displayed in English.
    The requirement is I dont want to translate these texts it should be displayed in English only even if I log into SAP with other language.
    So if I log in german I see the texts in English in the first server.
    But this is not the case with second.
    If I log in with English I see the english texts but if I do in german I am not able to see this english text with proper contents .
    Can anybody let me know if there are any settings to be done ? As its working fine in first server but not in second .
    Edited by: Jalpa Shukla on Oct 22, 2008 11:19 AM

    Hello Jalpa Shukla,
    If you want to display the text in english language only better dont use Text-element
    instead of using text element you hard the text in the program then you will display the text in same in English.
    Try in this way, If not past the code i will give the solution

  • Select Count and Quantity

    Hello
    I have made this query =>
    SELECT Products.ProductName, COUNT(*)*OrderDetails.Quantity
    FROM Products INNER JOIN OrderDetails ON (Products.ProductID=OrderDetails.ProductID)
    GROUP BY Products.ProductName, OrderDetails.Quantity, OrderDetails.OrderID
    Well it counts the total from each product but it has also Multiplicate it with the quantity.
    My quey is not working because it's shows several time the same product name and the quantity is not correct.
    The Group by is not working as it should work. And i think i need to use a SUM() for the quantity.
    I'm still new to queries.
    Any avice?

    Looks like this:
    DECLARE @products TABLE (productID INT IDENTITY, productName VARCHAR(30))
    DECLARE @orderDetails TABLE (orderID INT, productID INT, quantity INT)
    INSERT INTO @products (productName) VALUES
    ('Orange'),('Apple'),('Inflatable Chicken Suit')
    INSERT INTO @orderDetails (orderID, productID, quantity) VALUES
    (1,1,1),(1,2,1),(2,3,9),(3,2,16)
    SELECT SUM(quantity) AS quantity, p.productID, p.productName
    FROM @orderDetails o
    INNER JOIN @products p
    ON o.productID = p.productID
    GROUP BY p.productID, p.productName
    You where grouping on too many fields. 
    Don't forget to mark helpful posts, and answers. It helps others to find relevant posts to the same question.
    Also, when posting questions it helps to provide DDL and example data (as I did at the top of my example).

  • XMLDocument and blank XML tag parse issue

    var xmlDoc:XMLDocument = new XMLDocument();
                    xmlDoc.ignoreWhite = false;
                    xmlDoc.parseXML("<Test> </Test>");
                    var decoder:SimpleXMLDecoder = new SimpleXMLDecoder(true);
                    var processObj:Object = decoder.decodeXML(xmlDoc);
                   trace( processObj.Test  );
    Result is comming as 0 instead of a blank space between the tags(<Test> </Test>).

    Hi,
    Here are two possible solutions :
    xmlelement("EXCEPTIONS",
      xmlforest(
        xmlforest(
          v1.exception_code as "EXCEPTION_CODE"
        , v1.exception_long_desc as "EXCEPTION_LONG_DESC"
        ) as "EXCEPTION"
    )or,
    xmlelement("EXCEPTIONS",
      case when v1.exception_code is not null
             or v1.exception_long_desc is not null
        then xmlelement("EXCEPTION",
               xmlforest(
                 v1.exception_code as "EXCEPTION_CODE"
               , v1.exception_long_desc as "EXCEPTION_LONG_DESC"
      end
    )

  • Why is the select Count too slow

    I am doing the following select count and calling it from my JSP to get the total number of records... why is it so slow...
    select count(*)
    from
    (select distinct o.receive_id, o.name, o.address
    from order o, item i
    where o.id = i.id
    and o.status = 2 and i.status = 0)

    If the data in the table that you are referring to in the query gets refreshed very often and your high water mark on your table not reset, then this query always runs longer. While deleting data in the table, use 'TRUNCATE' rather than 'DELETE' in your data queries. that would help reset the high water mark and your count() queries will run very very fast.

  • Select count(*) on sql statement returning zero when a matching row exists.

    Our account has an ANSI C application that checks for the existence a row on an Oracle table(s) by using the following SQL:
    int iCount = 0;
    EXEC SQL
    SELECT count(rownum) INTO :iCount
    FROM sys.all_tab_columns
    WHERE table_name IN
    (SELECT table_name FROM
    sys.all_synonyms
    WHERE upper(synonym_name) = upper(:szDestTable))
    AND upper(column_name) = upper(:szColumnName)
    AND owner = 'DBAUSER';
    The bind variables szDestTable and szColumnName are populated with values parsed from columns on another database table. This application is executed through out the day. Occasionally, the application will report a zero in the iCount when there should be a match. I have verified the szDestTable and szColumnName are populated with the correct values which would find a match and they are correct. To make matters even stranger, the application will parse the same input values and find a match (as it should). At some point during the day, and it can be at any time, the application will NOT find a match on the same file, same values. Every subsequent execution of this application will not find a match on the same values. Once the database is brought down and started up in the evening for its normal backups, the application will find a match again on the same values. This problem does not occur every day. I could be a week or a week and a half between incidents.
    I printed the contents of the sqlca.sqqlerrm.sqlerrmc field to a log file. The sqlca.sqlerrm.sqlerrmc field reported an ORA-1405 bind variable was null when the iCount was reporting a zero. When I compiled this application, I set the Proc*C flag to UNSAFE_NULLS=yes since there are other bind variable in the application that can be NULL and that is ok.
    The above SQL is compiled into the C application using the Proc*C compiler. It is compiled using the Oracle 11.2.0.2 libraries. The application is executed against an Oracle 11.2.0.2 database. The database and application are executed on an HP/Unix 11.31 platform.
    This problem did not start occurring until our account went from Oracle 10.2 to Oracle 11.2. Recently, I have changed the SQL to perform a “SELECT COUNT(rownum)” instead of the “SELECT COUNT(*)”. I compiled the application and executed the new application with the SELECT COUNT(rownum) against the same database where the same application with the SELECT COUNT(*) was failing to find a row that actually existed. The application with the SELECT COUNT(rownum) found the matching row as it should have. The new application has been executing in production for about 10 days now without any problems against ten various Oracle 11.2 databases.
    Why would SELECT COUNT(*) and SELECT COUNT(rownum) be any different?

    This forum is about C programming in general, and about using Studio C in particular.
    Your question is about Oracle database programming. You are more likely to find a helpful answer in a forum about database programming. Start here:
    https://forums.oracle.com/forums/category.jspa?categoryID=18

  • WebDynpro Java: how to remove blank element from Table and Dropdown.

    Hi  Folks
    In a webdynpro application,
    I created a table and witten the below code to populate the table
         IPrivateDummyView.IFirst_TableElement First_Table_Element = null;
         First_Table_Element = wdContext.nodeFirst_Table().createFirst_TableElement();
         First_Table_Element.setF_Value("One");
         wdContext.nodeFirst_Table().addElement(First_Table_Element);
         First_Table_Element = wdContext.nodeFirst_Table().createFirst_TableElement();
         First_Table_Element.setF_Value("2");
         wdContext.nodeFirst_Table().addElement(First_Table_Element);
    As per the code, i got 2 row in the table.
    But , i have one Empty row on top of the table ,  how to get ride of this.
    i find the same problem happening with dropdown too, where i used DDBI, i populated a the content as mention, but i initial 2 row as blank and then i have my own elements ,as per my code.

    >
    > how to remove blank element from Table and Dropdown
    >
    Change selection property of related node to from 0..1 to 1..1 (mandatory)
    Re: DropdownByIndex and empty line (Thread: DropdownByIndex and empty line )
    Re: Can the empty selection be removed from element dropdownbykey(Thread: Can the empty selection be removed from element dropdownbykey )
    Edited by: Anagha Jawalekar on Nov 18, 2008 10:28 PM

  • How to get count and other field in one select

    Hi,
    I am try to get total rows and some fields in two separate select:
    1. select count(id) into totalRows from mytable m where m.cat = 'CSV'
    2. select m.id, m.cat, m.updateTime from mytable m where m.cat = 'CSV'
    (all rows in mytable are distinct base on id field)
    How can I combine them into one query to make it faster so that no need to compare the m.cat field twice?
    Thanks.
    David

    Here's one solution :
    SQL> desc test;
    Name Null? Type
    ID NUMBER
    CAT VARCHAR2(10)
    UPDATE_TIME TIMESTAMP(6)
    SQL> select * from test;
    ID CAT UPDATE_TIME
    1 XYZ 09-JAN-04 09.04.17.000000 AM
    2 CSV 09-JAN-04 09.04.31.000000 AM
    4 ABCD 09-JAN-04 09.04.41.000000 AM
    5 CSV 09-JAN-04 09.04.53.000000 AM
    6 ABC 09-JAN-04 09.05.00.000000 AM
    7 CSV 09-JAN-04 09.05.06.000000 AM
    8 GGG 09-JAN-04 09.05.17.000000 AM
    7 rows selected.
    SQL> select id, cat, update_time
    2 ,Count(*) Over (Order By cat) As TotCnt
    3 from test
    4 Where cat = 'CSV'
    5 /
    ID CAT UPDATE_TIME TOTCNT
    2 CSV 09-JAN-04 09.04.31.000000 AM 3
    5 CSV 09-JAN-04 09.04.53.000000 AM 3
    7 CSV 09-JAN-04 09.05.06.000000 AM 3
    SQL>
    -- Shailender Mehta -

  • Different file count between Photo Elements 12 and Lightroom 5.

    To Whom it might concern:
    When I check properties the file count in Photo Elements 12 is different than that of Lightroom 5.
    In one case Photo Elements shows 743 files and 51 folders and lightroom shows 734 files.
    I counted each a every file and found Lightroom to have the correct count and Elements the same count
    but properties shows a count of 743.
    Please answer.
    Albert F Schwartz Jr
    E-mail - [email protected]

    If you think you have found a bug, you should report it to Adobe here: http://feedback.photoshop.com/
    This forum is not the place for bug reports

  • How to reduce logical count and scan count for a select query

    hi,
    I have two tables one is master and other is history. i need to combine this two tables into one temporary table.
    I am using the below query to create temp table.
    Select * into temporders
    from
    (select * from orders
    union
    select * from ordershistory) b
    where updateon= (select max(updateon)from (select updateon,name,units,subunits from orders
    union
    select updateon,name,units,subunits from ordershistory) a
    where updateon <='11/08/2008 11:18 AM' and a.name=b.name and a.units=b.units and a.subunits=b.subunits group by name,units,subunits)
    order by report,subunitsorder
    the statistics for this query:
    SQL Server parse and compile time:
    CPU time = 47 ms, elapsed time = 62 ms.
    Table 'Worktable'. Scan count 556, logical reads 1569, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    Table 'ORDERSHISTORY'. Scan count 116, logical reads 339, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    Table 'ORDERS'. Scan count 116, logical reads 285, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    SQL Server Execution Times:
    CPU time = 32 ms, elapsed time = 63 ms.
    (115 row(s) affected)
    you see logical reads and scan count for worktable(temporary) is quite high.
    So anyone can give a solution for reduce the scan count and logical reads.
    NOTE: name,units, subunits,updateon columns have primarykey

    SQL ServerAm i reading it properly? :(
    This is Oracle Forum And not the SQL Server.
    Regards.
    Satyaki De.

  • 'select count(*) from x' returns 5460 rows and 'Select * from x' returns 0 rows

    As you can see in the next lines something is wrong in my Oracle (8.0.6 on Win NT 4.0 sp 6a) :
    Oracle8 Enterprise Edition Release 8.0.6.0.0 - Production
    With the Partitioning option
    PL/SQL Release 8.0.6.0.0 - Production
    SQLWKS> SELECT * FROM V_TERRA_TE;
    PERIOD_DATE PERIOD_TIME TERRARCV TERRASND TERCV TESND
    0 rows selected.
    SQLWKS> SELECT COUNT(*) FROM V_TERRA_TE;
    COUNT(*)
    5460
    1 row selected.
    V_TERRA_TE is a complex join of 5 Tables :
    CREATE OR REPLACE VIEW "ACTUATE".V_TERRA_TE AS Select to_date(to_char(p1.period_date,'YYYYMMDD'),'YYYYMMDD') "PERIOD_DATE",
    to_date(to_char(p1.period_time,'HH24:MI'),'HH24:MI') "PERIOD_TIME",
    to_number(p1.caudalrcv + ((p3.caudalrcv + p4.caudalrcv)*(confterrate.conexadslterra/confterrate.conexadsltotal))) "TERRARCV",
    to_number(p1.caudalsnd + ((p3.caudalsnd + p4.caudalsnd)*(confterrate.conexadslterra/confterrate.conexadsltotal))) "TERRASND",
    to_number((p2.caudalrcv * confterrate.pctinfonegocio) + ((p3.caudalrcv + p4.caudalrcv)*(confterrate.conexadslte/confterrate.conexadsltotal)))"TERCV",
    to_number((p2.caudalsnd * confterrate.pctinfonegocio) + ((p3.caudalsnd + p4.caudalsnd)*(confterrate.conexadslte/confterrate.conexadsltotal)))"TESND"
    from p1,p2,p3,p4,confterrate
    where (p1.period_date=p2.period_date)and
    (p1.period_date=p3.period_date)and
    (p1.period_date=p4.period_date)and
    (p1.period_time=p3.period_time)and
    (p1.period_time=p4.period_time)and
    (p1.period_time=p2.period_time)and
    to_char(p1.period_date,'MMYYYY')=to_char(confterrate.period_datetime,'MMYYYY');
    I think that some not reported error happens in the select * with some temporary space or similar but only the message '0 rows selected' is displayed (instead the real error)
    Could somebody help me ?
    Thanks in advance
    Francisco

    Forcing the Join/sort to be made on Disk (not on memory) the problem not happens. This demostrate that ORACLE has a VERY IMPORTANT BUG : It returns 0 rows wich is false.
    To force it to work on disk i use this parameters :
    alter session set sort_area_size=0
    alter session set hash_join_enabled=false
    Note : probably is not the best combination or use of parameters, but using it the query works as espected.

  • Count() for each group, but only groups having 1+ element like... AND all elements like...

    There are tables(and columns) like:
    'Clients'(clientID)
    'Houses' (houseID)
    'Visits' (clientID, houseID, visit_date)
    'Contracts'(contractID, houseID, clientID, rentDate_from, rentDate_end)
    I have problem with writing MS SQL query of this kind:
    how many visits to houses did each client, before renting one of them?
    Its easy to count total number of Visits for each client, listing all visits + group by clientID and selecting count(*) for each group.
    Lets say this is select_1, and select_2 is listing all Contracts for all clients.
    Select_1 is not answer, because count must be performed only on groups, which:
    -have at least 1 row "like" row in select_2 (it means that at least one of visited houses was rented, because it can happen that client visited few houses, but rented other, not visited house). my idea for this is comparing select_1 and select_2 with:
    "where s1.clientID=s2.clientID and s1.houseID=s2.houseID"
    -each group must have all rows(visits) with date of same day or earlier than contract date
     maybe: "datediff(day, s1.visit_date, s2.rentDate_from) >= 0"

    In future, please provide proper DML, DDL and example data, like I have for you below.
    DECLARE @clients TABLE (clientID INT, name VARCHAR(20))
    INSERT INTO @clients (clientID, name)
    VALUES (1, 'Jonathan'),(2, 'Christopher'),(3, 'James'),(4, 'Jean-Luc'),(5, 'William')
    DECLARE @houses TABLE (houseID INT, address VARCHAR(20))
    INSERT INTO @houses (houseID, address)
    VALUES (1, 'NX01'),(2, 'NCC 1701'),(3, 'NCC 1071A'),(4, 'NCC 1701D'),(5, 'NCC 1701E')
    DECLARE @visits TABLE (clientID INT, houseID INT, visitDateTime DATETIME)
    INSERT INTO @visits (clientID, houseID, visitDateTime)
    VALUES (1,1,'2001-01-01 12:13:14'),
    (2,2,'2001-01-02 12:13:14'),
    (3,2,'2001-01-01 12:13:14'),(3,3,'2001-01-01 12:13:14'),
    (4,4,'2001-01-01 12:13:14'),(4,5,'2001-01-01 12:13:14'),
    (5,4,'2001-01-01 12:13:14'),(5,5,'2001-01-01 12:13:14')
    DECLARE @contracts TABLE (contractID INT IDENTITY, houseID INT, clientID INT, rentStartDate date, rentEndDate date)
    INSERT INTO @contracts (houseID, clientID, rentStartDate, rentEndDate)
    VALUES (1,1,'2001-01-02',NULL),(2,2,'2001-01-02',NULL),(3,3,'2001-01-02',NULL),(4,4,'2001-01-02',NULL),(5,5,'2001-01-02',NULL)
    SELECT contractID, c.houseID, c.clientID, rentStartDate, rentEndDate, cl.clientID, name, h.houseID, address, COUNT(v.clientID) AS visits
    FROM @contracts c
    LEFT OUTER JOIN @clients cl
    ON c.clientID = cl.clientID
    LEFT OUTER JOIN @houses h
    ON c.houseID = h.houseID
    LEFT OUTER JOIN @visits v
    ON c.clientID = v.clientID
    AND c.rentStartDate >= v.visitDateTime
    GROUP BY contractID, c.houseID, c.clientID, rentStartDate, rentEndDate, cl.clientID, name, h.houseID, address

  • JPGS are set to open in Photoshop Elements, but they open in Windows Photo Viewer instead, even when I specifically select Photoshop (and it's the default app)

    JPGS are set to open in Photoshop Elements, but they open in Windows Photo Viewer instead, even when I specifically select Photoshop (and it's the default app)

    Hi,
    It seems this is a Microsoft related. You are referring on how to set JPG Image in Photoshop Elements by default. You may try visiting Microsoft's Support page http://support.microsoft.com/ for you to get the correct information/help you need.
    Thank you.

Maybe you are looking for

  • Error while open bps layout

    Hi guys... i have a big problem and i need some answers from you. I have in my laptop saplogon 710 Final Release File version 7100.1.0.1027 and microsoft office 2007... when i try to open a planning folder the system gives me the following error: "Er

  • Carriage Return with the text in xdofx

    Hi I have to insert a carriage return with in a text I tried <?xdoxslt:chr(10)?> e.g <?xdofx:if x>'0' then 'Approved. Thank you.' else 'Disapprov.Thank you. ' end if?> so the output should be Approved Thank You I need carriage return between Approved

  • Help required specifying Transation attributes for this scenario

    Hi , I am trying to create/update rows in a database using BMP and CMP beans. A business method ( Method1 )in session bean calls a non-business method ( Method2) in the same session bean which inturn calls an EntityBean ( EB1-BMP) . EB1 can throw a c

  • IPhoto 9 - Can't Edit photos. Only get black screen

    Recently I went to edit some photos I have in iPhoto 9.  When I click on a thumbnail to edit, I get nothing but black.  When I show file, the jpg is there and it opens fine in preview. I tried the iPhoto Library Manager. Made a new library and then t

  • Problem with add records by matrix in UDO

    Hi, I'm set DataBind for my columns using DBDataSource. But loading data in matrix by DataTable through method ExecuteQuery. After this I'm dont to save data in my child table. Somebody can I help me?