The rows of a query become columns

Hi , everybody
I have an aggregated query . The format of the result is :
COL1 COL2 COL3
==== ==== ====
VAL1 1800 CVAL1
VAL1 780 CVAL2
VAL1 800 CVAL3
VAL2 3450 CVAL2
VAL2 890 CVAL3
e.t.c.
I want ,the quicker way, the format of the result to be as follows (regarding the above sample data):
COL1 CVAL1 CVAL2 CVAL3
==== ==== ===== ======
VAL1 1800 780 800
VAL2 3450 890
In other words , I want the each value in COL1 appear just one time and the data in other columns to be developed ...as columns
Thanks , Simon

Hi,
This will help.
ABANSVI@CTSQA>SELECT * FROM TEST;
COL1             COL2 COL3
VAL1             1800 CVAL1
VAL1              780 CVAL2
VAL1              800 CVAL3
VAL2             3450 CVAL2
VAL2              890 CVAL3
Elapsed: 00:00:00.47
ABANSVI@CTSQA>SELECT COL1,
  2  MAX(DECODE(COL3, 'CVAL1', SM, NULL)) CVAL1,
  3  MAX(DECODE(COL3, 'CVAL2', SM, NULL)) CVAL2,
  4  MAX(DECODE(COL3, 'CVAL3', SM, NULL)) CVAL3
  5  FROM (
  6  SELECT COL1, COL3, SUM(COL2) SM FROM TEST
  7  GROUP BY COL1, COL3)
  8  GROUP BY COL1;
COL1            CVAL1      CVAL2      CVAL3
VAL1             1800        780        800
VAL2                        3450        890
Elapsed: 00:00:00.34Vineet

