HELP!   SQL Query:  Other ways to reorder column display?

I have a SQL query report with a large number of columns (users can hide/show columns as desired). It would be great if the column display order could be changed by changing the order of the columns in the SELECT list in the Report Definition, but that doesn't work -- it puts changed or added columns at the end regardless of the order in the SELECT list of the query.
Is there some other way to reorder the columns displayed without using the Report Attributes page? It's extremely tedious to move columns around using the up/down arrows which redisplays the page each time. Am I missing a way to change display order, or does anyone have a "trick" to do this? It's so painful....
When defining forms you can reoder columns by specifying a sequence number for each column. Just curious as to why reports were not done the same way, and are there any plans to address this in a future release?
Karen

Yes, reordering columns is extremely painful.
It is supposed to be much improved in the next version.
See
Re: Re-ordering columns on reports
Moving columns up/down in Report  Attributes
See my example at
http://htmldb.oracle.com/pls/otn/f?p=24317:141
Basically, let the users move columns around until they are blue in the face, provide a Save button to save the column order in a user preference and reorder the columns when the page reloads.
Or you can use Carl's PL/SQL shuttle as the widget to specify the columns shown and their order. The shuttle is at http://htmldb.oracle.com/pls/otn/f?p=11933:27
Hope this helps.
Message was edited by:
Vikas

