Query Producing Incorrect Results

Hello:
I am trying to perform a number of queries on a database and
although I am not receiving an error message; I know that the
returned results are incorrect.
For example, in my test data; I have only 1 record that
matches the SchoolBoardID (Therefore the record could only have one
grade, one gender, etc. yet my queries are returning results for
both genders (Male and Female) and multiple grades (11 and 12) when
the record in question actually has a grade 9 assignment.
I have looked at my code over and over and I cannot find
where the problem is; does anyone see anything that jumps out at
them?
I am using an MS-Access database and I have the following
data types for the relevant fields in question.
Field Name = SchoolBoardID - Numeric - Sample Data - 74
Field Name = StudentTraineeGender - Data Type = Text - Sample
Data - Either Male or Female
Field Name = StudentTraineeGrade - Data Type = Text - Data
Contains the following (9, 10, 11, 12, 12+ Hence the reason for
having to use a Text data type)
Field Name = SchoolYear - Data Type = Text - Sample Data -
2006-2007
Field Name = TradeCode - Data Type = Text - Sample Data -
444A
Field Name = TeacherWEAApproval - Data Type = Yes/No - Sample
Data - 1 or 0
<!--- Query The Database to find all Grade 11 Males Who
Are Taking an Apprenticeable Trade --->
<cfquery name="GetGrade11Males"
datasource="MyDataSource">
Select SchoolBoardID, StudentTraineeGender,
StudentTraineeGrade, SchoolYear, TradeCode, TeacherWEAApproval From
WEA_Registrants
Where SchoolBoardID = #Session.Auth.SchoolBoardID# And
SchoolYear = '#Form.SchoolYear#'
And StudentTraineeGender = 'Male'
And StudentTraineeGrade = '11'
And TradeCode <> '0000'
And TeacherWEAApproval = 1
</cfquery>
<cfset NumberOfGrade11Males =
#GetGrade11Males.RecordCount#>
<!--- End Of The Query to find all Grade 11 Males Who Are
Taking an Apprenticeable Trade --->
<!--- Query The Database to find all Grade 12 Males Who
Are Taking an Apprenticeable Trade --->
<cfquery name="GetGrade12Males"
datasource="MyDataSource">
Select SchoolBoardID, StudentTraineeGender,
StudentTraineeGrade, SchoolYear, TradeCode, TeacherWEAApproval From
WEA_Registrants
Where SchoolBoardID = #Session.Auth.SchoolBoardID# And
SchoolYear = '#Form.SchoolYear#'
And StudentTraineeGender = 'Male'
And StudentTraineeGrade = '12' Or StudentTraineeGrade =
'12+'
And TradeCode <> '0000'
And TeacherWEAApproval = 1
</cfquery>
<cfset NumberOfGrade12Males =
#GetGrade12Males.RecordCount#>
<!--- End Of The Query to find all Grade 12 Males Who Are
Taking an Apprenticeable Trade --->
<!--- Query The Database to find all Grade 11 Females Who
Are Taking an Apprenticeable Trade --->
<cfquery name="GetGrade11Females"
datasource="MyDataSource">
Select SchoolBoardID, StudentTraineeGender,
StudentTraineeGrade, SchoolYear, TradeCode, TeacherWEAApproval From
WEA_Registrants
Where SchoolBoardID = #Session.Auth.SchoolBoardID# And
SchoolYear = '#Form.SchoolYear#'
And StudentTraineeGender = 'Female'
And StudentTraineeGrade = '11'
And TradeCode <> '0000'
And TeacherWEAApproval = 1
</cfquery>
<cfset NumberOfGrade11Females =
#GetGrade11Females.RecordCount#>
<!--- End Of The Query to find all Grade 11 Females Who
Are Taking an Apprenticeable Trade --->
<!--- Query The Database to find all Grade 12 Females Who
Are Taking an Apprenticeable Trade --->
<cfquery name="GetGrade12Females"
datasource="MyDataSource">
Select SchoolBoardID, StudentTraineeGender,
StudentTraineeGrade, SchoolYear, TradeCode, TeacherWEAApproval From
WEA_Registrants
Where SchoolBoardID = #Session.Auth.SchoolBoardID# And
SchoolYear = '#Form.SchoolYear#'
And StudentTraineeGender = 'Female'
And StudentTraineeGrade = '12' Or StudentTraineeGrade =
'12+'
And TradeCode <> '0000'
And TeacherWEAApproval = 1
</cfquery>
<cfset NumberOfGrade12Females =
#GetGrade12Females.RecordCount#>
<!--- End Of The Query to find all Grade 12 Females Who
Are Taking an Apprenticeable Trade --->
<!--- Query To Find The Total Number Of Male Students
Registered As Apprentices --->
<cfquery name="GetMaleRegisteredApprentices"
datasource="MyDataSource">
<!--- End Of Query To Find The Total Number Of Male
Students Registered As Apprentices --->
Select SchoolBoardID, SchoolYear, StudentTraineeGender,
TradeCode, RequestForMTCUByTeacher, ApprovedForMTCUByOYAP,
TeacherWEAApproval From WEA_Registrants
Where SchoolBoardID = #Session.Auth.SchoolBoardID# And
SchoolYear = '#Form.SchoolYear#'
And TradeCode <> '0000'
And StudentTraineeGender = 'Male'
And RequestForMTCUByTeacher = 1
And ApprovedForMTCUByOYAP = 1
And TeacherWEAApproval = 1
</cfquery>
<cfset NumberOfMaleRegisteredApprentices =
#GetMaleRegisteredApprentices.RecordCount#>
<!--- Query To Find The Total Number Of Female Students
Registered As Apprentices --->
<cfquery name="GetFemaleRegisteredApprentices"
datasource="MyDataSource">
<!--- End Of Query To Find The Total Number Of Female
Students Registered As Apprentices --->
Select SchoolBoardID, SchoolYear, StudentTraineeGender,
TradeCode, RequestForMTCUByTeacher, ApprovedForMTCUByOYAP,
TeacherWEAApproval From WEA_Registrants
Where SchoolBoardID = #Session.Auth.SchoolBoardID# And
SchoolYear = '#Form.SchoolYear#'
And TradeCode <> '0000'
And StudentTraineeGender = 'Female'
And RequestForMTCUByTeacher = 1
And ApprovedForMTCUByOYAP = 1
And TeacherWEAApproval = 1
</cfquery>
<cfset NumberOfFemaleRegisteredApprentices =
#GetFemaleRegisteredApprentices.RecordCount#>
<!--- Query To Find The Total Number Of Male Students
Registered As Apprentices Graduated--->
<cfquery name="GetMaleRegisteredApprenticesGraduated"
datasource="MyDataSource">
<!--- End Of Query To Find The Total Number Of Male
Students Registered As Apprentices --->
Select SchoolBoardID, SchoolYear, StudentTraineeGender,
TradeCode, RequestForMTCUByTeacher, ApprovedForMTCUByOYAP,
Graduated, TeacherWEAApproval From WEA_Registrants
Where SchoolBoardID = #Session.Auth.SchoolBoardID# And
SchoolYear = '#Form.SchoolYear#'
And TradeCode <> '0000'
And StudentTraineeGender = 'Male'
And RequestForMTCUByTeacher = 1
And ApprovedForMTCUByOYAP = 1
And Graduated = 1
And TeacherWEAApproval = 1
</cfquery>
<cfset NumberOfMaleRegisteredApprenticesGraduated =
#GetMaleRegisteredApprenticesGraduated.RecordCount#>
<!--- Query To Find The Total Number Of Female Students
Registered As Apprentices Graduated--->
<cfquery name="GetFemaleRegisteredApprenticesGraduated"
datasource="MyDataSource">
<!--- End Of Query To Find The Total Number Of Male
Students Registered As Apprentices --->
Select SchoolBoardID, SchoolYear, StudentTraineeGender,
TradeCode, RequestForMTCUByTeacher, ApprovedForMTCUByOYAP,
Graduated, TeacherWEAApproval From WEA_Registrants
Where SchoolBoardID = #Session.Auth.SchoolBoardID# And
SchoolYear = '#Form.SchoolYear#'
And TradeCode <> '0000'
And StudentTraineeGender = 'Female'
And RequestForMTCUByTeacher = 1
And ApprovedForMTCUByOYAP = 1
And Graduated = 1
And TeacherWEAApproval = 1
</cfquery>
<cfset NumberOfFemaleRegisteredApprenticesGraduated =
#GetFemaleRegisteredApprenticesGraduated.RecordCount#>
Thank you for any assistance that you can lend me with
resolving my query issues:
Regards,
Chizzy
Cornwall, Ontario, Canada

Hello:
SchoolBoardID is unique in that there is only 1 record in the
WEA_Registrants table containing it; however, it was my intention
with my queries to have the potential for more that one query to
have a positive recordcount. (i.e. It would be possible for
#GetGrade11Males.RecordCount# and
#NumberOfMaleRegisteredApprentices# and
#NumberOfMaleRegisteredApprenticesGraduated# to all return positve
record counts.
quote:
Sounds like there may be more to this issue than you are
leading us to believe.
To the best of my knowledge, I have presented
all of the relevant information.
I will look into the documentation on cfqueryparam.
Thanks for your assistance.
Regards,
Chizzy

Similar Messages

  • Addition of Key Figures in Query Produces incorrect Results

    Hi,
    I have a query with a globally defined structure of Restricted Key Figures. These are mainly G/L Account Balances from R/3.
    When I create a global Calculated Key Figure the sum is incorrect (ie does not match R/3) despite the fact that the individual restricted key figures match perfectly.
    The only inconsistency is one or 2 of the RKF's are + ve in R/3 but - ve in BW.
    Would really appreciate some help on this.
    Thanks a lot.

    Hi All,
    Thanks for your replies.
    Paul B - I tried your recommendation and it did not work. I only set the result to summation nothing else.
    Bjorn - I tried what you said but that didnt work either.
    Venkat - I thought about this but I have about 30 + Calculated Key Figs and over 100 Restricted Kfs and a fair amount have -ve signs. Do I have to do this for all ?
    Regards

  • BEx Query Providing Incorrect Results

    I have two BEx queries that are behaving strangely.
    They are providing incorrect results and I can't figure out why.
    In both cases, when I save query in development under a different technical name the problem disappear.   I can't use this as a permanent solution because users insert queries in workbooks and we have portal links.
    Is there a way to somehow  fix these queries that
    are acting strangely.
    Query 1:
    When run query get error message
    "No roll storage space of length 120 available fro OCCURS area"
    Query2:   Calculates Wrong Average
    When run query:
    Adding Cumulative Qty Customer Balance + Quantity Customer Movement
    together.
    Set Aggregation to Average
    ref char Posting Period.
    The avearge BEx calculates only considers  Cummulative Quantity
    End Customer Balance.  It should consider consider Quantity Customer Movement as well.
    Avg formula :  ((Jan End - (.5* Jan Mov) ) + (Feb End - (.5* Feb Mov))+   (Mar End -(.5* March Mov)))/3
    I have used the same  methodology to calculate average with other queries and it average calculates correctly.  These other queries have same InfoProvider and using the same dimensions as queries that are calculating average incorrectly.

    Hi Mti
    Thank you for your reply.
    I have checked the details as per your suggestion:
    1. KF Aggreagtion tab on Workbench Exception Aggregation is on SUM Summation.
    2. RKF on The Query is on (Nothing Defined).
    Is there anything else that can be checked?
    Thank you

  • SQL Query produces different results when inserting into a table

    I have an SQL query which produces different results when run as a simple query to when it is run as an INSERT INTO table SELECT ...
    The query is:
    SELECT   mhldr.account_number
    ,        NVL(MAX(DECODE(ap.party_sysid, mhldr.party_sysid,ap.empcat_code,NULL)),'UNKNWN') main_borrower_status
    ,        COUNT(1) num_apps
    FROM     app_parties ap
    SELECT   accsta.account_number
    ,        actply.party_sysid
    ,        RANK() OVER (PARTITION BY actply.table_sysid, actply.loanac_latype_code ORDER BY start_date, SYSID) ranking
    FROM     activity_players actply
    ,        account_status accsta
    WHERE    1 = 1
    AND      actply.table_id (+) = 'ACCGRP'
    AND      actply.acttyp_code (+) = 'MHLDRM'
    AND      NVL(actply.loanac_latype_code (+),TO_NUMBER(SUBSTR(accsta.account_number,9,2))) = TO_NUMBER(SUBSTR(accsta.account_number,9,2))
    AND      actply.table_sysid (+) = TO_NUMBER(SUBSTR(accsta.account_number,1,8))
    ) mhldr
    WHERE    1 = 1
    AND      ap.lenapp_account_number (+) = TO_NUMBER(SUBSTR(mhldr.account_number,1,8))
    GROUP BY mhldr.account_number;      The INSERT INTO code:
    TRUNCATE TABLE applicant_summary;
    INSERT /*+ APPEND */
    INTO     applicant_summary
    (  account_number
    ,  main_borrower_status
    ,  num_apps
    SELECT   mhldr.account_number
    ,        NVL(MAX(DECODE(ap.party_sysid, mhldr.party_sysid,ap.empcat_code,NULL)),'UNKNWN') main_borrower_status
    ,        COUNT(1) num_apps
    FROM     app_parties ap
    SELECT   accsta.account_number
    ,        actply.party_sysid
    ,        RANK() OVER (PARTITION BY actply.table_sysid, actply.loanac_latype_code ORDER BY start_date, SYSID) ranking
    FROM     activity_players actply
    ,        account_status accsta
    WHERE    1 = 1
    AND      actply.table_id (+) = 'ACCGRP'
    AND      actply.acttyp_code (+) = 'MHLDRM'
    AND      NVL(actply.loanac_latype_code (+),TO_NUMBER(SUBSTR(accsta.account_number,9,2))) = TO_NUMBER(SUBSTR(accsta.account_number,9,2))
    AND      actply.table_sysid (+) = TO_NUMBER(SUBSTR(accsta.account_number,1,8))
    ) mhldr
    WHERE    1 = 1
    AND      ap.lenapp_account_number (+) = TO_NUMBER(SUBSTR(mhldr.account_number,1,8))
    GROUP BY mhldr.account_number;      When run as a query, this code consistently returns 2 for the num_apps field (for a certain group of accounts), but when run as an INSERT INTO command, the num_apps field is logged as 1. I have secured the tables used within the query to ensure that nothing is changing the data in the underlying tables.
    If I run the query as a cursor for loop with an insert into the applicant_summary table within the loop, I get the same results in the table as I get when I run as a stand alone query.
    I would appreciate any suggestions for what could be causing this odd behaviour.
    Cheers,
    Steve
    Oracle database details:
    Oracle Database 10g Release 10.2.0.2.0 - Production
    PL/SQL Release 10.2.0.2.0 - Production
    CORE 10.2.0.2.0 Production
    TNS for 32-bit Windows: Version 10.2.0.2.0 - Production
    NLSRTL Version 10.2.0.2.0 - Production
    Edited by: stevensutcliffe on Oct 10, 2008 5:26 AM
    Edited by: stevensutcliffe on Oct 10, 2008 5:27 AM

    stevensutcliffe wrote:
    Yes, using COUNT(*) gives the same result as COUNT(1).
    I have found another example of this kind of behaviour:
    Running the following INSERT statements produce different values for the total_amount_invested and num_records fields. It appears that adding the additional aggregation (MAX(amount_invested)) is causing problems with the other aggregated values.
    Again, I have ensured that the source data and destination tables are not being accessed / changed by any other processes or users. Is this potentially a bug in Oracle?Just as a side note, these are not INSERT statements but CTAS statements.
    The only non-bug explanation for this behaviour would be a potential query rewrite happening only under particular circumstances (but not always) in the lower integrity modes "trusted" or "stale_tolerated". So if you're not aware of any corresponding materialized views, your QUERY_REWRITE_INTEGRITY parameter is set to the default of "enforced" and your explain plan doesn't show any "MAT_VIEW REWRITE ACCESS" lines, I would consider this as a bug.
    Since you're running on 10.2.0.2 it's not unlikely that you hit one of the various "wrong result" bugs that exist(ed) in Oracle. I'm aware of a particular one I've hit in 10.2.0.2 when performing a parallel NESTED LOOP ANTI operation which returned wrong results, but only in parallel execution. Serial execution was showing the correct results.
    If you're performing parallel ddl/dml/query operations, try to do the same in serial execution to check if it is related to the parallel feature.
    You could also test if omitting the "APPEND" hint changes anything but still these are just workarounds for a buggy behaviour.
    I suggest to consider installing the latest patch set 10.2.0.4 but this requires thorough testing because there were (more or less) subtle changes/bugs introduced with [10.2.0.3|http://oracle-randolf.blogspot.com/2008/02/nasty-bug-introduced-with-patch-set.html] and [10.2.0.4|http://oracle-randolf.blogspot.com/2008/04/overview-of-new-and-changed-features-in.html].
    You could also open a SR with Oracle and clarify if there is already a one-off patch available for your 10.2.0.2 platform release. If not it's quite unlikely that you are going to get a backport for 10.2.0.2.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Does compare aggregates mode produce incorrect results?

    Has anyone encountered a problem with using compare aggregates mode with arrays. 
    For example, if compare aggregates mode is selected in using the "In Range and Coerce.vi" with the inputs (upperLimit, lowerLimit, and x value)  being an array of integers, then compare aggregates doesnot return correct results.  I've also noticed this with the greater than and less than comparison vi's.
    I've attached a sample which further illustrates the incorrect results.
    Attachments:
    compareAggregatesTest.vi ‏9 KB
    compareAggregatesTest1.vi ‏9 KB

    I talked to some people at NI and here's how I understand it:
    Compare aggregates simply does not do what we think it does. It is NOT the same as comparing all elements and then ANDing the results. Instead, it compares the elements in the cluster in order. This is actually identical to ANDing the results when you do an equality comparison, but it's different if you do a less-than or greater-than comparison.
    The LabVIEW help provides the example of a phone book, where "Smith, John" is greater than "Smith, Jane" and where "Smith, Jane" is also greater than "Doe, John" because Doe comes before Smith.
    This helps to explain the results of my example:
    In the first array element, the comparison fails because 10 is the first element in the cluster and it is less than 40.
    In the second array element, 40 and 40 are equal, so the decision is moved to the next element (like having two "Smith"s, and since 40 is greater than 30, the comparison returns true.
    So again, the order is important!
    Try to take over the world!
    Attachments:
    Compare Aggregates.png ‏16 KB

  • Report works fine iusing 11.0; produces incorrect results using 11.5

    I have a report that accepts a .net dataset which has many linked tables. When the report is run using the 11.0 environment it works fine. When the report is run using the 11.5 environment the report is produced, but the results are not being linked appropriately. The report duplicates the data in a cartesian product type manner.

    Our Application was initially using CR 11.0.0.895 with MS .NET 1.1. We are in the process of migrating our application to .NET 3.5. We split the app into 2 websites 1 using .NET 1.1 and 2 using .NET 3.5. Since CR XI does not work with .NET 2.0+ we upgraded to CRXIR2. The problem is in at least one of the reports in the .NET 1.1 website (there may be more, but we are only aware of this one issue at this time) is generating erronious results.

  • Analytical query producing different result on joins

    Hi,
    The queries below should have the same output but the first one just does a left join instead of a full join. Can you please help me figure out why ?
    SELECT source_aa, source_bb, COUNT (*)
    FROM (SELECT *
    FROM (SELECT a_a.application_id,
    'In_APPLICATION' AS source_aa,
    RANK () OVER (PARTITION BY application_id ORDER BY date DESC) AS rank_aa
    FROM application a_a)
    WHERE rank_aa = 1) aa
    FULL JOIN
    (SELECT *
    FROM (SELECT b_b.application_id,
    'In_APPLICATION_ARCHV' AS source_bb,
    RANK () OVER (PARTITION BY application_id ORDER BY date DESC) AS rank_bb
    FROM application_archv b_b)
    WHERE rank_bb = 1) bb
    ON aa.application_id = bb.application_id
    GROUP BY source_aa, source_bb;
    SELECT source_aa, source_bb, COUNT (*)
    FROM (SELECT DISTINCT application_id,'In_APPLICATION' AS source_aa
    FROM application) aa
    FULL JOIN
    (SELECT DISTINCT application_id,'In_APPLICATION_ARCHV' AS source_bb
    FROM application_archv) bb
    ON aa.application_id = bb.application_id
    GROUP BY source_aa, source_bb;
    -----

    Both your query does a FULL JOIN. But in the first query you have extra filter condition. You are geting only the latest application_id. Check this
    <pre>
    SELECT *
    FROM (
    SELECT b_b.application_id
    , 'In_APPLICATION_ARCHV' AS source_bb
    <font color=red>
    , RANK () OVER (PARTITION BY application_id ORDER BY date DESC) AS rank_bb
    </font>
    FROM application_archv b_b
    <font color=red>
    WHERE rank_bb = 1
    </font>
    </pre>
    The the code in red is the once thats causing the difference in output.

  • Transforming to a user defined projection produces incorrect results

    Dear all
    I have set up a user defined projection in Oracle for an obsolete Ordnance Survey projection based on the Cassini-Soldner projection. I've got the projection itself to work but when I went to do a transformation from British National Grid (SRID 81989) to my projection, it failed to transform correctly.
    I have since realised I needed a transformation entry in the SDO_COORD_OPS table. However despite adding in an entry, which I've copied below, I cannot get the transformation to work correctly. Have I made a mistake iwth one of my entries or is there an entry I need to create else where in order for this to work. Also I am not certain what the difference is between CONVERSION and TRANSFORMATION. I would be grateful of any comments or help.
    INSERT INTO SDO_COORD_OPS (
    coord_op_id,
    coord_op_name,
    coord_op_type,
    source_srid,
    target_srid,
    coord_tfm_version,
    coord_op_variant,
    coord_op_method_id,
    uom_id_source_offsets,
    uom_id_target_offsets,
    information_source,
    data_source,
    show_operation,
    is_legacy,
    legacy_code,
    reverse_op,
    is_implemented_forward,
    is_implemented_reverse)
    VALUES (
    819899616,
    'British National Grid SRID 81989 to Cassini-Soldner vers D',
    'TRANSFORMAION',
    81989, -- this is the British National Grid projection
    96163497, -- this is the obsolete projection
    NULL,
    1,
    9633,  -- this refers to Ordnance Survey National Transformation in SDO_COORD_OP_METHODS
    NULL,
    NULL,
    'Brian Adams and Ordnance Survey',
    'Brian Adams and Ordnance Survey',
    1,
    'FALSE',
    NULL,
    1,
    0,
    0);I also have a conversion entry for the obsolete projection. This is as follows:
    INSERT INTO SDO_COORD_OPS (
    coord_op_id,
    coord_op_name,
    coord_op_type,
    source_srid,
    target_srid,
    coord_tfm_version,
    coord_op_variant,
    coord_op_method_id,
    uom_id_source_offsets,
    uom_id_target_offsets,
    information_source,
    data_source,
    show_operation,
    is_legacy,
    legacy_code,
    reverse_op,
    is_implemented_forward,
    is_implemented_reverse)
    VALUES (
    (1234567,
    'Cassini-Soldner vers D',
    'CONVERSION',
    NULL,
    NULL,
    NULL,
    NULL,
    9806, -- this refers to Cassini-Solder in SDO_COORD_OP_METHODS
    NULL,
    NULL,
    'Brian Adams',
    'Brian Adams and Ordnance Survey',
    1,
    'FALSE',
    NULL,
    1,
    1,
    1);and I will be making use of the following two entries, although like above this may be wrong.
    INSERT INTO SDO_COORD_OPS (
    coord_op_id,
    coord_op_name,
    coord_op_type,
    source_srid,
    target_srid,
    coord_tfm_version,
    coord_op_variant,
    coord_op_method_id,
    uom_id_source_offsets,
    uom_id_target_offsets,
    information_source,
    data_source,
    show_operation,
    is_legacy,
    legacy_code,
    reverse_op,
    is_implemented_forward,
    is_implemented_reverse)
    VALUES (
    961681989,
    'Cassini-Soldner vers D to British National Grid SRID 81989',
    'TRANSFORMAION',
    96163497, -- this is the obsolete projection
    81989,  -- this is the British National Grid projection
    NULL,
    1,
    9806, -- this refers to Cassini-Solder in SDO_COORD_OP_METHODS
    NULL,
    NULL,
    'Brian Adams',
    'Brian Adams and Ordnance Survey',
    1,
    'FALSE',
    NULL,
    1,
    0,
    0);
    INSERT INTO SDO_COORD_OPS (
    coord_op_id,
    coord_op_name,
    coord_op_type,
    source_srid,
    target_srid,
    coord_tfm_version,
    coord_op_variant,
    coord_op_method_id,
    uom_id_source_offsets,
    uom_id_target_offsets,
    information_source,
    data_source,
    show_operation,
    is_legacy,
    legacy_code,
    reverse_op,
    is_implemented_forward,
    is_implemented_reverse)
    VALUES (
    961627700,
    'Cassini-Soldner vers D to British National Grid SRID 27700',
    'TRANSFORMAION',
    96163497, -- this is the obsolete projection
    27700, -- this is the OSGB 1936 / British National Grid projection
    NULL,
    1,
    9806,  -- this refers to Cassini-Solder in SDO_COORD_OP_METHODS
    NULL,
    NULL,
    'Brian Adams',
    'Brian Adams and Ordnance Survey',
    1,
    'FALSE',
    NULL,
    1,
    0,
    0);Kind regards
    Tim

    Hi Mike
    Thank you so much for your help. I see where I went wrong. I thought the unit of measurement referred to the unit used to measure the distance when working with the projection. As all measuring is done in metres, I thought every uom_id value entered had to be set to metres. Where as in fact the uom_id actually refers to the unit of the figure being entered in that particular insert statement and not the unit eventually used to measure distance. I thought the parameter_id value told Oracle that it was in degrees, not the uom_id, since parameter_id refers to either the longitude of origin or latitude of origin, depending on which statement was being entered.
    I am coming at my work from the point of view of being a cartography and GIS specialist who is learning how to use Oracle, rather than an Oracle specialist who is learning about cartography and GIS. I found chapter 6 rather confusing whilst I was trying to understand how I insert a projection into Oracle, and in my confusion and attempts to understand what I needed to do, I made the above mistake.
    It does state on page 6-11 of the spatial manual, for UOM_ID, "ID number of the unit of measure associated with the operation." However as I'd never set up a projection in Oracle before, I really needed more a detailed explanations as to what needs to be done and more importantly, why it needs to be done. The introduction for the table states "The SDO_COORD_OP_PARAM_VALS table contains information about parameter values for each coordinate system transformation method." However that doesn't really explain in enough detail what it means in terms of what you need to enter and why it needs to be entered.
    There is one example of inserting a projection towards the end of the chapter but it does not explain the different stages of entry and what they mean in enough detail. I had to keep referring back to the tables, in order to try and understand what is going on and that got very confusing at times. I have both the original and revised editions of Pro Oracle Spatial but they just refer me to the spatial manual for the insertion of a user defined projection. It would be really good if someone wrote a book or booklet explaining in more detail the spatial projection creation side of things in Oracle.
    I do not have privileges to insert the statements myself but when the person with the correct privileges returns from their Easter break I will get the changes made. Regarding the Airy 1830 projection, I am given two results in both cases when I run the below statements. I know that the original map uses the 1830 Airy and not the 1847 modified, which is why I've used the former in both cases. If there is another Airy that I have missed then I would be grateful if you could tell me which values I need and I will get those entries amended too:
    select * from SDO_DATUMS
    where datum_name like '%Airy%'
    DATUM_ID               DATUM_NAME                                                                       DATUM_TYPE               ELLIPSOID_ID           PRIME_MERIDIAN_ID      INFORMATION_SOURCE                                                                                                                                                                                                                                             DATA_SOURCE                              SHIFT_X                SHIFT_Y                SHIFT_Z                ROTATE_X               ROTATE_Y               ROTATE_Z               SCALE_ADJUST           IS_LEGACY LEGACY_CODE           
    6001                   Not specified (based on Airy 1830 ellipsoid)                                     GEODETIC                 7001                   8901                   EPSG                                                                                                                                                                                                                                                           EPSG                                                                                                                                                                                                      FALSE                           
    6002                   Not specified (based on Airy Modified 1849 ellipsoid)                            GEODETIC                 7002                   8901                   EPSG                                                                                                                                                                                                                                                           EPSG                                                                                                                                                                                                      FALSE                           
    2 rows selected
    select * from SDO_CRS_GEOGRAPHIC2D
    where COORD_REF_SYS_NAME like '%Airy%';
    SRID                   COORD_REF_SYS_NAME                                                               COORD_SYS_ID           DATUM_ID               INFORMATION_SOURCE                                                                                                                                                                                                                                             DATA_SOURCE                             
    4001                   Unknown datum based upon the Airy 1830 ellipsoid                                 6422                   6001                   EPSG                                                                                                                                                                                                                                                           EPSG                                    
    4002                   Unknown datum based upon the Airy Modified 1849 ellipsoid                        6422                   6002                   EPSG                                                                                                                                                                                                                                                           EPSG                                    
    2 rows selectedAs I hadn't looked through chapter 6 of spatial manual since last August, in relation to my original insert statement for sdo_coord_ref_system table, it took me sometime to figure out where to locate the other tables containing the related entries I required. Which backs up my opinion for the need of even more detailed information on the different tables, including how they link and why they link.
    Kind regards and once again thank you for your help
    Tim

  • Query producing null results

    I have the following update statement:
    update Position set value=(select price from SecuMaster where SecuMaster.cusip = Position.cusip and SecuMaster.dealernumber='ID' and SecuMaster.dealernumber=Position.dealernumber and SecuMaster.price is not null)* Position.sharesThe problem is if there is no SecuMaster.price for the current Position.cusip, I get the null return.
    I want to prevent the null from being used.
    is there any way to avoid this, some sort of conditional in sql?

    iketurner wrote:
    I have the following update statement:
    Helps to format lines so that they are more readable.
    >
    update Position set value=(
    select price from SecuMaster
    where SecuMaster.cusip = Position.cusip
    and SecuMaster.dealernumber='ID'
    and SecuMaster.dealernumber=Position.dealernumber
    and SecuMaster.price is not null)* Position.shares
    The problem is if there is no SecuMaster.price for the current Position.cusip, I get the null return.
    I want to prevent the null from being used.
    is there any way to avoid this, some sort of conditional in sql?Currently the situation is that every row is gettng updated. So obviously the column
    must be set to something.
    Value needs to be set to something correct? So do you just not want to overwrite it
    or do you want something else there?
    Note that problems like this usually require information about which database and version is in use.

  • LIMIT IN QUERY TO LIMIT RESULTS

    I was reading the article here:
    http://www.inquiry.com/techtips/oracle_pro/10min/10min1200/10min1200-3.asp
    I am working from an oracle 8i database with a few thousand records in it.
    Can you help me out here? I tried the example method, and it appears to me that it is only returning sets of data
    that are below the ROWNUM I request. For example, if I use .... WHERE ROWNUM<100 ... It looks like it only gets data from the first 100 rows of the table instead of a count of the query's result row numbers.
    When I put a very loose term into the search, it should return the max, 100 lines, but only returns 87. I know one query produces 156 results, but this limit cuts off at 60.
    I really would like to be able to show 30 results per page and have users click 'next page' to view the next 30. It seems absurd to me that with Postgress, or MySQL I can do this very easily with ... LIMIT 100,30 .... Oracle DB does not have the capability? I don't know.
    Please, if you know you can help. (PLEASE!)

    Perhaps a less offensive way to put it might have been simply to ask, "does anyone know how to do this in Oracle as I am relatively inexperienced in this environment" instead of "It seems absurd to me that with Postgress, or MySQL I can do this very easily with ... LIMIT 100,30 .... Oracle DB does not have the capability?". The implication is clearly that these other environments are superior, which is offensive, especially when avowed by someone who has demonstrated his limited knowledge of Oracle.

  • Unable to create report. Query produced too many results

    Hi All,
    Does someone knows how to avoid the message "Unable to create report. Query produced too many results" in Grid Report Type in PerformancePoint 2010. When the mdx query returns large amount of data, this message appears. Is there a way to get all
    the large amount in the grid anyway?
    I have set the data Source query time-out under Central Administration - Manager Service applications - PerformancePoint Service Application - PerformancePoint Service Application Settings at 3600 seconds.
    Here Event Viewer log error at the server:
    1. An exception occurred while running a report.  The following details may help you to diagnose the problem:
    Error Message: Unable to create report. Query produced too many results.
            <br>
            <br>
            Contact the administrator for more details.
    Dashboard Name:
    Dashboard Item name:
    Report Location: {3592a959-7c50-0d1d-9185-361d2bd5428b}
    Request Duration: 6,220.93 ms
    User: INTRANET\spsdshadmin
    Parameters:
    Exception Message: Unable to create report. Query produced too many results.
    Inner Exception Message:
    Stack Trace:    at Microsoft.PerformancePoint.Scorecards.Server.PmServer.ExecuteAnalyticReportWithParameters(RepositoryLocation analyticReportViewLocation, BIDataContainer biDataContainer)
       at Microsoft.PerformancePoint.Analytics.ServerRendering.OLAPBase.OlapViewBaseControl.ExtractReportViewData()
       at Microsoft.PerformancePoint.Analytics.ServerRendering.OLAPBase.OlapViewBaseControl.CreateRenderedView(StringBuilder sd)
       at Microsoft.PerformancePoint.Scorecards.ServerRendering.NavigableControl.RenderControl(HtmlTextWriter writer)
    PerformancePoint Services error code 20604.
    2. Unable to create report. Query produced too many results.
    Microsoft.PerformancePoint.Scorecards.BpmException: Unable to create report. Query produced too many results.
       at Microsoft.PerformancePoint.Scorecards.Server.Analytics.AnalyticQueryManager.ExecuteReport(AnalyticReportState reportState, DataSource dataSource)
       at Microsoft.PerformancePoint.Scorecards.Server.PmServer.ExecuteAnalyticReportBase(RepositoryLocation analyticReportViewLocation, BIDataContainer biDataContainer, String formattingDimensionName)
       at Microsoft.PerformancePoint.Scorecards.Server.PmServer.ExecuteAnalyticReportWithParameters(RepositoryLocation analyticReportViewLocation, BIDataContainer biDataContainer)
    PerformancePoint Services error code 20605.
    Thanks in advance for your help.

    Hello,
    I would like you to try the following to adjust your readerquotas.
    Change the values of the parameters listed below to a larger value. We recommend that you double the value and then run the query to check whether the issue is resolved. To do this, follow these steps:
    On the SharePoint 2010 server, open the Web.config file. The file is located in the following folder:
    \Program Files\Microsoft Office Servers\14.0\Web Services\PpsMonitoringServer\
    Locate and change the the below values from 8192 to 16384.
    Open the Client.config file. The file is located in the following folder:
    \Program Files\Microsoft Office Servers\14.0\WebClients\PpsMonitoringServer\
    Locate and change the below values from 8192 to 16384.
    After you have made the changes, restart Internet Information Services (IIS) on the SharePoint 2010 server.
    <readerQuotas
    maxStringContentLength="2147483647"
    maxNameTableCharCount="2147483647"
    maxBytesPerRead="2147483647"
    maxArrayLength="2147483647"
                  maxDepth="2147483647"
    />
    Thanks
    Heidi Tr - MSFT
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Query with Cost Center Hierarchy giving incorrect results

    Hi All,
    I have a universe built based on BEx query on Cost Center cubes. When enabling hierarchy in BEx Query and building Web intelligence Report based on the universe, I get incorrect results.  The levels of the hierarchy is incorrect, many of the cost centers are missing etc. I checked the universe and confirmed that all levels of hierarchy are generated correctly. The Lov generated for these levels are correct and I see the complete hierarchy when using the BEx Variable in Universe for filtering.
    I tried the same query with Hierarchy disabled with a different universe and it is providing correct results. Not sure what I'm missing here. Any inputs regarding this is appreciated.
    Thanks & Regards,
    Sree

    Ingo, Thanks for your suggestion. Of course, I did update the Universe after any changes in the query. Tried different query setting related to hierarchy  to make it work, but didn't many any difference and I get consistently incorrect results.
    One thing what I wanted to confirm is, if there is any known bug in SP 2 Fix Pack 2.7 related to hierarchies. If not, it might be me doing some thing wrong  and I will look into in more detail.
    Thanks & Regards,
    Sree

  • Incorrect result between maintain master data and bex query, how can i fix?

    Hi ALL,
    i get some messages from the users there is incorrect result between SAP R/3 and Report on BW. i controlled the monitor and i saw there was a job for 0CUSTOMER_ATTRIBUTE that it finish correctly but the processing it was only in PSA, i started the full update immediately from PSA into Data Targets and is finished correctly. after when i control the content of the 0CUSTOMER (right click maintain master data) i get the correct attribute result that match the data in SAP R/3, but the problem is when i execute a query Bex on this master data it will not return the same attributes data.
    Can SomeBody Help please
    Bilal

    hi,
    For any master data attributes loaded you will have to run "Attributes Change Run" for that.Execute for Master data 0CUSTOMER.
    The same is avilable in rsa1->Tools(top menu)->apply hierarchy/attribute run.
    hope it helps,
    regards,
    Parth.

  • Query that only returns items that will produce a result

    Thanks to Mack for his help yesterday.  I would really appreciate some help from anyone who is more SQL competent than I am.  I have an SQL problem that is just completely over my head.  I've created a nifty tagging system for the blog, that sorts by tags and by multiple tags, check out the beta here: http://committedsardine.com/blog.cfm
    When a user selects a tag, it adds it to the value list SESSION.blogTags.  If the selected tag is there already, it removes it.  When the list for tags pops up, I output all the tags, and show their state.  You'll see what I mean if you try it.
    What this leads to is the ability to select a group of tags for which there are no query results.  What I want to do is only show those that will generate results and how many results they'll show.  Like this, select "fluency" by itself there are 310 entries
    fluency (310) | digital (234) | writing (12)
    Once fluency is selected, there are 13 articles that ALSO are tagged by "digital", but none that are tagged by writing:
    fluency | digital (12) | writing
    I have a table called blogTagLinks, that is just for tying a tag to a blog.  It lists a blogID and a tagID.  Here is a sample of it for reference:
    blogTagLinkID
    blogID
    tagID
    4
    2
    2
    5
    2
    3
    6
    2
    5
    39
    1
    18
    49
    1
    1
    42
    1
    9
    44
    1
    19
    47
    5
    14
    48
    1
    22
    54
    16
    22
    I'm including all my sql, but the spot that I need help with is marked in red below:
    <!---if URL.tg is defined, check to see if it exists in the database, then the SESSION, and either add or delete it from SESSION--->
    <cfquery name="rsAllTags" datasource="">
    SELECT tagsID, tagName
            FROM tags
            WHERE tagActive = 'y'
    </cfquery>
    <cfset allTags = ValueList(rsAllTags.tagsID)>
    <cfif isDefined("URL.blogTags")>
        <cfif ListFind(allTags, URL.blogTags) NEQ 0>
            <cfif ListFind(SESSION.blogTags, URL.blogTags) NEQ 0>
                <cfset SESSION.blogTags = ListDeleteAt(SESSION.blogTags, ListFind(SESSION.blogTags, URL.blogTags))>
                <cfelse>
                <cfset SESSION.blogTags = ListAppend(SESSION.blogTags, URL.blogTags)>
            </cfif>
        </cfif>
    </cfif>
    <!---get a list of all available tags, tags that if added to the already selected tags, will return a result--->
    <cfquery name="rsAvailableTags" datasource="">
    SELECT tagsID, tagName
            FROM tags
            WHERE tagActive = 'y'
            NEED SOME STATEMENT HERE OF BLOGTAGLINKS TO DETERMINE WHAT TAGS WILL PRODUCE A RESULT
    </cfquery>
    <!---if searching by tags, get a list of the currently selected tags for display, the 0 returns an empty result if there are no tags--->
    <cfif isDefined("SESSION.sb") AND SESSION.sb EQ "tg">
        <cfquery name="rsTags" datasource="">
            SELECT tags.tagName, tagsID
            FROM tags
            WHERE tagsID <cfif SESSION.blogTags NEQ "">IN(#SESSION.blogTags#)
            <cfelse> = 0</cfif>
        </cfquery>
        <cfset variables.newrow = false>
    </cfif>
    <!---get the information for the blogs list, filtered by keyword or tag if requested--->
    <cfquery name="rsBlog" datasource="">
        SELECT blog.blogID,
            blog.storyID,
            blog.blogDate,
            blogStories.storyID,
            blogStories.blogTitle,
            SUBSTRING(blogStories.blogBody,1,200) AS blogBody,
            images.imageName
        FROM blog, blogStories, images
        WHERE blog.storyID = blogStories.storyID AND images.imageID = blog.photoID AND blog.blogDate < "#todayDate#" AND blog.deleted = 'n'
    <cfif SESSION.sb EQ "kw">AND  CONCAT(blogStories.blogBody, blogStories.blogTitle) LIKE '%#SESSION.blogKeywords#%'</cfif>
        <cfif SESSION.sb EQ "tg" AND SESSION.blogTags NEQ "">
                AND  blog.blogID IN (
                SELECT blogID
                FROM blogTagLink
                <cfif SESSION.blogTags NEQ "">
                    WHERE tagID IN(<cfqueryparam cfsqltype="cf_sql_integer" value="#SESSION.blogTags#" list="true">)
                    GROUP BY blogID
                    HAVING count(tagID) = #ListLen( SESSION.blogTags )#)
                </cfif>
         </cfif>
    ORDER BY blog.blogDate DESC
    </cfquery>

    There might be a single query solution but here's a query that you
    will need to run for each tag in the database (cfloop over all the
    tags) and will give you the number of blogs that have the selected
    tags + the current tag
    SELECT Count(*) AS blog_count
    FROM (
        SELECT blogID
        FROM blogTagLink
        WHERE tagID IN(<cfqueryparam cfsqltype="cf_sql_integer"
    value="#SESSION.blogTags#" list="true">)
             OR tagID = #currentTagID#
        GROUP BY blogID
        HAVING count(tagID) = #ListLen( SESSION.blogTags )#
             OR count(tagID) = #ListLen( SESSION.blogTags )# + 1
        ) AS blogs
    Mack

  • Oracle Discoverer report pulls incorrect result when scheduled.

    Recently the database was migrated to 10.1.2 RAC from 9.2.0.6, so the discoverer EUL is now resides on new database.
    after migration the report which pulls correct results when run interactively is pulling incorrect result when scheduled in Discoverer.
    This report used sysdate and aggregate functions, i had ran the same report simultaneously( Directly in Discoverer Desktop/Plus and scheduled in discoverer), but the data retrieved in both case is not matching.
    here is the query. any help is appreciated.
    SELECT /*+ FIRST_ROWS */ A.SITE_ID as E175108,B."SYSTEM DESCRIPTION" as System_Prefix,
    B."SYSTEM PREFIX" as System_Description,
    COUNT(CASE WHEN ( TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE) ) < 0 THEN 1 ELSE TO_NUMBER(NULL) END) as Less_than_0_Days,
    COUNT(CASE WHEN ( TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE) ) > 121 THEN 1 ELSE TO_NUMBER(NULL) END) as 0_to_14 Days,
    COUNT(DECODE(TRUNC(( TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE) )/31),3,( TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE) ),to_number(NULL))) as 14_to_30_Days,
    COUNT(DECODE(TRUNC(( TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE) )/31),2,( TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE) ),to_number(NULL))) as 31_to_60_Days,
    COUNT(DECODE(TRUNC(( TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE) )/31),1,( TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE) ),to_number(NULL))) as 61_to_90_Days,
    COUNT(CASE WHEN ( TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE) ) BETWEEN 15 AND 30 THEN 1 ELSE TO_NUMBER(NULL) END) as 91_to_120_Days,
    COUNT(CASE WHEN ( TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE) ) BETWEEN 0 AND 14 THEN 1 ELSE TO_NUMBER(NULL) END) as 120_Days_Plus,
    COUNT(TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE)) as Total
    FROM PSTAGE.ALL_EQUIPMENT A,
    ( SELECT A.SITE "SYSTEM PREFIX", A.DESCRIPTION "SYSTEM DESCRIPTION", A.SITE_ID, B.SITE_DESCRIPTION, A.G2B_ID
    FROM SITE_LIST A, ALL_CF_SITE_CONTROL B
    WHERE A.SITE_ID = B.SITE_ID
    ORDER BY 1, 3
    ) B
    WHERE ( (B.SITE_ID = A.SITE_ID))
    AND (A.EQUIPMENT_STATUS_CODE IN ('T','7'))
    GROUP BY A.SITE_ID,B."SYSTEM DESCRIPTION",B."SYSTEM PREFIX"
    ORDER BY B."SYSTEM DESCRIPTION" ASC ;
    Thanks!

    Hi sunil,
    Rod is referencing the NLS parameters i.e.
    Can you please let me know which NLS parameters you are referring toNLS parameters in this scenerio may be the date and language for that session.Do check out
    SELECT * from NLS_SESSION_PARAMETERS
    how i can check if there any differences in the NLS parameters when report is scheduled or run interactivelyI think you should run the trace file.Iam not sure about it.
    It would be system_context.
    Hope it helps you.
    Kranthi.

Maybe you are looking for