Use column alias in another calculation

Database:Oracle Database 11g Enterprise Edition Release 11.2.0.3.0
Is there a way to use a column alias in an another calculation within the
same query? Since I am using some long and complex logic to compute total1
and total2, I don't want to repeat the same logic to compute the ratio of
those two columns. do you have any suggestion other than nested sub-query or view?
select
total1 = sum(case(long complex logic)),
total2 = sum(case(another long complex logic)),
ratio = total1/total2
thanks in advance

Jimmie_M wrote:
Database:Oracle Database 11g Enterprise Edition Release 11.2.0.3.0
Is there a way to use a column alias in an another calculation within the
same query? Since I am using some long and complex logic to compute total1
and total2, I don't want to repeat the same logic to compute the ratio of
those two columns. do you have any suggestion other than nested sub-query or view?
select
total1 = sum(case(long complex logic)),
total2 = sum(case(another long complex logic)),
ratio = total1/total2
thanks in advanceHi,
Use oracle's with clause
WITH test_data
AS
SELECT sum(case(long complex logic)) total1,
sum(case(another long complex logic)) total2
from your_table_name
SELECT total1/total2
from test_data
WHERE....Regards,
Achyut Kotekal

Similar Messages

  • Using column alias for calculations in same select list

    Hi All,
    I want to use a calculated column of query to create further calculated columns in same query using column alias. I have to do so because the calculation is too big to write it everytime.
    e.g.
    Select decode(Month, 1, Tran_January, 2, Tran_February, ....) as MonthTran,
    Month, Year,
    round(MonthTran/Intrest_rate, 2) as Amount <---(using previous alias)
    from ledger;
    Thanks in advance,
    Mona

    Probably the easiest way of doing this is to write an inline view, viz
    SELECT l.Month
           , l.Year
           , round(mt.MonthTran/l.Intrest_rate, 2) AS Amount
    FROM   ledger l
           , (SELECT x.pk_col, decode(Month, 1, Tran_January, 2, Tran_February, ....) AS MonthTran
              FROM ledger x) mt
    WHERE  l.pk_colunm = mt.pk_colunm
    ; If you have any criteria in a WHERE clause on ledger you shouldn't need to repeat them providing LEDGER does have a primary key column. You may need to tweak it a bit for performance, if LEDGER is a big table.
    Cheers, APC
    Cheers, APC

  • ORA-00904 when use column alias in Record Group Query

    Is it possible to use column aliases in Record Group Queries?
    I have a query that runs fine in SQL*Developer, but gives me runtime errors when I use it as a Record Group Query.
    When I use it as a Record Group Query, the Form compiles, but at runtime I receive the following errors:
    FRM-40502: ORACLE error: unable to read list of values
    when I use Help - Display Error, I see:
    ORA-00904:"CHILDNAME":invalid identifier
    The query is something like this
    select decode(complex stuff here) as "childname" ....
    I've tried it with and without the double quotes surrounding the alias name, and have also tried it without using the "as" keyword.
    I would appreciate any suggestions or insights. I'm using Forms 9.0.4.
    Thanks.

    It looks like this is caused by bug 725059:
    "FILTER BEFORE DISPLAY" DOESN'T WORK IF LOV HAS COLUMN ALIASES (TRIAGE1098)
    My LOV does have the Filter Before Display turned on. Here's the text of the bug:
    IF an LOV is created with column aliases in the select statement, (eg: select ename emp_name from emp) and the LOV property "Filter Before Display" is "Yes", THEN when you attempt to filter the LOV at runtime, (eg: type '%' then press the 'Find' button) the internal WHERE clause that forms sends to the database is: WHERE column_alias LIKE '%%' This is incorrect syntax. A client-side sqlnet trace shows this. The correct syntax should be: WHERE column LIKE '%%' . The incorrect syntax results in no rows returned. However no error is displayed by forms to the user.

  • Using column alias with CASE

    It is possible to use a column alias with a CASE in a SELECT? e.g. I have this code
    SELECT
    CASE WHEN categ_1 = 'BASIC' THEN total_1 WHEN categ_2 = 'BASIC' THEN total_2 END
    FROM totalsBut the results column name comes out as CASEWHENCATEG_1='BASIC'THENTOTAL_1WHENCATEG_2='BASIC'THENTOTAL_2END
    I want to use an alias but can't get it to work with the CASE. I guessed at
    SELECT
    CASE WHEN categ_1 = 'BASIC' THEN total_1 WHEN categ_2 = 'BASIC' THEN total_2 END 'alias'
    FROM totalswhich doesn't work.

    Try without the single quotes after END
    Christopher Soza
    Oracle BI DBA
    Orix Consultancy Services Ltd
    b: http://sozaman.blogspot.com

  • OBIEE10G - Using column value in another report

    Let's say i have a very simple report (A) with just one column A1 that has a value X.
    Then i have another report (B) where i want to use that value X from report A, something like this:
    Year------Month----------Value
    2011------March-----------X
    Is this something possible to do?I've tried to use in column Value a filter base on results of another request where i get report A and column A1 (which has value X) but this doesn't work.
    Thanks

    Hey,
    It really is pretty much what i said but i'll try to explain with more detail my problem. I have a combined request where i have to do (besides other things) some calculations envolving knowing how many days and business days are in the month selected in the prompt. I can do this ok for the total of days in a month however i haven't been able to do this for the business days.
    My time dimension has an attribute that tells me if a day is a business day or not, so i can do a request where i count the number of business days for month and year prompted. That's my report A with column A which has value X (number of business days for a month).
    However, when i try to integrate this exactly same thing in my combined request the count of business days isn't working that's why i was asking if i can get into a column of report B the value of a column in report A. I would have this:
    Report B
    Year----------Month-------------Nr Business Days
    2011----------March--------------------21 (value of column A1 in report A).
    I hope i was my clear this time.

  • Column alias

    Hi,
    in oracle express, on a report querry region I give this :
    select 'PINS - # of times an item in the library cache was executed - '||
    sum(pins),
    'RELOADS - # of library cache misses on execution steps - '||
    sum (reloads),
    'RELOADS / PINS * 100 = '||round((sum(reloads) / sum(pins) *
    100),2)||'%'
    from v$librarycache
    But I receive :
    1 error has occurred
    query column #1 ('PINS-#OFTIMESANITEMINTHELIBRARYCACHEWASEXECUTED-'||SUM(PINS)) is invalid, use column alias
    Any idea ? Any help ?
    Many thanks.

    You need to define column aliases.
    SQL> SELECT 'PINS - # of times an item in the library cache was executed - ' || SUM (pins) AS LibRatio,
      2         'RELOADS - # of library cache misses on execution steps - ' || SUM (reloads) AS MissRatio,
      3         'RELOADS / PINS * 100 = ' || ROUND ((SUM (reloads) / SUM (pins) * 100), 2) || '%' AS Ratio
      4    FROM v$librarycache
      5  ;
    LIBRATIO                                                                                               MISSRATIO
    PINS - # of times an item in the library cache was executed - 10455253                                 RELOADS - #

  • Report Query w. Column Alias issue?

    I have this query:
    SELECT
    TXI_IS_PROJECTS.PROJECT_NAME,
    TXI_IS_PROJECTS.PROJECT_DESC,
    TXI_IS_PROJECTS.PROJECT_SIZE,
    TXI_IS_PROJECTS.PROJECT_STATUS,
    (select NLS_INITCAP(name_f || ' ' || name_l) name from TXI_PEOPLE where userid= TXI_IS_PROJECTS.PROJECT_OWNER),
    TXI_IS_PROJECTS.SYSTEM_OWNER,
    TXI_IS_PROJECTS.CREATE_DATE,
    TXI_IS_PROJECTS.SPEC_REVIS,
    TXI_DOCUMENTS.NAME
    FROM TXI_IS_PROJECTS
    INNER JOIN TXI_DOCUMENTS ON TXI_DOCUMENTS.PROJECT_ID = TXI_IS_PROJECTS.PROJECT_ID
    INNER JOIN TXI_DOCUMENT_SIGNOFF ON TXI_DOCUMENT_SIGNOFF.DOC_ID = TXI_DOCUMENTS.ID
    WHERE TXI_DOCUMENT_SIGNOFF.SIGN_OFF_ID = :P9_SIGN_OFF_ID;
    The issue with this line:
    (select NLS_INITCAP(name_f || ' ' || name_l) name from TXI_PEOPLE where userid= TXI_IS_PROJECTS.PROJECT_OWNER),
    It's giving me this error:
    query column #5 ((SELECTNLS_INITCAP(NAME_F||''||NAME_L)NAMEFROMTXI_PEOPLEWHEREUSERID=TXI_IS_PROJECTS.PROJECT_OWNER)) is invalid, use column alias
    I've tried various ways and it's still not working.

    SELECT
      TXI_IS_PROJECTS.PROJECT_NAME,
      TXI_IS_PROJECTS.PROJECT_DESC,
      TXI_IS_PROJECTS.PROJECT_SIZE,
      TXI_IS_PROJECTS.PROJECT_STATUS,
      (select NLS_INITCAP(name_f || ' ' || name_l) name
       from TXI_PEOPLE
       where userid= TXI_IS_PROJECTS.PROJECT_OWNER) as "My Column",
      TXI_IS_PROJECTS.SYSTEM_OWNER,
      TXI_IS_PROJECTS.CREATE_DATE,
      TXI_IS_PROJECTS.SPEC_REVIS,
      TXI_DOCUMENTS.NAME
    FROM TXI_IS_PROJECTS
      INNER JOIN TXI_DOCUMENTS ON TXI_DOCUMENTS.PROJECT_ID = TXI_IS_PROJECTS.PROJECT_ID
      INNER JOIN TXI_DOCUMENT_SIGNOFF ON TXI_DOCUMENT_SIGNOFF.DOC_ID = TXI_DOCUMENTS.ID
    WHERE TXI_DOCUMENT_SIGNOFF.SIGN_OFF_ID = :P9_SIGN_OFF_ID;<br>
    as "My Column"<br><br>
    I just recreated it and that worked.<br><br>
    chet

  • How to perform calculations using column data in BI Publisher

    Hello guys
    I am very new to BIP, and recently I am learning to create new templates using XML files..
    I am trying to create a report that has Account Amount, Amount Net Amount, PM_Amount and a New field say "X"
    For Account Amount it is what it is, but for Net Amount it is "Account Amount/40%", for PM_Amount it is "Net Amount x (Account Amount/30)" and for field X it is "(Net Amount + PM_Amount)/column A" where column A is another data field in the XML file but it should not be included in the template report..
    Could anyone help me with how to perform such kind of calculations in BIP Template builder? In OBIEE, it is very easy that I can just use column formula, but in BIP I still haven't figure out the way yet..
    PLease advice
    Thanks

    Thanks for the reply..
    I looked at the link you provided already, what I wanna know is how to exactly apply the expression in my calculation. In other words, I know that Column C = "Column A div Column B", but in BIP form property, how do I actually substitue "column A" with the actual column..
    I wish I could post the XML, but it is huge, it contains 6 data sets and more than 100 columns. I only need 15 columns on my template.
    On the form property of each measures, in the "advance tab", I see codes like <?accountamount?>. Now I wanna have a new column said "PM_Amt" which should be "(accountamount div %40) x column B". So I just randomly select another column said "payment". I rename it to "PM_AMT" and on its "advanced tab" it is still <?payment?>. So right there, if I wanna replace that code with a new one that does "(accountamount div %40) x column B" calculation, how would I do it? What would be the syntax including how to propertly refer to the right column field as part of the expression?
    And do I have to always use xdofx between <>? how would I know?
    Please advice if you understood what I am trying to say
    Much thanks
    Edited by: user7276913 on Sep 14, 2009 11:24 PM

  • Using SQL alias column names in same SQL

    Hi,
    I am converting some Teradata SQL queries and these queries have the ability to use column defined aliases within the same query, something like :
    SQL> select 'test' as alias1, 'test2' as alias2, alias1 from dual
    Does anyone know how I can get Oracle to do this ????
    Many thanks
    Ben

    Hi,
    Yes I did think of that - its just the queries calculated columns are quite large - sample below show a value calculated currently based on alias names - just trying to find an easier way to apply.
    I was hoping for some magical syntax that has eluded me !
    Ben
    (exp(case when (constant_contrib + fsnumber_contrib + herolevel_contrib + is_colmans_contrib + is_heinz_contrib + is_short_life1_contrib + is_short_life2_contrib + is_short_life3_contrib + logcount_prod_contrib + offer_shelf_cap_contrib + promointensity_contrib + std_shelf_cap_contrib + xforprice_add_1_contrib + ( (power(sh_ms_variables.xfspr,1)) * formula_coefficients.coeff_xfspr1 ) + ( (power(sh_ms_variables.xfspr,2)) * formula_coefficients.coeff_xfspr2 ) + ( (power(sh_ms_variables.xfspr,3)) * formula_coefficients.coeff_xfspr3 ) + ( (power(sh_ms_variables.xfspr,4)) * formula_coefficients.coeff_xfspr4 ) + ( sh_ntnl_variables.xnfor2 * formula_coefficients.coeff_xnfor2 ) + ( sh_ms_variables.xnforfs1 * formula_coefficients.coeff_xnforfs1 ) + ( sh_ms_variables.xnforfs2 * formula_coefficients.coeff_xnforfs2 ) + ( sh_ms_variables.xnforfspl * formula_coefficients.coeff_xnforfspl ) + ( sh_ntnl_variables.xnforpl * formula_coefficients.coeff_xnforpl ) + ( (power(sh_ms_variables.xpr,1)) * formula_coefficients.coeff_xpr1 ) + ( (power(sh_ms_variables.xpr,2)) * formula_coefficients.coeff_xpr2 ) + ( (power(sh_ms_variables.xpr,3)) * formula_coefficients.coeff_xpr3 ) + ( (power(sh_ms_variables.xpr,4)) * formula_coefficients.coeff_xpr4 )) < 500 then (constant_contrib + fsnumber_contrib + herolevel_contrib + is_colmans_contrib + is_heinz_contrib + is_short_life1_contrib + is_short_life2_contrib + is_short_life3_contrib + logcount_prod_contrib + offer_shelf_cap_contrib + promointensity_contrib + std_shelf_cap_contrib + xforprice_add_1_contrib + ( (power(sh_ms_variables.xfspr,1)) * formula_coefficients.coeff_xfspr1 ) + ( (power(sh_ms_variables.xfspr,2)) * formula_coefficients.coeff_xfspr2 ) + ( (power(sh_ms_variables.xfspr,3)) * formula_coefficients.coeff_xfspr3 ) + ( (power(sh_ms_variables.xfspr,4)) * formula_coefficients.coeff_xfspr4 ) + ( sh_ntnl_variables.xnfor2 * formula_coefficients.coeff_xnfor2 ) + ( sh_ms_variables.xnforfs1 * formula_coefficients.coeff_xnforfs1 ) + ( sh_ms_variables.xnforfs2 * formula_coefficients.coeff_xnforfs2 ) + ( sh_ms_variables.xnforfspl * formula_coefficients.coeff_xnforfspl ) + ( sh_ntnl_variables.xnforpl * formula_coefficients.coeff_xnforpl ) + ( (power(sh_ms_variables.xpr,1)) * formula_coefficients.coeff_xpr1 ) + ( (power(sh_ms_variables.xpr,2)) * formula_coefficients.coeff_xpr2 ) + ( (power(sh_ms_variables.xpr,3)) * formula_coefficients.coeff_xpr3 ) + ( (power(sh_ms_variables.xpr,4)) * formula_coefficients.coeff_xpr4 )) else 500 end ) - 1) AS uplift,
    Edited by: user485052 on Dec 10, 2010 3:08 AM

  • How to use one report column into the another report in obiee

    How to use one report column into the another report in obiee

    i dont want to use column as a filter for another report it should be report column for another report
    Thanks,
    Vivek

  • Cannot access columns in a result set using table alias in Oracle database

    I have a query which joins a few tables. There are a few columns in various tables with identical names. In the query, I have assigned table aliases for each table thinking it'll be the manner in which I access a specific column in a specific database table. However, when trying to retrieve the column, I'm getting an exception stating "Invalid column name". I had no problem doing so in my last project when I was coding against MySQL database so this is likely to be a driver implementation issue. My current workaround is to assign a column alias though I find this to be annoying and it does make the query very verbose.
    My question is whether this option is perhaps a configuration issue, a bug, or something that I'm missing. Also, I would like to know if anybody has an elegant workaround without accessing columns using their numeric index.
    I'm querying an Oracle 10i database in a managed environment (database connection is obtained from a Weblogic data source).
    Sample query:
    select
    a.address1,
    d.address1
    from
    account a
    inner join
    department d on a.department_id = d.department_id
    where
    a.account_id = 1000;
    When trying to access a ResultSet instance in the following manner, I will get an exception:
    rs.getString("d.address1");
    Retrieving "address1" will return the first column in the select clause.

    jonathan3 wrote:
    My question is whether this option is perhaps a configuration issue, a bug, or something that I'm missing. Since you already figured out that you can use an alias one can suppose that it is the last in that you are missing that you already have a solution.
    You can try extracting the meta data to see if it has a name without the alias. Probably not.
    Also, I would like to know if anybody has an elegant workaround without accessing columns using their numeric index.One can only suppose that you consider using names "elegant".

  • Results to be used in another calculation field.

    Dear All,
    I have a report showing average month in unit wise. The result is aggregated for "total" average month. Now I want to use that value, total result value in a formula variable for calculation. i want to create another calculation based on result which i have got in average month field.
    Average Month field is CKF.
    Example:
    Technical id number     AVGMonths                  MONTH
      '9185                                         1
      '9185                                         3
      '9185                                         4
      '9185                                         2                          
    Overall result is                         10
    I need overall result 10 to be displayerd in MONTH field.
    Please help me to overcome from this problem.
    Regards,
    MohammeD.
    Edited by: mohammed marika on Feb 14, 2011 9:48 AM

    Hi,
    It seems it has some limitation when we use SUMCT function with CKF.
    Please check the below thread for the same
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/007ba7a0-bcea-2b10-7e89-cbcb9db98a28?quicklink=index&overridelayout=true
    Try using SUMGT function also.
    Hope it helps you.
    Regards,
    AL
    Edited by: AL1112 on Feb 14, 2011 10:44 AM

  • Column alias for spatial column within cursor loop using dynamic SQL

    The following PL/SQL is trying to generate an error report for records or objects which are 3 dimensional or above. I have no issue execute one statement in SQLPLUS but I need to use the column alias for the spatial column. But, it is a different story using PL/SQL and dynamic SQL Any help will be great because I've been working on this for than 8 hours but with no luck! Thanks.
    Here is the error I'm getting,
    stmt := 'select p.column_name.get_gtype(), id from '|| table_name p ' where p.column_name.get_gtype() > 2 ';
    ERROR at line 15:
    ORA-06550: line 15, column 79:
    PLS-00103: Encountered the symbol "P" when expecting one of the following:
    . ( * @ % & = - + ; < / > at in is mod remainder not rem
    <an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
    LIKE4_ LIKEC_ between || member SUBMULTISET_
    The symbol "* was inserted before "P" to continue.
    and my PL/SQL is,
    set serveroutput on size 100000 feedback off
    declare
    rs integer;
    rs1 integer;
    cur integer;
    rp integer;
    trs integer;
    n integer;
    un varchar2(30);
    stmt varchar2(200);
    begin
    dbms_output.put_line(rpad('Table Name',40)||' Dimension');
    dbms_output.put_line(rpad('-',53,'-'));
    cur:= dbms_sql.open_cursor;
    for t in (select column_name,table_name from user_sdo_geom_metadata where regexp_like(table_name, '[^[A-B]_[AB]$'))
    loop
    stmt := 'select p.column_name.get_gtype(), id from '|| table_name p ' where p.column_name.get_gtype() > 2 ';
    dbms_sql.parse(cur, stmt, dbms_sql.native);
    dbms_sql.define_column(cur, 1, rs);
    dbms_sql.define_column(cur, 2, rs1);
    rp:= dbms_sql.execute(cur);
    n:=dbms_sql.fetch_rows(cur);
    dbms_sql.column_value(cur, 1, rs);
    dbms_sql.column_value(cur, 2, rs1);
    dbms_output.put_line(rpad(t.table_name,38,'.')||rpad(rs,15)||rpad(rs1,15));
    end loop;
    dbms_sql.close_cursor(cur);
    dbms_output.put_line(rpad('-',53,'-'));
    end;
    set serveroutput off feedback on feedback 6

    The following PL/SQL is trying to generate an error report for records or objects which are 3 dimensional or above. I have no issue execute one statement in SQLPLUS but I need to use the column alias for the spatial column. But, it is a different story using PL/SQL and dynamic SQL Any help will be great because I've been working on this for than 8 hours but with no luck! Thanks.
    Here is the error I'm getting,
    stmt := 'select p.column_name.get_gtype(), id from '|| table_name p ' where p.column_name.get_gtype() > 2 ';
    ERROR at line 15:
    ORA-06550: line 15, column 79:
    PLS-00103: Encountered the symbol "P" when expecting one of the following:
    . ( * @ % & = - + ; < / > at in is mod remainder not rem
    <an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
    LIKE4_ LIKEC_ between || member SUBMULTISET_
    The symbol "* was inserted before "P" to continue.
    and my PL/SQL is,
    set serveroutput on size 100000 feedback off
    declare
    rs integer;
    rs1 integer;
    cur integer;
    rp integer;
    trs integer;
    n integer;
    un varchar2(30);
    stmt varchar2(200);
    begin
    dbms_output.put_line(rpad('Table Name',40)||' Dimension');
    dbms_output.put_line(rpad('-',53,'-'));
    cur:= dbms_sql.open_cursor;
    for t in (select column_name,table_name from user_sdo_geom_metadata where regexp_like(table_name, '[^[A-B]_[AB]$'))
    loop
    stmt := 'select p.column_name.get_gtype(), id from '|| table_name p ' where p.column_name.get_gtype() > 2 ';
    dbms_sql.parse(cur, stmt, dbms_sql.native);
    dbms_sql.define_column(cur, 1, rs);
    dbms_sql.define_column(cur, 2, rs1);
    rp:= dbms_sql.execute(cur);
    n:=dbms_sql.fetch_rows(cur);
    dbms_sql.column_value(cur, 1, rs);
    dbms_sql.column_value(cur, 2, rs1);
    dbms_output.put_line(rpad(t.table_name,38,'.')||rpad(rs,15)||rpad(rs1,15));
    end loop;
    dbms_sql.close_cursor(cur);
    dbms_output.put_line(rpad('-',53,'-'));
    end;
    set serveroutput off feedback on feedback 6

  • And another issue - using : column like :item in a select in a cursor

    i use column like :item frequently but now i'm thinking that it slows down the select making it run much more slowly . any suggestions or documentation I might use ? Do you think that it would be better to use column = :item or not to use :item at all ? Thanks a lot !

    Like in Select is used as
    WHERE col1 LIKE 'aaa%'
    and disable the index on col1 (Sure exists Index-Function)
    as it's better writing
    WHERE account_name LIKE 'CAPITAL%'in comparison to
    WHERE SUBSTR(account_name,1,7) = 'CAPITAL'Sure is better if you can use col1 = :item but I don't know your goal.
    Regards

  • Times ten not showing the column alias as column header in select query.

    Hi All,
    I am trying to execute following queries on TimesTen database 11.2.2.2.0.
    SELECT ROWNUMBER,
    floor((to_date(TO_CHAR(SYSDATE,'YYYY-MM-DD hh24:mi:ss'), 'YYYY-MM-DD hh24:mi:ss')-to_date(TO_CHAR(starttime,'YYYY-MM-DD hh24:mi:ss'), 'YYYY-MM-DD hh24:mi:ss'))*24)
    || 'h '
    || mod(floor((to_date(TO_CHAR(SYSDATE,'YYYY-MM-DD hh24:mi:ss'), 'YYYY-MM-DD hh24:mi:ss')-to_date(TO_CHAR(starttime,'YYYY-MM-DD hh24:mi:ss'), 'YYYY-MM-DD hh24:mi:ss'))*24*60),60)
    || 'm '
    || mod(floor((to_date(TO_CHAR(SYSDATE,'YYYY-MM-DD hh24:mi:ss'), 'YYYY-MM-DD hh24:mi:ss')-to_date(TO_CHAR(starttime,'YYYY-MM-DD hh24:mi:ss'), 'YYYY-MM-DD hh24:mi:ss'))*24*60*60),60)
    || 's' TIME_DIFFERENCE
    FROM
    (SELECT ROW_NUMBER() OVER (ORDER BY USERIDENTITY DESC) ROWNUMBER,
    u.*
    FROM TBLMCORESESSIONS u
    WHERE 1=1
    ) B
    WHERE ROWNUMBER BETWEEN 1 AND 5
    and I am getting the follwing output.
    ROWNUMBER,
    < 1, 8h 52m 34s >
    < 2, 8h 54m 24s >
    < 3, 8h 54m 13s >
    < 4, 8h 55m 6s >
    < 5, 8h 54m 40s >
    The issue is I should get TIME_DIFFERENCE as column header but it is not showing TIME_DIFFERENCE as the column header & it is calculating the value just fine .
    & if same query I execute on oracle 11g database every thing works fine.
    please suggest me something that column header is must.
    or suggest me any other for query
    Edited by: hiaditya04 on Apr 24, 2012 11:05 AM

    Hi,
    It is similar to bug which is raised in Timesten 11.2.2.2.. BUG 13896607 - COLUMN NAME MISSING FROM A VIEW IN TIMESTEN 11.2.2.2 . If you have MOS access then you can view about this bug. The bug is going to be fix in the future release. The bug basically indicates that we are not displaying the column name properly when select list contains complex expressions. The column itself can be accessed and values are displayed correctly.
    Regarding your issue "column TIME_DIFFERENCE not found" , I would suggest you to access the column by position, not by name like below
    I believe you are trying to access your column like below
    resultset.getString(“TIME_DIFFERENCE”)
    Instead of this you can use : -- resultset.getString(2) ( this position should based on the position of the column you are using in the query)
    Hope this helps.
    Regards
    Rajesh

Maybe you are looking for