Two similar queries and different result.

Hi! I have a problem and
with
sc as (select * from nc_objects where object_type_id = 9122942307013185081 and project_id=9062345122013900768),
cid as (select sccid.value AS CIRCUIT_ID,sc.description AS DESCRIPTION
from sc, nc_params sccid
where sccid.object_id = sc.object_id and sccid.attr_id = 9122948792013185590),
caloc as ( select
(*select value from nc_params sccid where sccid.object_id = sc.object_id and sccid.attr_id = 9122948792013185590*) as CIRCUIT_ID,
(select sl.name from nc_objects sl join nc_references scr on sl.object_id = scr.reference
where scr.attr_id = 3090562190013347600 and scr.object_id = sc.object_id ) as ALOCATION
from sc),
cbloc as ( select
(select value from nc_params sccid where sccid.object_id = sc.object_id and sccid.attr_id = 9122948792013185590) as CIRCUIT_ID,
(select sl.name from nc_objects sl join nc_references scr on sl.object_id = scr.reference
where scr.attr_id = 3090562190013347601 and scr.object_id = sc.object_id ) as BLOCATION
from sc)
select cid.CIRCUIT_ID,cid.DESCRIPTION,ALOCATION,BLOCATION from (
cid
join caloc on cid.CIRCUIT_ID = caloc.CIRCUIT_ID and ALOCATION is not null
join cbloc on cid.CIRCUIT_ID = cbloc.CIRCUIT_ID and BLOCATION is not null
it` returns and`s all ok!
ID desc aloc bloc
101     TEST1     AHAS     AGUS
102     TEST2     AKRE     AMJY
103     TEST3     AMJS     ASSE
109     TEST9     BAIA     AKIB
5     (null)     WELA AGUS
We have "sc as (select * from nc_objects where object_type_id = 9122942307013185081 and project_id=9062345122013900768)"
and identical subquery on caloc and cbloc
"select value from nc_params sccid where sccid.object_id = sc.object_id and sccid.attr_id = 9122948792013185590"
If i change query on
with
sc as (select * from nc_objects where object_type_id = 9122942307013185081 and project_id=9062345122013900768),
cid as (select sccid.value AS CIRCUIT_ID,sc.description AS DESCRIPTION
from sc, nc_params sccid
where sccid.object_id = sc.object_id and sccid.attr_id = 9122948792013185590),
caloc as ( select
*(select CIRCUIT_ID from cid) as CIRCUIT_ID,*
(select sl.name from nc_objects sl join nc_references scr on sl.object_id = scr.reference
where scr.attr_id = 3090562190013347600 and scr.object_id = sc.object_id ) as ALOCATION
from sc),
cbloc as ( select
(select value from nc_params sccid where sccid.object_id = sc.object_id and sccid.attr_id = 9122948792013185590) as CIRCUIT_ID,
(select sl.name from nc_objects sl join nc_references scr on sl.object_id = scr.reference
where scr.attr_id = 3090562190013347601 and scr.object_id = sc.object_id ) as BLOCATION
from sc)
select cid.CIRCUIT_ID,cid.DESCRIPTION,ALOCATION,BLOCATION from (
cid
join caloc on cid.CIRCUIT_ID = caloc.CIRCUIT_ID and ALOCATION is not null
join cbloc on cid.CIRCUIT_ID = cbloc.CIRCUIT_ID and BLOCATION is not null
query result will be:
ORA-01427: single-row subquery returns more than one row
01427. 00000 - "single-row subquery returns more than one row"
*Cause:   
*Action:
Can you explain why so ?
Edited by: user12031606 on 07.05.2010 2:31
Edited by: user12031606 on 07.05.2010 2:32

Hi,
Welcome to the forum!
Whenever you post code, format it to show the extent of sub-queries, and the clauses in each one.
Type these 6 characters:
\(all small letters, inside curly brackets) before and after each section of formatted test; if you don't, this site will compress the spaces.
It also helps it you reduce your query as much as possible.  For example, I think you're only asking about the sub-query called caloc, so just post caloc as if that were the entire query:select     ( select CIRCUIT_ID
     from cid
     )                as CIRCUIT_ID,
     ( select sl.name
     from nc_objects          sl
     join nc_references      scr on sl.object_id = scr.reference
     where scr.attr_id      = 3090562190013347600
     and scr.object_id      = sc.object_id
     )                as ALOCATION
from sc
This makes it much cleared that the query will produce 2 columns, called circuit_id and alocation.
Compare the query above with the query below:SELECT     object_id,
     'Okay'
FROM     sc
The basic structure is the same: both queries produce two columns, and both queries produce one row of output for every row that is in the sc table.
The only difference is the two items in the SELECT clause.
The second query has a column from the table as its first column, and a literal for its second column; those are just two of the kinds of things you can have in a SELECT clause.  another thing you can have there is a +Scalar Sub-Query+ , a complete query enclosed in parentheses that produces exactly one column and at most one row.   If a scalar sub-query produces more than one row, then you get the run-time error: "ORA-01427: single-row subquery returns more than one row", as you did.
A scalar sub-query always takes the place of a single value: "scalar" means "having only one value".  In the first example above, the main query is supposed to produce one row of output for every row in sc.  How can it do that if some of the columns themselves contain multiple rows?
I don't know what your tables are like, or what output yu want to get from thiose tables.
If you'd like help getting certain results from your tables, then post CREATE TABLE and INSERT statements for a little sample data, and the resutls you want to get from that sample data.  A scalar sub-query may help getting those results, or it may not.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Compare two .txt files and show result

    HI
    Could anybody show me how to compare two text files and show the result.
    i.e.
    textfile1.txt
    harry.denmark
    karry.sweden
    textfile2.txt
    harry.denmark
    karry.sweden
    marry.usa
    Compare
    result=
    marry.usa
    The text files I want to compare are how ever much larger than this example. (up to 2-3.000 words)
    anybody ??
    Sincerly
    Peder

    HI & thanks for reply
    I know almost nothing about java so could you or anybody please show me the code to do this? Or is it perhaps too large or difficult a code?
    I know how to compile a .java file and run it in prompt :-) and thats about it (almost)
    I offcourse understand if its too much to ask for :-)

  • Applet sends SQL and servlet queries and returns results to applet

    So, this is what my problem is. I've tried several different ways on this so my code probably don't work at all.
    Could someone post me an example on how to send the sql query from the Applet and how to pick up the data from the servlet.
    Thank you,
    Derek Lung

    I suggest you to use:
    * one JavaBean that handles db connections and queries;
    * a Servlet that uses the JavaBean and receives a String that rappresents the query from the Applet: such String will be passed to JavaBean in order to execute the query and retrieve the data from db;
    * the Applet that uses the Servlet to retrieve the results (you can store them in a structure that MUST be serializable.
    Let me know if you find problems in costructing such architecture!
    -- Ivan

  • How to create report with two independent queries and templates?

    Hi,
    I have a requirement where I have to use two queries in Data Template. Now, these queries are unrelated and I need to display data from these two queries in my report. Can anyone let me know how to do this?

    Hi Thanks alot...It works.
    Is it possible to create two independent SQL queries too and display the o/p from both queris in report?
    Thanks alot in advance.

  • How to divide two int numbers and get a fraction ?

    I am dividing two int numbers and the result should be a fraction but I am always getting a zero
    set @result= @num1/@num2  
    when num1=50 and num2=100

    I am dividing two int numbers and the result should be a fraction but I am always getting a zero
    set @result= @num1/@num2  
    You can either one of the values as a decimal or float type, or just multiply one of the values by 1.0.
    set @result= @num1/@num2*1.0
    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

  • How to send two seperate queries from OBI and combine the results

    Hello all,
    I am trying to understand how to combine results of two queries in OBI. Here is the scenario.
    There are three tables, User, Security Roles joined though a Bridge Table Role_User
    Each user has multiple roles, The roles to which a user has access is identified by a flag column with value T or else it will have value F.
    I am trying to create an analysis as below
    User Id
    Roles with Access
    Roles without Access
    So column 2 will show all the roles with flag T for particular user and column 2 will show all the roles with flag F for same user.
    I tried creating two Fact tables and using Filter condition on the flag value, but in analysis I could only use one at a time. When I add both the columns , I get error as None of the fact table are compatible with the query request. I do have hierarchies created for the dimensions and assigned them in the content level for all dims and facts.
    Any hint will be highly appreciated.
    Thanks  

    Got the solution. I am posting it here in case anyone face similar issue.
    I added this SQL code in the advanced tab:
    Select A.saw_0 saw_0, A.saw_1 saw_1, B.saw_1 saw_2
    FROM( Select Col1 saw_0,Col2 saw_1 FROM Table1) A LEFT OUTER JOIN
    (Select Col1 saw_0,Col2 saw_1 FROM Table2) B
    on A.saw_0=B.saw_0
    I created to Logical Facts using same source with two different filter conditions and used them with sub-query as above
    Ref: OBIEE Interviews: Reports

  • Two queries against aud$ with different results

    hi guys
    I'm not so good with queries and that is the reason for my question:
    We have audit activated and we want to get the following information (monthly):
    - how many times the user logon to database.
    - every logon of each user in a month.
    For the first (1) requirement we have the following query:
    select USERID "Cuenta", USERHOST, TERMINAL, nombres||' '||PRIMER_APELLIDO||' '||SEGUNDO_APELLIDO "WhiteList"
    , count(*) "TOTAL"
    from aud$, ab.usuarios
    where (ACTION# = 100) and
    (NTIMESTAMP# between (to_date(to_char('01092013 00:00:00'),'ddmmyyyy HH24:MI:SS'))
        and (to_date(to_char('30092013 23:59:00'),'ddmmyyyy HH24:MI:SS'))) and
    USERID = CODIGO_USUARIO(+) and
    USERID not in ('DBSNMP','SYSMAN')
    group by USERID, USERHOST, TERMINAL,  nombres||' '||PRIMER_APELLIDO||' '||SEGUNDO_APELLIDO
    order by USERID, USERHOST, TERMINAL;
    the result of this query shows like this:
    Header 1
    Cuenta               USERHOST                  TERMINAL        WhiteList                                     TOTAL                                                                                     
    ASEGUR               MAQUINADIAB\SSSSS        IUOOO          PEPITO GARCIA Y GARCIA SOCIED                    10                                                                                     
    ASEGUR               POSADASDE\MNNN4550094  MNNN4550094    PEPITO GARCIA Y GARCIA SOCIED                     1                                                                                     
    ASEGUR               POSADASDE\YUMI          YUMI            PEPITO GARCIA Y GARCIA SOCIED                    10                                                                                     
    ASEGUR               YUH                                       PEPITO GARCIA Y GARCIA SOCIED                    20                                                                                     
    ASEGUR               SDFRG                                    PEPITO GARCIA Y GARCIA SOCIED                    13                                                                                     
    ASEGUR               signy                                     PEPITO GARCIA Y GARCIA SOCIED                    29                                                                                     
    ASEGUR               sigurd                                    PEPITO GARCIA Y GARCIA SOCIED                    32                                                                                     
    ASEGUR               valhalla-Legacy                           PEPITO GARCIA Y GARCIA SOCIED                    12                                                                                     
    ADMIN                MAQUINADIAB\SSSSS        IUOOO          USUARIO ADMINISTRADOR NETWORKING                3                                                                                     
    SPRINGUSR            bragi                                                                                      98                                                                                     
    SPRINGUSR            hermod                                                                                     59                                                                                     
    SPRINGUSR            YUH                                                                                        49
    So, is the total logons in a month by user.
    for the second requirement we are using the follow query:
    select USERID "Cuenta", USERHOST, TERMINAL, to_char(NTIMESTAMP#,'YYYYMMDD HH24:MI:SS') "Fec Ing", nombres||' '||PRIMER_APELLIDO||' '||SEGUNDO_APELLIDO "WhiteList"
    --, count(*) "TOTAL"
    from aud$, ab.usuarios
    where (ACTION# = 100) and
    --to_char(NTIMESTAMP#,'dd-mm-yy')=to_char(sysdate-50,'dd-mm-yy') and
    (NTIMESTAMP# between (to_date(to_char('01062013 18:00:00'),'ddmmyyyy HH24:MI:SS'))
        and (to_date(to_char('30062013 23:59:00'),'ddmmyyyy HH24:MI:SS'))) and
    USERID = CODIGO_USUARIO(+) and
    USERID not in ('DBSNMP','SYSMAN')
    group by USERID, USERHOST, TERMINAL,to_char(NTIMESTAMP#,'YYYYMMDD HH24:MI:SS'), nombres||' '||PRIMER_APELLIDO||' '||SEGUNDO_APELLIDO
    order by USERID, USERHOST, TERMINAL;
    Header 1
    Cuenta               USERHOST                  TERMINAL        Fec Ing              WhiteList                                                                                                                                                            
    USER12               DOMINIODDD\IOIPOP        IOIPOP          20130930 12:08:33    ANGEL ROBERTO GARCIA Y GARCIA S                                                                                                                                        
    USER12               DOMINIODDD\IOIPOP        IOIPOP          20130930 14:28:47    ANGEL ROBERTO GARCIA Y GARCIA S                                                                                                                                        
    USER12               DOMINIODDD\IOIPOP        IOIPOP          20130930 16:24:43    ANGEL ROBERTO GARCIA Y GARCIA S 
    so, shows each logon done by user in a month.
    But in the both queries, the results are different. It is not suppose that they have to be the same number of logons?
    I mean, If I sum the numbers in TOTAL column I have less that I get in the second query. Always !!!
    could you help us?
    thank you

    Your timeframes are different:
    (NTIMESTAMP# between (to_date(to_char('01092013 00:00:00'),'ddmmyyyy HH24:MI:SS')) 
    and (to_date(to_char('30092013 23:59:00'),'ddmmyyyy HH24:MI:SS'))) and 
    versus
    (NTIMESTAMP# between (to_date(to_char('01062013 18:00:00'),'ddmmyyyy HH24:MI:SS')) 
        and (to_date(to_char('30062013 23:59:00'),'ddmmyyyy HH24:MI:SS'))) and 

  • Two very different results using the same settings (H.264 / Quicktime Pro)

    I’m a bit confused, I have used Quicktime Pro (v7.1) to encode DV into H.264 for iPod and this particular video is 18 minutes long and came out looking very good with the following settings;
    VIDEO: H.264 at 200kbps, Baseline Profile, 25fps, Auto Key Frames, 320x240 or 640x480, Multipass Best quality encoding.
    AUDIO: AAC Audio at 96kbps, 24kHz sampling freq, Stereo.
    However here is the twist…
    When I use the same exact settings to encode just the 30 second opener (from the 18 minute video) the encoded opener looks bad and blocky!
    Why? Same settings would make you assume that you should get a same or similar result, or am I wrong?
    The reason I have tried encoding this 30 second opener is that I am trying to work out which settings work best on the iPod (another issue) and I don’t want to spend hours test encoding the full 18 minute video, as you know H.264 is SLOW to encode!
    So can anyone help in regard to two very different results using the same settings?
    Regards,
    J
    PC   Windows XP  

    Alvin,
    Is it a commercially-released or home-burned CD?
    If it's commercially-released, try "encouraging" the recalcitrant computer by using the iTunes Advanced menu > Get CD Track Names command when it shows Audio CD.
    If it's home-burned, you will find that only the computer that actually burned the disc will know what's on it. The information won't be transferred to another computer.
    Let us know which, if either, of these situations applies to you.

  • Different result in IE and Netscape

    Hi,
    I am using JDeveloper 3.2 to create my JSP and BC4J. I deployed them into my web server, but I got different result in IE and Netscape. I amd using web bean method to create my JSP.
    When I view my JSP from IE, everything looks as expected. But when I view them from Netscape, some pages did not display correctly.
    1. For the JSTab, the Netscape displays different color(blue) in the help text area, but the IE display gray color.
    2. If I have a table with many columns (e.g.25) to be displayed and my browser is too small to display them all, the Netscape displays JSRowSetBrowser incorrectly. The top right corner, and bottom right corner did not display at the last column side, instead it displaying in the middle of my JSRowSetBrowser. It also suppressed my one button in the same page. IE displays them all properly.
    How do I fix this problem? Please help.
    I am using webapp/cabo/images/cabo_styles.css as my style sheet.
    Lisa
    null

    I'm not an expert on Netscape, but I would guess that you're problems are simply caused by the differences between IE and NS.
    It is very difficult to write (functional) JS code that works perfectly between the two of them and I bet that JSTab isn't written in such a way.
    You may want to try using your own tab object, we do this by creating a page for each tab and making the actual tabs be links to each page. This avoids the use of JavaScript.
    Good Luck!!!

  • Execute the same query twice, get two different results

    I have a query that returns two different results:
    Oracle Version : 10.2.0.1.0
    I am running the following query on the Oracle server in SQL*Plus Worksheet.
    SELECT COUNT(*)
    FROM AEJOURNAL_S1
    WHERE CHAR_TIME BETWEEN TO_DATE('12-AUG-10 01:17:39 PM','DD-MON-YY HH:MI:SS AM') AND
    TO_DATE('13-AUG-10 14:17:34','DD-MON-YY HH24:MI:SS')
    AND DESC2 LIKE '%'
    AND DESC1 LIKE '%'
    AND DESC2 LIKE '%'
    AND ETYPE LIKE '%'
    AND MODULE LIKE '%'
    AND LEVELL = '11-WARNING'
    ORDER BY ORDD DESC;
    The very first time the query is run, it will return a count of 259. The next time the query is run, lets say, 10 seconds later, it will return a count of 260. The above query is exemplary of the kind of thing I'm trying to do. It seems like the more fields filtered against '%', the more random the count return becomes. Sometime you have to execute the query three or four times before it levels out to a consistent number.
    I'm using '%' as the default for various fields, because this was the easiest thing to do to support a data-driven Web interface. Maybe I have to 'dynamically' build the entire where clause, instead of just parameterizing the elements and having default '%'. Anyway, to eliminate the web interface for the purpose of troubleshooting the above query was run directly on the Oracle server.
    This query runs against a view. The view does a transpose of data from a table.
    Below is the view AEJOURNAL_S1
    SELECT
    CHAR_TIME,
    CHAR_INST,
    BATCH_ID,
    MIN(DECODE(CHAR_ID,6543,CHAR_VALUE)) AS ORDD,
    MIN(DECODE(CHAR_ID,6528,CHAR_VALUE)) AS AREAA,
    MIN(DECODE(CHAR_ID,6529,CHAR_VALUE)) AS ATT,
    COALESCE(MIN(DECODE(CHAR_ID,6534,CHAR_VALUE)),'N/A') AS CATAGORY,
    MIN(DECODE(CHAR_ID,6535,CHAR_VALUE)) AS DESC1,
    MIN(DECODE(CHAR_ID,6536,CHAR_VALUE)) AS DESC2,
    MIN(DECODE(CHAR_ID,6537,CHAR_VALUE)) AS ETYPE,
    MIN(DECODE(CHAR_ID,6538,CHAR_VALUE)) AS LEVELL,
    MIN(DECODE(CHAR_ID,6539,CHAR_VALUE)) AS MODULE,
    MIN(DECODE(CHAR_ID,6540,CHAR_VALUE)) AS MODULE_DESCRIPTION,
    MIN(DECODE(CHAR_ID,6541,CHAR_VALUE)) AS NODE,
    MIN(DECODE(CHAR_ID,6542,CHAR_VALUE)) AS STATE,
    MIN(DECODE(CHAR_ID,6533,CHAR_VALUE)) AS UNIT
    FROM CHAR_BATCH_DATA
    WHERE subbatch_id = 1774
    GROUP BY CHAR_TIME, CHAR_INST, BATCH_ID
    So... why does the query omit rows on the first execution? Is this some sort of optimizer issue. Do I need to rebuild indexes? I looked at the indexes, they are all valid.
    Thanks for looking,
    Dan

    user2188367 wrote:
    I have a query that returns two different results:
    Oracle Version : 10.2.0.1.0
    I am running the following query on the Oracle server in SQL*Plus Worksheet.
    SELECT COUNT(*)
    FROM AEJOURNAL_S1
    WHERE CHAR_TIME BETWEEN TO_DATE('12-AUG-10 01:17:39 PM','DD-MON-YY HH:MI:SS AM') AND
    TO_DATE('13-AUG-10 14:17:34','DD-MON-YY HH24:MI:SS')
    AND DESC2 LIKE '%'
    AND DESC1 LIKE '%'
    AND DESC2 LIKE '%'
    AND ETYPE LIKE '%'
    AND MODULE LIKE '%'
    AND LEVELL = '11-WARNING'
    ORDER BY ORDD DESC;
    The very first time the query is run, it will return a count of 259. The next time the query is run, lets say, 10 seconds later, it will return a count of 260. The above query is exemplary of the kind of thing I'm trying to do. It seems like the more fields filtered against '%', the more random the count return becomes. Sometime you have to execute the query three or four times before it levels out to a consistent number.
    I'm using '%' as the default for various fields, because this was the easiest thing to do to support a data-driven Web interface. Maybe I have to 'dynamically' build the entire where clause, instead of just parameterizing the elements and having default '%'. Anyway, to eliminate the web interface for the purpose of troubleshooting the above query was run directly on the Oracle server.
    This query runs against a view. The view does a transpose of data from a table.
    Below is the view AEJOURNAL_S1
    SELECT
    CHAR_TIME,
    CHAR_INST,
    BATCH_ID,
    MIN(DECODE(CHAR_ID,6543,CHAR_VALUE)) AS ORDD,
    MIN(DECODE(CHAR_ID,6528,CHAR_VALUE)) AS AREAA,
    MIN(DECODE(CHAR_ID,6529,CHAR_VALUE)) AS ATT,
    COALESCE(MIN(DECODE(CHAR_ID,6534,CHAR_VALUE)),'N/A') AS CATAGORY,
    MIN(DECODE(CHAR_ID,6535,CHAR_VALUE)) AS DESC1,
    MIN(DECODE(CHAR_ID,6536,CHAR_VALUE)) AS DESC2,
    MIN(DECODE(CHAR_ID,6537,CHAR_VALUE)) AS ETYPE,
    MIN(DECODE(CHAR_ID,6538,CHAR_VALUE)) AS LEVELL,
    MIN(DECODE(CHAR_ID,6539,CHAR_VALUE)) AS MODULE,
    MIN(DECODE(CHAR_ID,6540,CHAR_VALUE)) AS MODULE_DESCRIPTION,
    MIN(DECODE(CHAR_ID,6541,CHAR_VALUE)) AS NODE,
    MIN(DECODE(CHAR_ID,6542,CHAR_VALUE)) AS STATE,
    MIN(DECODE(CHAR_ID,6533,CHAR_VALUE)) AS UNIT
    FROM CHAR_BATCH_DATA
    WHERE subbatch_id = 1774
    GROUP BY CHAR_TIME, CHAR_INST, BATCH_ID
    So... why does the query omit rows on the first execution? Is this some sort of optimizer issue. Do I need to rebuild indexes? I looked at the indexes, they are all valid.
    Thanks for looking,
    DanIn fact you the first time you ran the query the data has been retrived from disk to memory , in the second time the data is already in memory so the respnse time should be faster ,but if you chagne any condition or column or letter case the optimizer will do the first step (data will be retrived from disk to memory )

  • Select statement returns different results from 9i and 10g

    Hi all,
    Would appreciate if someone could help to solve this puzzle here:
    I have the exact the statements running on Oracle 9i and 10g, why do they return different results?
    Select unique(GroupDesc) , GroupSeq from Module where ModuleId in (Select ModuleId from User_Access where UserId='admin') and Status='A'
    In Oracle 9i:
    Both columns returned as follows...
    GroupDesc | GroupSeq
    In Oracle 10g:
    Only one column returned, the column with unique keyword was missing...
    GroupSeq
    Could anyone enlighten me?

    yes, the table structure... actually the CREATE TABLE statement...
    with some sample data (INSERT INTO)
    and the actual queries (both of them - copy-paste them from each separate environment)
    you can use tags around the statements this will format it to a fixed font - making it easier to read
    Edited by: Alex Nuijten on Feb 20, 2009 10:05 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • I want to combine a bunch of queries and dump the results - spreadsheet

    I have a bunch of SQL queries. I want to run the SQL queries and dump the results into one single spreadsheet in a formatted fashon.
    Assume that one of my queries returns the following:
    Week 10, Door, 15
    Week 10, Window, 20
    Week 10, Stair, 25
    Week 11, Door, 50
    Week 11, Window, 75
    Week 11, Stair, 100
    Week 12, Door, 1
    Week 12, Window, 2
    Week 12, Stair, 3
    I would then want to take all these results and put them into a spreadsheet with a bunch of other results:
    So header would look like:
    Week 1, Week 2, Week 3, ...Week 10, Week 11, Week 12...
    Then, down below there would be three rows which have the following in Col A:
    Door
    Window
    Stair
    So in row "Door", under Col "Week 10", there would be a 15
    Under "Window", under Col "Week 11", there would be a 75
    Under "Stair", under Col "Week 12", there would be a 3
    The column headers would all be in weeks, but I want to basically make a matrix out of my SQL queries. So there would be many rows besides "Door", "Window", and "Stair", but they would all have similar results as supplied by my other queries. Anyone know how to do such mapping?

    Check this link --
    [url http://forums.oracle.com/forums/search.jspa?threadID=&q=pivot&objID=f75&dateRange=last90days&userID=&numResults=15]Pivot Search In Oracle
    Regards.
    Satyaki De.

  • Why do I get two different results from the same coefficients?

    I am getting two different results from the Polynomial Evaluation function.
    For the first one, I am getting the coefficients from a Polynomial Fit function.  I feed the coefficients from the Fit function into the Poly Eval function and get the correct result of 12.8582 when I evaluate 49940.
    For the second one, I create constant array of the SAME values that were returned from the Polynomial Fit function (i typed them in).  However, I am getting an incorrect result of -120.7913 when I feed the constant array into the Poly Eval function when I evauate 49940.
    How can this happen when I am using the same array values?
    Attached is an image of what I am explaining.
    Solved!
    Go to Solution.
    Attachments:
    polynomial_evaluation.jpg ‏213 KB

    Hi Altran,
    are you sure about using the "same" coefficients?
    Did you compare them? Did you (atleast) set the display properties to 17 significant digits?
    Please attach a VI instead of a picture...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Same calculation producing two differing results

    Hi All
    I have some code in a user exit on save of a delivery (VL02N) that calculates the number of bags/pallets required to furnish that delivery.
    I am now adding the same code to a user exit on save a sales order (VA02) to calculate the number of bags/pallets again but when run it is producing differing results.
    the code is as follows:
    DATA: bag_weight(12) TYPE p DECIMALS 4.
    DATA: pallet_weight TYPE marm-umrez.
    DATA: bag_denominator TYPE i.
    bag_weight = pallet_weight / bag_denominator.
    Assuming pallet_weight = 1000 and bag_denominator = 40.
    On save of a delivery it is calculating bag_weight as 25.0000 (correct):
    On save of a sales order it is calculating bag_weight as 0.0025 (incoorect).
    All data declaration, code etc is the same. Does anybody have any clue as to why it would give two differing answers, I would not like to have to add a additional multiplication step to correct the result otherwise.
    Thanks in advance
    David

    Hi,
    Whenever you are using the Packed numbers, you need to check or set the program attribute fixed point arithmetic only as only this ensure that the decimal point is calculated correctly.
    Have a look at the help.sap.com documentation link:
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb2fd9358411d1829f0000e829fbfe/content.htm
    Hope this helps.
    Thanks,
    Samantak.

  • Same C++ code gives different result in MacOSX and Ubuntu

    Hi
    I have a C++ program which starts by reading an external file, but changing the name of the file give me different results.
    I selected just the important part and made a simple file with the reading part of my program and can be downloaded here
    http://dl.dropbox.com/u/664351/files.zip
    It just reads the external file and does the output of some values.
    It has two external file examples. If one uses "x.txt" everything works fine, but if we use "dados.txt", which is a copy of "x.txt", the last value in the output is wrong.
    The stranger is that if i use these same files in ubuntu everything works just fine!
    I tried in a MacBook, a MacBook Pro and an iMac (all of them with macosx 10.6) and i always got the error, but not on ubuntu!
    Does anyone has a clue about what is happening here?
    Cheers,
    Marcelo

    marcelobarbosa wrote:
    Does anyone has a clue about what is happening here?
    Change OutFile from a 20 byte character array to a string. GCC isn't able to tell what type that is and is picking int or something, corrupting your memory.

Maybe you are looking for

  • Equivalent WD method for file_open_dialog

    Hello, What is the equivalent method in WD ABAP for cl_gui_frontend_services=>file_open_dialog (to specify the path of a file in a pop-up)? I have a requirement wherein i want to specify the path in which a file will be saved in the local system. I c

  • HeLp itunes has encounted a problem and needs to close?? please please HeLp

    i downloaded itunes and had it up going and working fine then it asked me to download the new versoin and i kept saying no becuase i was afraid it would mess up my itunes well lets just say i was right now when i try to open itunes i get this message

  • No sound on iPhone 4

    The sound is not working on my iPhone 4, please help?

  • One time vendor downpayment

    Hi experts, When I post a down payment to one-time vendor, the system responded that: Special GL indicator to vendor is not define. How could I fix this error? Please help me! Thanks in advance!

  • Airplay settings on AppleTV 3 grayed out.

    I'm trying to set up my computer for mirroring but the airplay settings are grayed out  and won't allow me in to set it up. Any ideas? Thanks.