Similar Messages

  • Please help me what other way i can tune this select query..

    Hello Guru,
    I have a select query which retrieve data from 10 tables and around 4 tables having 2-4 Lac record and rest are having 80,000 - 1 Lac record.
    It is taking around 7-8 seconds to fetch 55000 record.
    I was strictly told by the client that i should not use HINTS in my query. My query is below. Please help me what other way i can tune this select query..
    select
    CT.CUST_ID
    ,CT.ROMANISED_SURNAME
    ,CT.SURNAME
    ,CT.ROMANISED_GIVEN_NAME
    ,CT.GIVEN_NAME
    ,CT.ROMANISED_MIDDLE_NAME
    ,CT.MIDDLE_NAME
    ,CT.ROMANISED_NAME_SUFFIX
    ,CT.NAME_SUFFIX
    ,CT.ROMANISED_TITLE
    ,CT.TITLE
    ,CT.ROMANISED_NAME_INITIALS
    ,CT.NAME_INITIALS
    ,CT.NAME_TEXT
    ,CT.CUST_JRNY_ID
    ,RK.REMARK_TYPE
    ,RK.REMARK_ID+CT.CUST_ID as REMARK_ID
    ,RK.REMARK_STATUS
    ,RK.REMARK_TEXT
    ,RK.HOST_ONLY_IND
    ,RK.SUPERVISORY_IND
    ,RK.CUST_COMM_IND
    ,RK.REMARK_SEQ
    ,RK.REMARK_CODE
    ,RK.DEFAULT_CUST_REL_IND
    ,RK.DEFAULT_FLIGHT_SEG_REL_IND
    ,RK.IATA_CODE
    ,RK.ICAO_CODE
    ,CJ.RECORD_LOCATOR "SITA_RECORD_LOCATOR"
    ,Cjv.Record_Locator "ORIGINATOR_RECORD_LOCATOR"
    ,FS.TRAVELLING_GROUP_CODE
    ,CG.GROUP_NAME
    FROM FLIGHT_LEG FL
    ,CUST_FLIGHT_LEG CFL
    ,CUST CT
    ,CUST_REMARK CTR
    ,REMARK RK
    ,FLIGHT_SEG_FLIGHT_LEG FSFL
    ,FLIGHT_SEG FS
    ,CUST_JRNY CJ
    ,CUST_JRNY_VERSION CJV
    ,CUST_GROUP CG
    WHERE FL.OPR_FLIGHT_NUMBER = 1--I_OPR_FLIGHT_NUMBER
    and FL.HISTORY_VERSION_NUMBER = 0
    and FL.DEPARTURE_STATION_CODE = 'DEL'--I_DEPARTURE_STATION_CODE
    and FL.DEPARTURE_DATETIME = TO_DATE('10-DEC-2012 18.45.00', 'DD-MON-YYYY HH24.MI.SS')
    and FL.OPR_SERVICE_PROVIDER_CODE= 'AI'--i_opr_service_provider_code
    and FL.OPR_FLIGHT_SUFFIX = 'A'--NVL(I_OPR_FLIGHT_SUFFIX, FL.OPR_FLIGHT_SUFFIX)
    AND FL.FLIGHT_LEG_ID = CFL.FLIGHT_LEG_ID
    AND CFL.CUST_ID = CT.CUST_ID
    AND FL.FLIGHT_LEG_ID=FSFL.FLIGHT_LEG_ID
    AND FSFL.FLIGHT_SEG_ID=FS.FLIGHT_SEG_ID
    AND CT.CUST_ID = CTR.CUST_ID(+)
    AND CTR.REMARK_ID = RK.REMARK_ID(+)
    AND FL.CUST_JRNY_ID = CJ.CUST_JRNY_ID
    and CJ.CUST_JRNY_ID = CJV.CUST_JRNY_ID
    AND CG.CUST_JRNY_ID(+) = CT.CUST_JRNY_ID
    AND CFL.HISTORY_VERSION_NUMBER = 0
    AND CT.HISTORY_VERSION_NUMBER = 0
    AND NVL(CTR.HISTORY_VERSION_NUMBER,0) = 0
    AND NVL(RK.HISTORY_VERSION_NUMBER,0) = 0
    AND FS.HISTORY_VERSION_NUMBER = 0
    AND FSFL.HISTORY_VERSION_NUMBER = 0
    -- AND CJ.HISTORY_VERSION_NUMBER = 0
    and CJV.VERSION_NUMBER = 0 --- Need to check
    AND NVL(CG.HISTORY_VERSION_NUMBER,0) = 0
    order by CT.CUST_JRNY_ID,CT.CUST_ID;
    The Tables having record:
    select COUNT(*) from FLIGHT_LEG -----241756
    select COUNT(*) from CUST_FLIGHT_LEG---632585
    select COUNT(*) from CUST---240015
    select COUNT(*) from CUST_REMARK---73724
    select COUNT(*) from REMARK---73654
    select COUNT(*) from FLIGHT_SEG_FLIGHT_LEG---241789
    select COUNT(*) from FLIGHT_SEG----260004
    select COUNT(*) from CUST_JRNY----74288
    select COUNT(*) from CUST_JRNY_VERSION----74477
    select COUNT(*) from CUST_GROUP----55819
    Thanks,
    HP..

    Plan hash value: 3771714931
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | Pstart| Pstop |
    | 0 | SELECT STATEMENT | | 10239 | 2949K| | 7515 (1)| 00:01:31 | | |
    | 1 | SORT ORDER BY | | 10239 | 2949K| 3160K| 7515 (1)| 00:01:31 | | |
    |* 2 | HASH JOIN | | 10239 | 2949K| | 6864 (1)| 00:01:23 | | |
    | 3 | PARTITION HASH ALL | | 73687 | 1079K| | 417 (1)| 00:00:06 | 1 | 512 |
    |* 4 | TABLE ACCESS FULL | CUST_JRNY_VERSION | 73687 | 1079K| | 417 (1)| 00:00:06 | 1 | 512 |
    |* 5 | HASH JOIN | | 10239 | 2799K| | 6445 (1)| 00:01:18 | | |
    | 6 | PARTITION HASH ALL | | 73654 | 863K| | 178 (1)| 00:00:03 | 1 | 512 |
    | 7 | TABLE ACCESS FULL | CUST_JRNY | 73654 | 863K| | 178 (1)| 00:00:03 | 1 | 512 |
    |* 8 | FILTER | | | | | | | | |
    |* 9 | HASH JOIN RIGHT OUTER | | 10239 | 2679K| | 6267 (1)| 00:01:16 | | |
    | 10 | PARTITION HASH ALL | | 55315 | 756K| | 137 (1)| 00:00:02 | 1 | 512 |
    | 11 | TABLE ACCESS FULL | CUST_GROUP | 55315 | 756K| | 137 (1)| 00:00:02 | 1 | 512 |
    |* 12 | FILTER | | | | | | | | |
    |* 13 | HASH JOIN OUTER | | 10240 | 2540K| 2056K| 6129 (1)| 00:01:14 | | |
    |* 14 | FILTER | | | | | | | | |
    |* 15 | HASH JOIN RIGHT OUTER | | 10242 | 1930K| | 5531 (1)| 00:01:07 | | |
    | 16 | INDEX FAST FULL SCAN | CUST_REMARK_PK | 73677 | 935K| | 190 (0)| 00:00:03 | | |
    |* 17 | HASH JOIN | | 10257 | 1802K| | 5339 (1)| 00:01:05 | | |
    |* 18 | HASH JOIN | | 10257 | 701K| | 3516 (1)| 00:00:43 | | |
    |* 19 | HASH JOIN | | 3963 | 220K| | 2476 (1)| 00:00:30 | | |
    |* 20 | HASH JOIN | | 3963 | 181K| | 1300 (1)| 00:00:16 | | |
    | 21 | PARTITION HASH ALL | | 3963 | 131K| | 728 (1)| 00:00:09 | 1 | 512 |
    |* 22 | TABLE ACCESS FULL | FLIGHT_LEG | 3963 | 131K| | 728 (1)| 00:00:09 | 1 | 512 |
    |* 23 | INDEX FAST FULL SCAN| FLIGHT_SEG_FLIGHT_LEG_PK | 240K| 3059K| | 571 (1)| 00:00:07 | | |
    | 24 | PARTITION HASH ALL | | 259K| 2531K| | 1175 (1)| 00:00:15 | 1 | 512 |
    |* 25 | TABLE ACCESS FULL | FLIGHT_SEG | 259K| 2531K| | 1175 (1)| 00:00:15 | 1 | 512 |
    | 26 | PARTITION HASH ALL | | 631K| 8011K| | 1037 (1)| 00:00:13 | 1 | 512 |
    |* 27 | TABLE ACCESS FULL | CUST_FLIGHT_LEG | 631K| 8011K| | 1037 (1)| 00:00:13 | 1 | 512 |
    | 28 | PARTITION HASH ALL | | 239K| 25M| | 1822 (1)| 00:00:22 | 1 | 512 |
    |* 29 | TABLE ACCESS FULL | CUST | 239K| 25M| | 1822 (1)| 00:00:22 | 1 | 512 |
    | 30 | PARTITION HASH ALL | | 73623 | 4385K| | 243 (1)| 00:00:03 | 1 | 512 |
    | 31 | TABLE ACCESS FULL | REMARK | 73623 | 4385K| | 243 (1)| 00:00:03 | 1 | 512 |
    Predicate Information (identified by operation id):
    2 - access("CJ"."CUST_JRNY_ID"="CJV"."CUST_JRNY_ID")
    4 - filter("CJV"."VERSION_NUMBER"=0)
    5 - access("FL"."CUST_JRNY_ID"="CJ"."CUST_JRNY_ID")
    8 - filter(NVL("CG"."HISTORY_VERSION_NUMBER",0)=0)
    9 - access("CG"."CUST_JRNY_ID"(+)="CT"."CUST_JRNY_ID")
    12 - filter(NVL("RK"."HISTORY_VERSION_NUMBER",0)=0)
    13 - access("CTR"."REMARK_ID"="RK"."REMARK_ID"(+))
    14 - filter(NVL("CTR"."HISTORY_VERSION_NUMBER",0)=0)
    15 - access("CT"."CUST_ID"="CTR"."CUST_ID"(+))
    17 - access("CFL"."CUST_ID"="CT"."CUST_ID")
    18 - access("FL"."FLIGHT_LEG_ID"="CFL"."FLIGHT_LEG_ID")
    19 - access("FSFL"."FLIGHT_SEG_ID"="FS"."FLIGHT_SEG_ID")
    20 - access("FL"."FLIGHT_LEG_ID"="FSFL"."FLIGHT_LEG_ID")
    22 - filter("FL"."DEPARTURE_STATION_CODE"='DEL' AND "FL"."DEPARTURE_DATETIME"=TO_DATE(' 2012-12-10 18:45:00', 'syyyy-mm-dd
    hh24:mi:ss') AND "FL"."OPR_SERVICE_PROVIDER_CODE"='AI' AND "FL"."OPR_FLIGHT_NUMBER"=1 AND "FL"."OPR_FLIGHT_SUFFIX"='A' AND
    "FL"."HISTORY_VERSION_NUMBER"=0)
    23 - filter("FSFL"."HISTORY_VERSION_NUMBER"=0)
    25 - filter("FS"."HISTORY_VERSION_NUMBER"=0)
    27 - filter("CFL"."HISTORY_VERSION_NUMBER"=0)
    29 - filter("CT"."HISTORY_VERSION_NUMBER"=0)

  • SQL Query issue with large varchar column

    I have a SQL Query (PL/SQL function body returning SQL query) which contains a large varchar column. Even if I substring the column to 30chars when it displays on the page it wraps. I have tried putting nowrap="wrap" for the HTML table cell attributes and it still wraps. I have tried setting the width attributes on the column even though it's not an updateable column. Does anyone have any ideas on how prevent this from wrapping. In some cases 1 line will take up 3 because of this wrapping issue and it's not nice to look at. It seems that the column is somewhere set to a fixed width, which is less than 30 characters, and anything beyond this fixed width wraps.

    Hi Netha,
    Can you please provide the DDLs of three tables you are using,
    Also post us how many rows you are getting output for this query? 
    select * from dim.store st where
    st.store_code = 'MAUR'
    also try to run and update statement on this table as below and execute your query
    update dim.store
    set store_code
    = ltrim(rtrim(store_code))
    where
    store_code = 'MAUR'
    once you run this update, then run your query.  Let us know the result.

  • Need sql query to convert rows to columns

    Im using oracle 11g.
    I have data in a table as below: Column names are type,month,percentage
    TYPE      MONTH   PERCENTAGE
    A1         JAN-2013     100
    A2         JAN-2013     100
    A3         JAN-2013     95
    A4         JAN-2013     98
    A5         JAN-2013     99
    A6         JAN-2013     90
    A7         JAN-2013     92
    A1         FEB-2013     100
    A2         FEB-2013     99
    A3         FEB-2013     88
    A4         FEB-2013     67
    A5         FEB-2013     98
    A6         FEB-2013     95
    A7         FEB-2013     84
    The desired output using a sql query is as below
    TYPE     JAN-2013     FEB-2013
    A1         100             100
    A2         100             99
    A3         95               88
    A4         98               67
    A5         99               98
    A6         90               95
    A7         92               84

    Try this:
    select * from table_name
    PIVOT(   max(Percentage)
                     for MONTH
                     in ('JAN-2013','FEB-2013')
                     ) ;with data
    with t(TYPE,MONTH,PERCENTAGE) as
    SELECT 'A1', 'JAN-2013', 100
      FROM DUAL
    UNION ALL
    SELECT 'A2', 'JAN-2013', 100
      FROM DUAL
    UNION ALL
    SELECT 'A3', 'JAN-2013', 95
      FROM DUAL
    UNION ALL
    SELECT 'A4', 'JAN-2013', 98
      FROM DUAL
    UNION ALL
    SELECT 'A1', 'FEB-2013', 100
      FROM DUAL
    UNION ALL
    SELECT 'A2', 'FEB-2013', 99
      FROM DUAL
    UNION ALL
    SELECT 'A3', 'FEB-2013', 88
      FROM DUAL
    UNION ALL
    SELECT 'A4', 'FEB-2013', 67
      FROM DUAL
    select * from t PIVOT(   max(Percentage)
                     for MONTH
                     in ('JAN-2013','FEB-2013')
                     ) ;

  • App-V Reporting: SQL query for Excel Pivot Table to display App Usage (H/M/S)

    I recently posted this in the Gallery.  If anyone has any modifications or enhancements please feel free to contribute!  One thing that I'd like to be able to add to it is the ability to only display information for applications/packages that are
    still published, so if anyone can figure out a crafty way to do it...  Thanks!
    http://gallery.technet.microsoft.com/App-V-Reporting-SQL-query-6695d3c3

    I recently posted this in the Gallery.  If anyone has any modifications or enhancements please feel free to contribute!  One thing that I'd like to be able to add to it is the ability to only display information for applications/packages that are
    still published, so if anyone can figure out a crafty way to do it...  Thanks!
    http://gallery.technet.microsoft.com/App-V-Reporting-SQL-query-6695d3c3

  • Sql query parsing (retrieve tables and columns used in query)

    Hi,
    1. Is there any view in Oracle which can tell me, which tables and columns were used in the last ran query, no matter how complex the query is.
    2. Secondly I can get table names, used in stored procedures and views, using USER_DEPENDENCIES VIEW, however this System View does not return column names, used in that procedure / view, any idea please .
    Thanks and Regards,
    Luqman

    luqman123 wrote:
    Hi,
    1. Is there any view in Oracle which can tell me, which tables and columns were used in the last ran query, no matter how complex the query is.I don't believe so. You can look at V$SQL and retrieve the actual SQL text from there.
    2. Secondly I can get table names, used in stored procedures and views, using USER_DEPENDENCIES VIEW, however this System View does not return column names, used in that procedure / view, any idea please .Oracle added fine grained dependency tracking in 11g, but didn't expose any views to query this information. However, it has been reverse engineered a bit: About Oracle: DBA_DEPENDENCY_COLUMNS

  • Help with query - multiple where in grouped column

    4 columns in table named RRID1
    RRI_ID
    USER_ID
    PROCESS_TYPE
    FUNCTION
    not sure how to make this query.
    Need to pull all RRI_ID's where PROCESSTYPE ='INFO' and PROCESSTYPE ='RESOLUTION'
    for that RRI_ID.
    so same user, same RRI_ID and 2 process records, 1 INFO and 1 RESOLUTION
    so not if there is duplicate info, just if there is info and resolution.
    This is what some of data looks like..
    PROCESSTYPE|USER_ID|FUNCTION|RRI_ID
    INFO 3668 30287 817
    INFO 3748 30287 817
    INFO 4714 30287 817
    INFO 4875 30287 817
    INFO 4882 30287 817
    INFO 4885 30287 817
    INFO 3748 30288 818
    INFO 4714 30288 818
    INFO 4716 30288 818
    INFO 4882 30288 818
    INFO 4885 30288 818
    INFO 3668 30289 819
    INFO 4716 30289 819
    INFO 4875 30289 819
    INFO 4882 30289 819
    INFO 4885 30289 819
    INFO 3668 30290 820
    INFO 4716 30290 820
    INFO 4875 30290 820
    INFO 4882 30290 820
    INFO 4885 30290 820
    INFO 3668 30291 821
    INFO 4714 30291 821
    INFO 4716 30291 821
    INFO 4875 30291 821
    INFO 4882 30291 821

    you will have a stroke before you hit 40That's not the point, but thanks for your concern and you'll probably end up having a stroke sooner than me if you keep asking questions this way ;)
    Point is: stick to your original thread/question, keep it all together, be complete, instead of reposting and starting all over again.
    It's confusing when you start a new thread, while the context of your old thread matters.
    While Blu seemed to be correct, you changed the question in your previous thread after his answer and started a new one, with the same 'data'.
    Hence me being a 'nit-picker', because by starting multiple threads:
    - you'll get the right answer slower, maybe much slower
    - we're assuming things that might be out of context, given your previous thread
    etc.

  • SQL Query to re-order the columns

    Hello All,
    I want to know if it is possible to re-order the columns of a table once the rows has been inserted in all the columns.
    So for e.g I have initially a table containing 3 columns COL1, COL2 & COL3.
    Now after data has been inserted into the table, I want to re-order the columns like COL3, COL2, COl1 or may be COL2, COL1, COL3 etc keeping the data intact.
    Cheers,
    Parag

    Parag Kalra wrote:
    I want to know if it is possible to re-order the columns of a table once the rows has been inserted in all the columns.
    So for e.g I have initially a table containing 3 columns COL1, COL2 & COL3.
    Now after data has been inserted into the table, I want to re-order the columns like COL3, COL2, COl1 or may be COL2, COL1, COL3 etc keeping the data intact.Why? What is your reason for wanting to do this? What do you want to achieve by it? If we understand the actual problem, then we may be able to provide some usable suggestions.
    The reason why your request makes very little sense is that the physical sequence of columns in a row in a datablock, has no impact on you as developer writing code.
    Why? Because you control the order in which you want to select columns. You control the order in which you insert columns. You control the order in which you update columns.
    SQL allows you the programmer to specify the sequence of columns, and subset of columns, that you want to use in your SQL.
    Why would you want to change the physical table definition, and rewrite the entire table on disk (using very expensive I/O) to reorder the physical column sequence?

  • Help SQL Query (Not working as it should)

    Hello everybody,
    I'm using JDeveloper 12.1.2.0.0 . I'm doing a bidirectional comunication using 3 tables, with bindings between them (and using HR schema).
    In my example, i have something like:
    Departments, Employees and SalaryByJobs (i created this table where it shows the departmentd id, employee id, job, salary).
    Whenever i click on one OR more departments, the employees table update by putting on the table, the employees that belong to the selected department and the salaryByjob put the jobs by employees selected on the employees table.
    So it's something like this:
    Departments selected -> employees selected -> salarybyjbobs of those employees.
    My Employees query (in the view) has the following code:
    SELECT Employees.COMMISSION_PCT,
           Employees.DEPARTMENT_ID,
           Employees.EMAIL,
           Employees.EMPLOYEE_ID,
           Employees.FIRST_NAME,
           Employees.HIRE_DATE,
           Employees.JOB_ID,
           Employees.LAST_NAME,
           Employees.MANAGER_ID,
           Employees.PHONE_NUMBER,
           Employees.SALARY
    FROM  EMPLOYEES Employees
    WHERE ( DEPARTMENT_ID IN (select * from THE(select cast( in_list(:variavel3) as mytableType ) from dual ) a))
    Since i use bindings, the employees table don't show anything in the beginning, so i added this parte to my employees query: OR nvl(:variavel3,0) = 0
    But now, whenever i try to select more than one row, it gives me invalid numbers and i don't understand why..
    It's only more one line of code and it's not in the bean.
    Can anyone help me?
    Ps - The bean goes department by department, appends the departments with "," and for each department, gets the employees that belongs to them.
    My best regards,
    Frederico Barracha.

    The expression NVL(:variavel3,0)=0 is not correct. The datatype of the return value of the NVL function is considered equal to the datatype of the 1st argument (i.e to the datatype of the bind variable :variavel3). You said that this variable contained a comma-separated list of IDs, so the variable's datatype is VARCHAR2. As far as you are comparing the NVL-expression to a number, you get "Invalid number" exception, because Oracle is expecting a numeric datatype at the left side of the comparison operator.
    In order to avoid the "Invalid number" exception you can modify the expression using one of the following options:
    :variavel3 IS NULL
    NVL( :variavel3, '*' ) = '*'
    NVL( :variavel3, '0' ) = '0'
    The 1st option if the simplest and the most clear one.
    Dimitar

  • Nees Help: Sql Query

    [http://www.srikanthtechnologies.com/oracle/dec9/hrqueries.html] Learning sql.
    From HR Model : Find employees with the highest salary from each country.
    HR model link is attached.
    Edited by: 999344 on Apr 10, 2013 1:16 PM

    Hi,
    Welcome to the forum!
    999344 wrote:
    Learning sql.
    From HR Model : Find employees with the highest salary from each country.That;s an example of a Top-N Query . Search for "top-n query" and you;ll get lots of examples, such as {message:id=3739578}
    HR model link is attached.Really?

  • Help: SQL query when parsed returns Invalid Identifier error

    Hi The expression posted below is the actual SQL Expression which is required in my report:
    ((select name from (
    select loc_id,name,row_number()over(  order by r)  rn from (
    SELECT 0, loc_id, Misc1_txt  NAME,'A' STATUS ,rownum r
                        FROM dvxloc
                       WHERE loc_id = "XXXLOC"."LOC_ID"
                       union
    SELECT     parent_loc_id, loc_id, (SELECT a.Misc1_txt
                                                         FROM dvxloc a
                                                        WHERE a.loc_id =b.loc_id) NAME,'B' ,ROWNUM
                            FROM dvxlocpath b
                      START WITH b.loc_id = "XXXLOC"."LOC_ID"
                      CONNECT BY PRIOR  parent_loc_id=loc_id
    )                where name is NOT NULL        order by STATUS, R
    ) where rn = 1))
    It gives an error while parsing: "XXXLOC"."LOC_ID" invalid identifier
    LOC_ID is of numeric data type in the database. and when I run thi query in SQL editor after replacing "XXXLOC"."LOC_ID" with a numeric value say 456 . The query can be put as
    ((select name from (
    select loc_id,name,row_number()over(  order by r)  rn from (
    SELECT 0, loc_id, Misc1_txt  NAME,'A' STATUS ,rownum r
                        FROM dvxloc
                       WHERE loc_id = 456                   union
    SELECT     parent_loc_id, loc_id, (SELECT a.Misc1_txt
                                                         FROM dvxloc a
                                                        WHERE a.loc_id =b.loc_id) NAME,'B' ,ROWNUM
                            FROM dvxlocpath b
                      START WITH b.loc_id = 456                  CONNECT BY PRIOR  parent_loc_id=loc_id
    )                where name is NOT NULL        order by STATUS, R
    ) where rn = 1))
    The above query runs flawlessly in a SQL editor. and also this is parsed by the crystal sql expression editer
    I'm totally messed up of looking for altenatives. I have to deliver a report to the client and stuck on this part only.
    The below query parses perfectly in crystal:
    (select locname
    from dvxloc where loc_id in(select loc3 from dvxlocpath
    where loc_id = "XXXLOC"."LOC_ID"))
    Edited by: vipulbhatia29 on May 8, 2009 11:06 AM
    Edited by: vipulbhatia29 on May 8, 2009 11:14 AM

    You said the above works in SQL Editor but does your original work?
    ((select name from (
    select loc_id,name,row_number()over( order by r) rn from (
    SELECT 0, loc_id, Misc1_txt NAME,'A' STATUS ,rownum r
    FROM dvxloc
    WHERE loc_id = "XXXLOC"."LOC_ID"
    union
    SELECT parent_loc_id, loc_id, (SELECT a.Misc1_txt
    FROM dvxloc a
    WHERE a.loc_id =b.loc_id) NAME,'B' ,ROWNUM
    FROM dvxlocpath b
    START WITH b.loc_id = "XXXLOC"."LOC_ID"
    CONNECT BY PRIOR parent_loc_id=loc_id
    ) where name is NOT NULL order by STATUS, R
    ) where rn = 1))
    Crystal does nothing to the SQL in the command editor, what you type in is what we pass.
    What database are you connecting to? And if it has a tracing tool what SQL are you seeing from Crystal when you try to run the report?

  • I need to upgrade my version and can't find help or any other way

    I got a message saying I was using an old and insecure version of firefox. I was directed to click on help. I can't find help.
    When I clicked the free download a message said it didn't exist. Try another version.
    I have been having problems with viruses and would like to clean firefox or load a new version while keeping my homepage.
    I keep hearing firefox is known for not protecting users from viruses.

    When I try to install the free app I get three boxes that seem simple enough to follow EXCEPT the first box opens with 62% downloaded and never changes. When I try to click here it doesn't move. Once it opened the choice of open with or file . When I chose open it went to a bunch of apps that are not related. How do I select what to open it with? Why is it stuck at 62%

  • Please help SQL query

    why this works fine
    SELECT * FROM (
    SELECT ename,deptno,sal ,ROWNUM RN FROM emp)
    WHERE MOD(RN,3)=0
    while
    SELECT rownum FROM employees WHERE MOD(Rownum,3)=0
    wotnh works
    why this happenssssssssssssss

    ROWNUM is dynamically determined on-the-fly during the fetching of results.
    So this works:
    SELECT * FROM table WHERE rownum < 11
    It will return the first 10 rows. The following does not work:
    SELECT * FROM table WHERE rownum between 11 and 20
    As ROWNUM is added as the results are fetched from the database, it can only be used as a stopkey.
    To use ROWNUM as any other column in a predicate, you need to change ROWNUM from a "dynamic on-the-fly" column into a "proper" column. Just as you did with your 1st SELECT.
    E.g.WITH my_results AS(
            SELECT rownum AS RNO, o.* FROM all_objects o WHERE object_type = 'TRIGGER'
    SELECT
            object_id,
            object_name
    FROM    my_results
    WHERE   rno between 11 and 20

  • Need help - sql query

    Hi,
         I have two tables(production & sales). I want to generate monthly statement. The followings are the sample data.
    PRODUCTION:
    DATE          MATERIAL     WEIGHT      AMOUNT
    01/12/2008     Item1     300     6000
    03/12/2008     item2          250      3500
    07/12/2008     item3          700     6500
    12/12/2008     item1          200     4000
    20/12/2008     item3          400     9600
    25/12/2008     item1          250     5000
    Sales:
    SAL_Date          Sal_Material     sal_weight     SAL_Amount
    12/12/2008     item3          270     2300
    15/12/2008     item1          200     4000
    20/12/2008     item2          250     3500
    20/12/2008     item1          100     2000
    23/12/2008     item1          100     2000
    27/12/2008     item3          200     3500
    I want to generate monthly statement like the following....
    Required Report:
    Date          Production          Sales
              Weight - Amount      Weight - Amount          
    01/12/2008     300     6000          0     0
    02/12/2008     0     0     0     0
    03/12/2008     250     3500          0     0           
    04/12/2008     0 0 0 0
    07/12/2008     700 6500 0 0
    12/12/2008     200     4000     270 2300
    31/12/2008 0 0 0 0
    i don't know, how to generate sequential date...
    Could you please tell me the query?
    Thanks & Regards

    SQL> with prod
      2  as
      3  (
      4     select to_date('01/12/2008','dd/mm/yyyy') dt, 'Item1' material, 300 weight, 6000 amount from dual union all
      5     select to_date('03/12/2008','dd/mm/yyyy'), 'item2', 250, 3500 from dual union all
      6     select to_date('07/12/2008','dd/mm/yyyy'), 'item3', 700, 6500 from dual union all
      7     select to_date('12/12/2008','dd/mm/yyyy'), 'item1', 200, 4000 from dual union all
      8     select to_date('20/12/2008','dd/mm/yyyy'), 'item3', 400, 9600 from dual union all
      9     select to_date('25/12/2008','dd/mm/yyyy'), 'item1', 250, 5000 from dual
    10  ), sales
    11  as
    12  (
    13     select to_date('12/12/2008','dd/mm/yyyy') dt, 'item3' material, 270 weight, 2300 amount from dual union all
    14     select to_date('15/12/2008','dd/mm/yyyy'), 'item1', 200, 4000 from dual union all
    15     select to_date('20/12/2008','dd/mm/yyyy'), 'item2', 250, 3500 from dual union all
    16     select to_date('20/12/2008','dd/mm/yyyy'), 'item1', 100, 2000 from dual union all
    17     select to_date('23/12/2008','dd/mm/yyyy'), 'item1', 100, 2000 from dual union all
    18     select to_date('27/12/2008','dd/mm/yyyy'), 'item3', 200, 3500 from dual
    19  ),find_date
    20  as
    21  (
    22     select dt st, last_day(dt) ed
    23       from (select distinct trunc(dt,'month') dt from prod
    24             union
    25             select distinct trunc(dt,'month') dt from sales)
    26  ),day_list
    27  as
    28  (
    29     select (level-1)+st dt
    30       from find_date
    31     connect by level <= (ed - st)+1
    32  )
    33  select d.dt, t.p_weight, t.p_amount, t.s_weight, t.s_amount
    34    from day_list d
    35    left join
    36         (select decode(p.dt,null,s.dt,p.dt) dt,
    37                    sum(p.weight) p_weight, sum(p.amount) p_amount, sum(s.weight) s_weight, sum(s.amount) s_amount
    38            from prod p
    39            full outer join sales s
    40              on p.dt = s.dt
    41             and p.material = s.material
    42           group by decode(p.dt,null,s.dt,p.dt)) t
    43      on d.dt = t.dt
    44  order by d.dt
    45  /
    DT          P_WEIGHT   P_AMOUNT   S_WEIGHT   S_AMOUNT
    01-DEC-08        300       6000
    02-DEC-08
    03-DEC-08        250       3500
    04-DEC-08
    05-DEC-08
    06-DEC-08
    07-DEC-08        700       6500
    08-DEC-08
    09-DEC-08
    10-DEC-08
    11-DEC-08
    DT          P_WEIGHT   P_AMOUNT   S_WEIGHT   S_AMOUNT
    12-DEC-08        200       4000        270       2300
    13-DEC-08
    14-DEC-08
    15-DEC-08                              200       4000
    16-DEC-08
    17-DEC-08
    18-DEC-08
    19-DEC-08
    20-DEC-08        400       9600        350       5500
    21-DEC-08
    22-DEC-08
    DT          P_WEIGHT   P_AMOUNT   S_WEIGHT   S_AMOUNT
    23-DEC-08                              100       2000
    24-DEC-08
    25-DEC-08        250       5000
    26-DEC-08
    27-DEC-08                              200       3500
    28-DEC-08
    29-DEC-08
    30-DEC-08
    31-DEC-08
    31 rows selected.

  • Help - Sql query

    Hi All,
    I have a table which has data as given below...
    trans_amt
    2000
    4000
    2000
    -1000
    -1000
    -3000
    -1000
    -500
    i want output like
    prior_amt trans_amt post_amt
    null 2000 2000
    2000 4000 6000
    6000 2000 8000
    8000 -1000 7000
    7000 -1000 6000
    6000 -3000 3000
    3000 -1000 2000
    2000 -500 1500
    how can i get the output ?
    Thanks
    kt

    Hi,
    Try
    WITH TAB AS
    (select     2000 VAL     from dual union all
    select     4000     from dual union all
    select     2000     from dual union all
    select     -1000     from dual union all
    select     -1000     from dual union all
    select     -3000     from dual union all
    select     -1000     from dual union all
    select     -500     from dual
    SELECT LAG(VAL,1) OVER (ORDER BY SRN)PREV_VAL, VAL,NVL(LAG(VAL,1) OVER (ORDER BY SRN),0)+ VAL SUM_VAL
    FROM (SELECT VAL, ROWNUM SRN
    FROM TAB) TAB;
    PREV_VAL     VAL     SUM_VAL
         2000     2000
    2000     4000     6000
    4000     2000     6000
    2000     -1000     1000
    -1000     -1000     -2000
    -1000     -3000     -4000
    -3000     -1000     -4000
    -1000     -500     -1500*009*
    Edited by: 009 on Mar 15, 2010 4:12 AM
    Disclaimer: wait don't use it yet!!!
    Edited by: 009 on Mar 15, 2010 4:15 AM

Maybe you are looking for

  • DTP not getting displayed in Transported Objects in Quality System

    We are Tranporting all the CRM Master Data but no DTP AND IP are getting displayed in Quality system is there any setting to make to transport these or get it displayed. Please help Thanks Soniya

  • Any way to format text in xml

    hi guys, I have a photogallery done in flash. Its having a external xml file where the descriptions and image location is defined. Is there any way to add font color , font size , and all other font formating options inside the xml file to take effec

  • Sales order with reference of a Quotation

    Hi all, When I create a sales order (OR) with reference of a Quotation (QT), the Sold-to party of the sales order is not editable. How can I make it editable (sometime I need to change it)? Thanks in advance. Ricard.

  • USB External drive for PC & Mac Via Home Hub 2

    Hi Guys, I have a home hub 2.0, I also have a 1TB External USB drive, I have connected the drive to the USB port on my Hub and I can see the drive on my pc, wirelessly (Windows 7), I know nothing abouy MAC's, but my wife has one and it would be great

  • Palm Pre v1.40 PDF viewer problem

    Since I installed this update, my PDF reader doesn't function properly.  Either it doesn't open the document, or it opens it to fit the page, too small to read, and the resizing feature doesn't work.  If I go to the open selection on the menu, all it