Similar Messages

  • How to disable (or) Hide the UDF Field in the Row level through Query

    Hi suda,
    thanks for your reply. i also want to know the formatted search query for the UDF present in the row level, i want to hide that also.so pls msg me the query.
    i have written as N$[item.column.row] but it is not working,so keep me posted if your query that works well.
    Regards
    Magesh.

    Magesh,
    I just saw your other messages...
    Go to Tools > User defined fields > Manage User Fields   --  Under Marketing Documents > Rows  check the field name here.
    Then go the Form itself and Click on Form Settings Icon or Click CTRLSHIFTS or Tools > Form Settings and from the Table format Tab make your changes..
    Good luck
    Suda

  • Determining the row id or primary key columns and values genericaly

    Hi There
    Does anyone perhaps know how to determine the rowid of the
    currently selected row in a form, or alternatively the primary
    key values/columns?
    Regards
    Herman

    Hi Tranen,
    you can view the constraints and respective columns by setting the
    Table Shape Properties in the Property Inspector.
    Select (all) the tables on the Diagram you want
    In the Property Inspector,under Constraints -Set the 'Show Constraint Columns' to 'True',
    Set 'Show Constraints' to 'True' .
    Constraints (PK,UK,FK,Check)
    Also Set the 'Show Columns' option to 'False' .This will be under display options in the Property inspector.
    This should modify the Table shape in the diagram as follows:
    <Table name>
    <PK> PKName:Column1,Column2
    <UK>UKName:Column3
    <FK>FKname:Column1
    are you looking for the same?
    Thanks.

  • Repeat all the rows in a query?

    Hi,
    i have a query with 5 chars and one Key figure, i want to repeat all the values of my chars in the report, of this way i can represent all the values, in this moments when i execute, the report resume if the first char is going to be repeateda value, just appear one time until the value of this char change to another, i understand that the report do this to dont repeat a value when this is going to be the same, but in this problem i need it, how can i do it?, help

    Hi,
    Query properties -> Uncheck Hide repeated Key values...
    i did it, but is the same, this hide the repeated values example,
    apple   a
              b
              c
    Pear   a
              b
              c
    and i want
    apple   a
    apple   b
    apple   c
    Pear   a
    Pear    b
    Pear    c
    help guys..

  • TO Display the row data as column in ALV

    Hi experts ,
    Need to display the row data in ALV as column.
    The column of an ALV has the fieldnames of a table , this needs to be displayed as row data , that is as single row.
    How can this can be achieved?

    Hi,
    Actually it is not possible to disaply in multiple lines.
    https://www.sdn.sap.com/sdn/collaboration.sdn?contenttype=url&content=https%3A//forums.sdn.sap.com/thread.jspa%3FforumID%3D50%26threadID%3D49517%26messageID%3D506378%23506378
    https://www.sdn.sap.com/sdn/collaboration.sdn?contenttype=url&content=https%3A//forums.sdn.sap.com/thread.jspa%3FforumID%3D50%26threadID%3D41133%26messageID%3D403371%23403371
    This problem was discussed many times in this forum, u can search for more results.

  • Calculating the row number with DAX

    Hello,
    Can somebody help me to obtain the row number in a calculated column using DAX (PowerPivot 2013) ?
    I do not have any column that would contain unique values (would be easy in that case !). I just want to obtain a different value in each row.
    Thank you.

    Hi DP17000,
    According to your description, you need to add a column with the RowNumber to your Pivot table by using DAX, right?
    Based on my tested, we can use a ranks function to achieve your requirement.
    =RANKX(case0305,[amount],[amount],0,dense)
    Reference
    https://msdn.microsoft.com/en-us/library/gg492185.aspx?f=255&MSPPError=-2147217396
    http://ayadshammout.com/2013/02/19/dax-rankx-function-scenarios/
    Regards,
    Charlie Liao
    TechNet Community Support

  • Change of Row Property during query execution possible?

    Hello Experts,
    is it possible to change the row property during query execution?
    In the case an input ready IP query can be executed for different customers. Depending on the customer class (attribute of customer), a certain row (containing account data) should be input ready or only be shown, but not input ready.
    How can this be achieved?
    Thank you!
    Angie

    Hi Angie,
      To determine the input readiness at  Run time based on the master data value of a particular characteristic value (In your case Customer),
    you can create data slice of type exit .
    The data slice is based on an exit class. In the exit class, you can implement a customer-specific logic to protect data records.
    Please refer to http://help.sap.com/saphelp_nw2004s/helpdata/en/43/0c033316cd2bc4e10000000a114cbd/frameset.htm
    for more information.
    By using this, the required rows will be shown but not input ready ( As per your requirement)
    Hope this info helps. Or do let us know !!
    Best regards,
    Akshata

  • Grouping rows from a query

    Hi everyone!
    I want to know if it's posible to group the rows from a query into a unique row. Example:
    SELECT Field_1 FROM Table_1
    Returns the following fileds:
    Field_1
    A
    B
    C
    D
    I would want to modify my query so that the result obtained would be a single row containing all the others. In the previous example the result would be "ABCD".
    Thanks in advance. Best regards,

    -- For anyone who wants to test this,
    -- just copy this entire post as is,
    -- save it to a .sql file, then start that file.
    -- Before doing this,
    -- make sure that you don't already have
    -- a table named table_1 that would be dropped
    -- or a .sql file named query.sql that would be overwritten.
    -- If you do, then change the names below to avoid any conflicts.
    -- In order to understand what the code is doing,
    -- please read all of the comments included in this file,
    -- as not everything is displayed when you run it.
    -- I have gone into great detail with this
    -- because I have posted similar things before
    -- and a lot of people have total missed the fact
    -- that it is not a static query,
    -- that the results are dependent upon the number of rows,
    -- and that it works for any number of rows,
    -- even when the number of rows is unknonwn.
    -- test data:
    DROP TABLE table_1
    CREATE TABLE table_1
      (field_1 VARCHAR2 (1))
    INSERT INTO table_1 (field_1)
    VALUES ('A')
    INSERT INTO table_1 (field_1)
    VALUES ('B')
    INSERT INTO table_1 (field_1)
    VALUES ('C')
    INSERT INTO table_1 (field_1)
    VALUES ('D')
    COMMIT
    SELECT * FROM table_1
    -- Running the code below will create and start
    -- a file named query.sql which will contain the query below,
    -- which will produce the results below that:
    -- query that will be created:
    -- SELECT MAX(DECODE(ROWNUM,1,field_1,NULL))                                      
    -- ||MAX(DECODE(ROWNUM,2,field_1,NULL))                                           
    -- ||MAX(DECODE(ROWNUM,3,field_1,NULL))                                           
    -- ||MAX(DECODE(ROWNUM,4,field_1,NULL))                                           
    -- FROM table_1 GROUP BY NULL;                                                    
    -- results that will be produced:
    -- ABCD
    -- Notice that in this example,
    -- there are only four values concatenated
    -- because there are only four rows in the table. 
    -- If there were more rows, it would concatenate more values. 
    -- The number of concatenated values
    -- is dependent upon the number of rows.
    -- The following dynamic sql uses a single query,
    -- which produces and executes a single query,
    -- whose number of concatenated values is dependent
    -- upon the number of rows in the table.
    -- Because the echo is set off in the first line,
    -- you won't see this code when you run it,
    -- just the query that it creates.
    SET     ECHO OFF FEEDBACK OFF HEADING OFF PAGESIZE 0 VERIFY OFF
    SPOOL   query.sql
    -- This is the start of the single query:
    SELECT  text
    FROM    (SELECT 1                                             AS orderby,
                    'SELECT MAX(DECODE(ROWNUM,1,field_1,NULL))'   AS text
             FROM   DUAL
             UNION
             -- This section is the part that dynamically creates
             -- one additional concatenated value
             -- for each additional row after the first row.
             -- This is just a subquery within the single query.
             SELECT rn                                            AS orderby,
                    '||MAX(DECODE(ROWNUM,'||rn||',field_1,NULL))' AS text
             FROM   (SELECT ROWNUM rn
                     FROM   table_1)
             WHERE  rn > 1
             UNION
             SELECT COUNT (*) + 1                                  AS orderby,
                    'FROM table_1 GROUP BY NULL;'                  AS text
             FROM   table_1)
    ORDER BY orderby;
    -- This is the end of the single query.
    SPOOL    OFF
    START    query
    SET      ECHO ON
    -- If you want to see the file containing
    -- the single query that was created, then just:
    -- SQL> EDIT query.sql

  • How to increase the row and Column length of Bex query in EP Portal 7.3

    Dear All,
    Please let me know the process  to Increase the Rows and Columns  Size of Bex Query in Enterprise Portal  of SAP  7.3 .
    Please  let settings to increase rows up 10000 and column 100 in one page.
    Thanks
    Regards,
    Sai

    Dear All,
    Please find the attached screen shot.
    The report be open with 4 or 5 columns and 5 or 6 rows.
    So, please  let me know how to increase the length of the table.
    Do the needful for me to over come this issue.
    Thanks
    Regards,
    Sai.

  • How to Increase the Rows and Columns Size of Bex Query in Enterprise Portal  of SAP  7.3

    Dear All,
    Please let me know the process how to Increase the Rows and Columns  Size of Bex Query in Enterprise Portal  of SAP  7.3 .
    Currently I am getting Only  4 columns and 10 rows in One Page .And I am getting 1,2 etc tabs for both row and column. So i want to increase the column length more than 100  and row length more than 10000.
    Please suggest me a suitable solution to over come this issue.
    Please find the Below screen shot.
    Thanks
    Regards,
    Sai

    Dear All,
    Please find the attached screen shot.
    The report be open with 4 or 5 columns and 5 or 6 rows.
    So, please  let me know how to increase the length of the table.
    Do the needful for me to over come this issue.
    Thanks
    Regards,
    Sai.

  • How to get the rows from a table having some column has any letter

    Hi All,
    suppose i have a table having columns id(number), code(varchar).
    code has alphanumeric characters (ex. ABC123, 67B56 etc).
    some codes are only numbers (2344, 7898 etc).
    how can i get the rows which have alphabets in the code.
    ex:
    id code
    1 AB45
    2 456
    3 890
    4 67B7
    how can i write a query such that it should give me the ids 1 and 4 (as they have alphabets in code)
    thanks in advance to all

    Thanks to one and all.
    i am gettig my required output.
    But i have a doubt in the operator.
    If i add or remove '[]' in the operator, i am getting different ouputs.
    There is a count difference in the result of the operators used.
    REGEXP_LIKE(<column>,'[[:lower:]]')
    REGEXP_LIKE(<column>,'[[[:lower:]]]')
    REGEXP_LIKE(<column>,'[:lower:]')
    Can anybody please explain what is the difference in using '[]', in the operator?
    What is the correct syntax, whether i have to use two '[]'s or one '[]'.
    Also, can i use REGEXP_LIKE() in oracle 8i version.( I am unable to use the operator in 8i)?
    Any query to get the required output in 8i version?
    Thanks in advance to all.

  • How to display the rows number of times by giving the column values?

    Hi All,
    I want to display the rows number of times as the value exists in num column in the below query
    with t AS
       ( SELECT 'venkatesh' NAME, 'hyd' LOC, 2 NUM FROM DUAL
         UNION ALL
         SELECT 'prasad' NAME, 'hyd' LOC, 3 NUM FROM DUAL
         UNION ALL
         SELECT 'krishna' NAME,     'hyd' LOC, 1 NUM FROM DUAL )
      SELECT T.* FROM T
      CONNECT BY ROWNUM <= NUM
    Expected output:
             venkatesh            hyd      2
             venkatesh            hyd        2
             prasad                 hyd        3
             prasad                   hyd      3
             prasad                   hyd      3
             krishna           hyd       1Edited by: Nag Aswadhati on Nov 1, 2012 12:34 AM

    Nag Aswadhati wrote:
    Hi All,
    I want to display the rows number of times as the value exists in num column in the below query
    Expected output:
    venkatesh            hyd      2
    venkatesh            hyd        2
    prasad                 hyd        3
    prasad                   hyd      3
    prasad                   hyd      3
    krishna           hyd       1Using Connect By:-
    with t AS
       ( SELECT 'venkatesh' NAME, 'hyd' LOC, 2 NUM FROM DUAL
         UNION ALL
         SELECT 'prasad' NAME, 'hyd' LOC, 3 NUM FROM DUAL
         UNION ALL
         select 'krishna' name,     'hyd' loc, 1 num from dual )
      select t.name, t.loc
      from t
      connect by level <= num
             and name = prior name
             and (prior sys_guid() is not null);
    NAME      LOC
    krishna   hyd
    prasad    hyd
    prasad    hyd
    prasad    hyd
    venkatesh hyd
    venkatesh hyd
    6 rows selected

  • Access to the Row Number in a Query Result

    Hi everyone! I have this query:
    select s.cod_score, ROW_NUMBER() OVER (ORDER BY s.cod_score) AS num
    from score s
    where s.categoria.cod_categoria='001' and s.gara.cod_gara='25251';
    that returns:
    COD_SCORE | NUM
    00001     1
    00002     2
    00007     3
    00009     4
    00014     5
    Now i want to display only the row with NUM='1', but how can i do that? I try with this:
    select s.cod_score, ROW_NUMBER() OVER (ORDER BY s.cod_score) AS num
    from score s
    where s.categoria.cod_categoria='001' and s.gara.cod_gara='25251' and num=1;
    but it tells me "%s: invalid identifier". How can i do?
    Thanks in advance :)

    986747 wrote:
    Thanks everyone :) Now if i want to use the result of that query in an UPDATE how can i do? I try with this:
    update score set posizione = '(first,1)' where score.golfista.n_tessera=(
    select golf
    from (select s.golfista.n_tessera as golf, ROW_NUMBER() OVER (ORDER BY s.cod_score) AS num
    from score s
    where s.categoria.cod_categoria='001' and s.gara.cod_gara='25251')
    where num=1);
    But it tells me that "SCORE"."GOLFISTA"."N_TESSERA" is an invalid identifier. Why? It is the primary key of the table golfista which has a REF in score...Hi,
    what is the structure of table SCORE?
    SCORE.GOLFISTA identifies a column. But SCORE.GOLFISTA.N_TESSERA seems not to be a valid value.
    Please read SQL and PL/SQL FAQ
    Whenever you ask a question post sample data (CREATE TABLE and INSERT statements) for a small significant amount of data.
    Post the logic of your process and the expected output.
    Additionally when you put some code or output please enclose it between two lines starting with {noformat}{noformat}
    i.e.:
    {noformat}{noformat}
    SELECT ...
    {noformat}{noformat}
    Regards.
    Al
    Edited by: Alberto Faenza on Feb 13, 2013 4:33 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Query from oracle to MySql using dblink fetch all the rows in MySql table

    Hello,
    I am using Heterogeneous connectivity between oracle 10204 to Mysql database.
    I have a database link in the oracle side .
    I am query a table in MySql that have 10 million rows.
    Its doesnt matter if i am running :
    select * from "CDR_Accounts"@mysql where "id"=7675405;
    or
    select * from "CDR_Accounts"@mysql ;
    There is an index on the id column.
    Yet, it seems that the Mysql is feteching all the rows from the table , all the data is transfering to oracle over the dblink , and only after that the requested rows are get back to the client.
    The /etc/odbcinst.ini file is as follow:
    [odbcprd:oracle@odbc /software/oracle]$ cat /etc/odbcinst.ini
    [myodbc3]
    Description             = Mysql connector to mysql version 3.5
    Driver          = /software/oracle/MysqlOdbc/3.52/lib/libmyodbc3-3.51.25.so
    Driver64                = /usr/lib
    Setup           = /software/oracle/MysqlOdbc/3.52/lib/libmyodbc3S-3.51.25.so
    Setup64         = /usr/lib
    UsageCount              = 1
    CPTimeout               = 3600
    CPReuse         = Please advice
    Thanks

    When using a gateway it is always possible that a where clause is not sent to the remote database. This is called post processing and depends on several factors like the used ODBC driver, the columns and its data types but also if you specify certain functions in the where clause.
    The fastest way to see if post processing happens is in Oracle 11g the explain plan for a query. In 10g the plan does not always match the statement sent to the foreign database. Here it would be better to enable gateway tracing and setting the trace level to ON. This will log the statements sent to the foreign database and you can compare what statement was sent with the statement you've tried to execute.

  • How to make every break column on the top of the rows in the same subgroup

    hi, guys:
    I was wondering if anyone could help me on this problem: I need to set up a break column on a classic report (I ma required to use classic report only), and it works, but I do not know how to make every break column on the top of the rows in the same subgroup. The break column only stays on the left to the rest columns as it is the first column. Anyone could help me on this problem? Here is the query:
    select so.doc_number as "DOC Number", so.offender_id as "Offender ID", so.first_name||' '|| so.middle_name||' '||so.last_name as "Offender Name",
    (select sc1.description from sor_code sc1 where sc1.code_id=so.race) as "Race",
    (select sc2.description from sor_code sc2 where sc2.code_id=so.sex) as "Sex",
    replace(replace(nvl2(sl.address1, sl.address1||' '||sl.address2 ||' '||sl.city ||' '||sl.county||' '||(select sc3.description from sor_code sc3 where sc3.code_id=sl.state)||' '||sl.zip, 'No Known Address'),'#'),',') as "Address",
    (select sof.name||'   '||sof.phone1||'   '||sof.link from sor_offices sof where sof.office_id=sl.jurisdiction) as "Jurisidiction",
    decode(rox.habitual, 'Y', 'Habitual', '') as "Habitual",
    decode(rox.aggravated, 'Y', 'Aggravated', '') as "Aggravated",
    floor(to_number(sysdate-so.date_of_birth)/365) as "Age"
    from sor_location sl, sor_offender so, registration_offender_xref rox, sor_last_locn_v sllv
    where rox.offender_id=so.offender_id
    and sllv.offender_id(+)=so.offender_id
    and sl.location_id(+)=sllv.location_id
    and rox.status not in ('Merged')
    and rox.reg_type_id=1
    and upper(rox.status)='ACTIVE'
    and nvl(rox.admin_validated, to_date(1,'J'))>=nvl(rox.entry_date, to_date(1,'J'))
    and ((so.first_name is not null and upper(so.first_name) like '%'||upper(:P5_TF_FIRST_NAME)||'%') or (:P5_TF_FIRST_NAME is null))
    and ((so.last_name is not null and upper(so.last_name) like '%'||upper(:P5_TF_LAST_NAME)||'%') or (:P5_TF_LAST_NAME is null))
    and ((sl.address1||sl.address2 is not null and upper(sl.address1|| sl.address2) like '%'||upper(:P5_TF_ADDRESS)||'%')or (:P5_TF_ADDRESS is null))
    and ((sl.city is not null and upper(sl.city) like '%'||upper(:P5_TF_CITY)||'%')or (:P5_TF_CITY is null))
    and ((sl.county is not null and sl.county =:P5_SL_COUNTY)or (:P5_SL_COUNTY is null))
    and (((select sc5.description from sor_code sc5 where sc5.code_id=sl.state and sc5.description=:P5_SL_STATE) is not null )or (:P5_SL_STATE is null))
    and ((sl.zip is not null and sl.zip =:P5_TF_ZIP_CODE)
    or (:P5_TF_ZIP_CODE is null))
    union
    select so.doc_number as "DOC Number", so.offender_id as "Offender ID", so.first_name||' '|| so.middle_name||' '||so.last_name as "Offender Name",
    (select sc1.description from sor_code sc1 where sc1.code_id=so.race) as "Race",
    (select sc2.description from sor_code sc2 where sc2.code_id=so.sex) as "Sex",
    replace(replace(nvl2(sl.address1, sl.address1||' '||sl.address2 ||' '||sl.city ||' '||sl.county||' '||(select sc3.description from sor_code sc3 where sc3.code_id=sl.state)||' '||sl.zip, 'No Known Address'),'#'),',') as "Address",
    (select sof.name||'   '||sof.phone1||'   '||sof.link from sor_offices sof where sof.office_id=sl.jurisdiction) as "Jurisidiction",
    decode(rox.habitual, 'Y', 'Habitual', '') as "Habitual",
    decode(rox.aggravated, 'Y', 'Aggravated', '') as "Aggravated",
    floor(to_number(sysdate-so.date_of_birth)/365) as "Age"
    from sor_location sl, sor_offender so, registration_offender_xref rox, sor_last_locn_v sllv
    where rox.offender_id=so.offender_id
    and sllv.offender_id(+)=so.offender_id
    and sl.location_id(+)=sllv.location_id
    and rox.status not in ('Merged')
    and rox.reg_type_id=1
    and upper(rox.status)='ACTIVE'
    and nvl(rox.admin_validated, to_date(1,'J'))>=nvl(rox.entry_date, to_date(1,'J'))
    and ((so.first_name is not null and upper(so.first_name) like '%'||upper(:P5_TF_FIRST_NAME)||'%') or (:P5_TF_FIRST_NAME is null))
    and ((so.last_name is not null and upper(so.last_name) like '%'||upper(:P5_TF_LAST_NAME)||'%') or (:P5_TF_LAST_NAME is null))
    and ((sl.physical_address1 is not null and upper(sl.physical_address1) like '%'||upper(:P5_TF_ADDRESS)||'%') or (:P5_TF_ADDRESS is null))
    and ((sl.physical_city is not null and upper(sl.physical_city) like '%'||upper(:P5_TF_CITY)||'%') or (:P5_TF_CITY is null))
    and ((sl.physical_county is not null and sl.physical_county =:P5_SL_COUNTY) or (:P5_SL_COUNTY is null))
    and (((select sc5.description from sor_code sc5 where sc5.code_id=sl.physical_state and sc5.description=:P5_SL_STATE) is not null )or (:P5_SL_STATE is null))
    and ((sl.physical_zip is not null and sl.physical_zip =:P5_TF_ZIP_CODE) or (:P5_TF_ZIP_CODE is null))
    union
    select so.doc_number as "DOC Number", so.offender_id as "Offender ID", so.first_name||' '|| so.middle_name||' '||so.last_name as "Offender Name",
    (select sc1.description from sor_code sc1 where sc1.code_id=so.race) as "Race",
    (select sc2.description from sor_code sc2 where sc2.code_id=so.sex) as "Sex",
    replace(replace(nvl2(sl.address1, sl.address1||' '||sl.address2 ||' '||sl.city ||' '||sl.county||' '||(select sc3.description from sor_code sc3 where sc3.code_id=sl.state)||' '||sl.zip, 'No Known Address'),'#'),',') as "Address",
    (select sof.name||'   '||sof.phone1||'   '||sof.link from sor_offices sof where sof.office_id=sl.jurisdiction) as "Jurisidiction",
    decode(rox.habitual, 'Y', 'Habitual', '') as "Habitual",
    decode(rox.aggravated, 'Y', 'Aggravated', '') as "Aggravated",
    floor(to_number(sysdate-so.date_of_birth)/365) as "Age"
    from sor_location sl, sor_offender so, registration_offender_xref rox, sor_last_locn_v sllv, sor_alias sa
    where rox.offender_id=so.offender_id
    and sa.offender_id=so.offender_id
    and sllv.offender_id(+)=so.offender_id
    and sl.location_id(+)=sllv.location_id
    and rox.status not in ('Merged')
    and rox.reg_type_id=1
    and upper(rox.status)='ACTIVE'
    and nvl(rox.admin_validated, to_date(1,'J'))>=nvl(rox.entry_date, to_date(1,'J'))
    and ((sa.first_name is not null and upper(sa.first_name) like '%'||upper(:P5_TF_FIRST_NAME)||'%') or (:P5_TF_FIRST_NAME is null))
    and ((sa.last_name is not null and upper(sa.last_name) like '%'||upper(:P5_TF_LAST_NAME)||'%') or (:P5_TF_LAST_NAME is null))
    and ((sl.address1||sl.address2 is not null and upper(sl.address1|| sl.address2) like '%'||upper(:P5_TF_ADDRESS)||'%')or (:P5_TF_ADDRESS is null))
    and ((sl.city is not null and upper(sl.city) like '%'||upper(:P5_TF_CITY)||'%')or (:P5_TF_CITY is null))
    and ((sl.county is not null and sl.county =:P5_SL_COUNTY)or (:P5_SL_COUNTY is null))
    and (((select sc5.description from sor_code sc5 where sc5.code_id=sl.state and sc5.description=:P5_SL_STATE) is not null )or (:P5_SL_STATE is null))
    and ((sl.zip is not null and sl.zip =:P5_TF_ZIP_CODE)or (:P5_TF_ZIP_CODE is null))
    union
    select so.doc_number as "DOC Number", so.offender_id as "Offender ID", so.first_name||' '|| so.middle_name||' '||so.last_name as "Offender Name",
    (select sc1.description from sor_code sc1 where sc1.code_id=so.race) as "Race",
    (select sc2.description from sor_code sc2 where sc2.code_id=so.sex) as "Sex",
    replace(replace(nvl2(sl.address1, sl.address1||' '||sl.address2 ||' '||sl.city ||' '||sl.county||' '||(select sc3.description from sor_code sc3 where sc3.code_id=sl.state)||' '||sl.zip, 'No Known Address'),'#'),',') as "Address",
    (select sof.name||'   '||sof.phone1||'   '||sof.link from sor_offices sof where sof.office_id=sl.jurisdiction) as "Jurisidiction",
    decode(rox.habitual, 'Y', 'Habitual', '') as "Habitual",
    decode(rox.aggravated, 'Y', 'Aggravated', '') as "Aggravated",
    floor(to_number(sysdate-so.date_of_birth)/365) as "Age"
    from sor_location sl, sor_offender so, registration_offender_xref rox, sor_last_locn_v sllv, sor_alias sa
    where rox.offender_id=so.offender_id
    and sa.offender_id=so.offender_id
    and sllv.offender_id(+)=so.offender_id
    and sl.location_id(+)=sllv.location_id
    and rox.status not in ('Merged')
    and rox.reg_type_id=1
    and upper(rox.status)='ACTIVE'
    and nvl(rox.admin_validated, to_date(1,'J'))>=nvl(rox.entry_date, to_date(1,'J'))
    and ((sa.first_name is not null and upper(sa.first_name) like '%'||upper(:P5_TF_FIRST_NAME)||'%') or (:P5_TF_FIRST_NAME is null))
    and ((sa.last_name is not null and upper(sa.last_name) like '%'||upper(:P5_TF_LAST_NAME)||'%') or (:P5_TF_LAST_NAME is null))
    and ((sl.physical_address1 is not null and upper(sl.physical_address1) like '%'||upper(:P5_TF_ADDRESS)||'%') or (:P5_TF_ADDRESS is null))
    and ((sl.physical_city is not null and upper(sl.physical_city) like '%'||upper(:P5_TF_CITY)||'%') or (:P5_TF_CITY is null))
    and ((sl.physical_county is not null and sl.physical_county =:P5_SL_COUNTY) or (:P5_SL_COUNTY is null))
    and (((select sc5.description from sor_code sc5 where sc5.code_id=sl.physical_state and sc5.description=:P5_SL_STATE) is not null )or (:P5_SL_STATE is null))
    and ((sl.physical_zip is not null and sl.physical_zip =:P5_TF_ZIP_CODE) or (:P5_TF_ZIP_CODE is null))I set up "Jurisdiction" to be displayed as the first column in report attributes and set up the first column to be break column, under the "When displaying a break column use this format, use #COLUMN_VALUE# subs", I fill in "Jurisdiction".

    lxiscas wrote:
    Hi, fac586:
    I am sorry for not being able to provide project online oracle to ask the question as some of the data needs to be approved to release.You don't need to use the actual data. Create simple test cases using data from Oracle's sample schemas: SCOTT, OE, HR etc.
    I actually want something like this:
    Jurisdiction: Bartlesville Police Department, 918-338-4001, http://www.cityofbartlesville.org/departments/police/
    Smith , Carl Sherman      ......
    Smith , Tommy Nesby .....
    Jurisdiction: Canadian County Sheriff's Office, 405-262-4787, Fax - 405-422-2430
    Smith , Gabriel Ray      ...
    Smith , Michael Bert   ...I omit the sensitive data with ...
    but right now it shows as this way:
    Jurisdiction: Bartlesville Police Department, 918-338-4001, http://www.cityofbartlesville.org/departments/police/  Smith , Carl Sherman      ......
    Smith , Tommy Nesby .....
    Jurisdiction: Canadian County Sheriff's Office, 405-262-4787, Fax - 405-422-2430   Smith , Gabriel Ray      ...
    Smith , Michael Bert   ...Is that possible to show the data as the upper way?The best way to do this is using a report with a custom named column template as in this example. See the following threads for solutions to similar problems:
    <li>{thread:id=2402836}
    <li>{message:id=9816577}

Maybe you are looking for

  • System User Problems +

    My G5 is having issues and I can't seem to get things back up to normal operation. A short while ago, users under my admin became unable to access our printer. I thought it was a printer issue only, but now users cannot burn CD's. As the users are my

  • Different database structure, same application

    Hello, my database struture must change (this is a requierement), it has more than 400 objects (tables, columns, views). Some objects changed their name, and some were added, others were deleted. Is there any tool that can help me to change automatic

  • Headphones out after update.

    I just updated the software on my Ipod touch (5/17) and now the headphones no longer work. I have tested the headphones on my apple laptop and they work fine and I have tried a different set of headphones but still no luck. I have shut down the ipod

  • Imac camera is static can't see pic at all

    tried restarting and used facetime and photobooth and skype and all same result. can see outline of me in pic but is all static like tv with bad antenna. cant find fix. It always did work good but just noticed yesterday that it isnt now.

  • Using Command Line to move objects from one environment to another enviroment

    Can the Command Line (sacmd) be used to move Job Groups/Jobs and other object from one environment to another environment? If so, how?