Sql help for columns to rows

Hi all,
Here is my requirement for reporting purpose…….
Can you please help me? See below example.
with t as (select 1 id, 'missing' col1,'expired' col2,'duplicate' col3,'other' col4 from dual union all
select 2 id, 'missing' col1,'expired' col2,'duplicate' col3,'other' col4 from dual
select * from t
id     col1          col2          col3          col4
1     missing     expired     duplicate     other
2     missing     expired     duplicate     other
Required out is
id new_col
1 missing
1 expired
1 duplicate
1 other
2 missing
2 expired
2 duplicate
2 other
Thanks in advance,

Isn't fun to play around and see what happens?
WITH t AS
  (SELECT 1 id,
    'missing' col1,
    'expired' col2,
    'duplicate' col3,
    'other' col4
  FROM dual
  UNION ALL
  SELECT 2 id,
    'missing' col1,
    'expired' col2,
    'duplicate' col3,
    'other' col4
  FROM dual
SELECT id,
  new_col
FROM t unpivot include nulls (new_col FOR col IN (col1, col2, col3, col4));gives
ID                     NEW_COL  
1                      missing  
1                      expired  
1                      duplicate
1                      other    
2                      missing  
2                      expired  
2                      duplicate
2                      other    
8 rows selectedNow this only works in 11g, so it's a great reason to get there.
-Andy

Similar Messages

  • Java.sql.SQLException: Invalid SQL type for column

    Hi guys!
    We are migrating from TOMCAT to WebLogic and we are getting the following error:
    java.sql.SQLException: Invalid SQL type for column
         at javax.sql.rowset.RowSetMetaDataImpl.checkColType(RowSetMetaDataImpl.java:94)
         at javax.sql.rowset.RowSetMetaDataImpl.setColumnType(RowSetMetaDataImpl.java:439)
         at      .initMetaData(CachedRowSetImpl.java:743)
         at com.sun.rowset.CachedRowSetImpl.populate(CachedRowSetImpl.java:621)
    In TOMCAT environment rowset.jar is in common/endorsed directory. Need I to put rowset.jar at any specific location?
    Thanks.
    Best regards

    Hi!
    We are using WebLogic 11g (10.3.2). We know about datasource configuration, but for now we are justing migrating from Tomcat to WebLogic without change the application source code.
    Is there any option to solve this problem?
    Thanks a lot!
    Best Regards

  • Complex SQL help for a

    I do not know if this is the right place for thius type of post. If it is not please advise where the right place is.
    I need help generating a report, hopefully with SQL in 8.1.7
    SQL Statement which produced the data below the query :
    SELECT CHANGE.change_number, CHANGE.route_date as DATE_TO_CCB, nodetable.description AS Approver_required, (TRIM(BOTH ',' FROM CHANGE.PRODUCT_LINES)) AS PRODUCT_LINES /*, PROPERTYTABLE.VALUE as PRODUCT_LINES */
    FROM CHANGE, signoff, workflow_process, nodetable /*, PROPERTYTABLE */
    WHERE ( (CHANGE.ID = signoff.change_id)
    AND (CHANGE.process_id = signoff.process_id)
    AND ((nodetable.id = signoff.user_assigned) or (nodetable.id=signoff.user_signed))
    AND (CHANGE.process_id = workflow_process.ID)
    AND (CHANGE.ID = workflow_process.change_id)
    AND (CHANGE.workflow_id = workflow_process.workflow_id)
    AND (SIGNOFF.SIGNOFF_STATUS=0 )/* in (0, 2, 3)) */ /* 0=request needs attention, 2=request approved, 3=request rejected */
    AND (SIGNOFF.REQUIRED=5 or SIGNOFF.REQUIRED=1) /* 1=Approver 5= Ad Hoc Approver */
    AND (CHANGE.IN_REVIEW=1)
    AND (CHANGE.RELEASE_DATE IS NULL)
    AND (CHANGE.CLASS != '4928')
    /* AND (PROPERTYTABLE.PROPERTYID IN (SELECT TRIM(BOTH ',' FROM CHANGE.PRODUCT_LINES) FROM CHANGE)) */
    order by change.route_date desc
    **** Results **********
    CHANGE_NUMBER|DATE_TO_CCB|APPROVER_REQUIRED|PRODUCT_LINES
    C02190|11/14/2008 3:34:02 PM|Anurag Upadhyay|270354,270362|
    C02190|11/14/2008 3:34:02 PM|Dennis McGuire|270354,270362|
    C02190|11/14/2008 3:34:02 PM|Hamid Khazaei|270354,270362|
    C02190|11/14/2008 3:34:02 PM|Mandy York|270354,270362|
    C02193|11/14/2008 3:05:18 PM|Hamid Khazaei|274279,266339,266340,266341|
    C02193|11/14/2008 3:05:18 PM|Rob Brogle|274279,266339,266340,266341|
    C02193|11/14/2008 3:05:18 PM|Xavier Otazo|274279,266339,266340,266341|
    C02193|11/14/2008 3:05:18 PM|san|274279,266339,266340,266341|
    C02194|11/14/2008 2:51:34 PM|Diana Young|271503|
    C02194|11/14/2008 2:51:34 PM|Carl Krentz|271503|
    C02194|11/14/2008 2:51:34 PM|Dennis Yen|271503|
    C02194|11/14/2008 2:51:34 PM|Gordon Ries|271503|
    C02194|11/14/2008 2:51:34 PM|Sunil Khatana|271503|
    M00532|11/13/2008 1:34:42 PM|Dennis Yen|270356,270354,270360,274279,266339,266340,266341,276780,260784|
    M00532|11/13/2008 1:34:42 PM|Jin Hong|270356,270354,270360,274279,266339,266340,266341,276780,260784|
    M00532|11/13/2008 1:34:42 PM|Sunil Khatana|270356,270354,270360,274279,266339,266340,266341,276780,260784|
    Each value in the numeric comma delimited string has a corresponding ID for the actual test string value in another table as shown below.
    PROPERTYID|VALUE
    260775|product 1
    260776|Product 2
    260777|Product x
    260778|Product y
    260779|Internal
    260780|ORCA
    260781|Tiger
    260782|Orange product
    260783|Restricted
    260784|Product zz
    266259|Product YYY
    266260|Hercules
    266261|Tangerine
    *****Desired output****
    CHANGE_NUMBER|DATE_TO_CCB|APPROVER_REQUIRED|PRODUCT_LINES
    C02190|Nov/14/2008 03:34:02 PM|Anurag Upadhyay, Dennis McGuire, Hamid Khazaei, Mandy York|Product Y,Product 1
    C02193|Nov/14/2008 03:05:18 PM|Hamid Khazaei, Rob Brogle, Xavier Otazo, san|Hercules,Apple,Product 3,Product zz
    C02194|Nov/14/2008 02:51:34 PM|Diana Young, Carl Krentz, Dennis Yen, Gordon Ries, Sunil Khatana|Product 2
    M00532|Nov/13/2008 01:34:42 PM|Dennis Yen, Jin Hong, Sunil Khatana|Product 1,Product 4,product yy,product YYY,ORCA,Tiger,Orange product,Restricted

    Hi,
    Here's how you can do it in Oracle 8.1.
    To get the individual sub-strings from product_lines, join your current result set to this "counter table"
    (   SELECT  ROWNUM  AS n
        FROM    all_objects
        WHERE   ROWNUM <= 10 -- upper bound on number of items
    )  cntrIf you don't know the worst case of how many items might be in product_lines, it's a little more complicated:
    (   SELECT  ROWNUM  AS n
        FROM    all_objects
        WHERE   ROWNUM <= 1 +
                SELECT  MAX ( LENGTH (product_lines)
                            - LENGTH (REPLACE (product_lines, ','))
                FROM    table_name
    )  cntrJoin this to the existing result set like this
    WHERE   ...
    AND     INSTR ( product_lines || ','    -- one extra comma added
                  , 1
                  , n
                  ) > 0When you do the join, you will have
    one copy of all the rows with one item in producgt_lines,
    two copies of all the rows with two items in producgt_lines,
    three copies of all the rows with three items in producgt_lines,
    and so on.
    When a row has been copied, each copy will have a different value of cntr.n.
    To extract the n-th substring from product_lines:
    SELECT  ...
            SUBSTR ( product_lines
                   , INSTR ( ',' || product_lines,   ',',   1,   n)
                   , ( INSTR (product_lines || ',',   ',',   1,   n)
                     - INSTR (',' || product_lines,   ',',   1,   n)
                   )  AS product_lines_itemWhen you have derived this column, you can join to the table with the translations
    WHERE  TO_NUMBER (product_lines_item) = propertyidTo combine these rows into one row with a comma-delimited list, GROUP BY all the columns you want to select except the property_value ('produc 1', 'tangerine', etv.), and SELECT:
    LTRIM ( MAX (CASE WHEN n =  1 THEN ',' || property_value END) ||
            MAX (CASE WHEN n =  2 THEN ',' || property_value END) ||
            MAX (CASE WHEN n = 10 THEN ',' || property_value END)
          )I don't know a good way to re-combine the rows in Oracle 8 without assuming some limit on the number of items. I assumed there would never be more than 10 in the example above. You can say 20 or 100, I suppose, if you want to. If you guess too high, everything will still work: the query will just be slower.
    This is a just one example of why packing several values into a single column is a bad idea.

  • SQL Tuning for 50 million rows--- Group by

    For example i have 50 million+ rows in a table with columns Customer_ID, Order_ID and trans_date. I need a query to return customers with more than 2 orders over the past 60 days.
    [sql]
    Select customer_id from table
    where trans_date between sysdate-60 and sysdate
    group by customer_id
    having count(customer_id)>=2
    [/sql]
    I am trying to understand if there is a fastest alternative for group by and having. Especially for large data sets. Thanks in advance for your help/suggestions.

    varun wrote:
    For example i have 50 million+ rows in a table with columns Customer_ID, Order_ID and trans_date. I need a query to return customers with more than 2 orders over the past 60 days.
    [sql]
    Select customer_id from table
    where trans_date between sysdate-60 and sysdate
    group by customer_id
    having count(customer_id)>=2
    [/sql]
    I am trying to understand if there is a fastest alternative for group by and having. Especially for large data sets. Thanks in advance for your help/suggestions.
    The first task is to write a query that actually works properly; that one doesn't. Your business rule was 'more than 2 orders' but that query uses '>=2'.
    And there is NOTHING in that query having anything to do with 'orders'.
    That query returns 'customers with two or more rows' in the last 60 days. Why aren't you using 'ORDER_ID' in the query?
    First write a query that returns the correct results. There is no need for an alternative unless you can demonstrate that the query actually HAS a performance problem.

  • SQL Help for a computation

    Hi
    I am trying to create a Stock Market Technical Indicator named - Commodity Channel Index (CCI)
    Date  High_Price     Low_Price     Close_Price     True_Price     TPMA     MD
    02-Jan-07     2297     2238     2273     2269               
    03-Jan-07     2320     2273     2311     2301               
    04-Jan-07     2325     2275     2285     2295               
    05-Jan-07     2305     2256     2275     2279               
    08-Jan-07     2280     2193     2206     2226     2274     21     
    09-Jan-07     2235     2173     2190     2200     2260     38     
    10-Jan-07     2200     2153     2164     2173     2234     42     
    11-Jan-07     2215     2095     2183     2164     2208     35     
    12-Jan-07     2232     2200     2223     2218     2196     22     
    15-Jan-07     2248     2230     2243     2240     2199     24     
    16-Jan-07     2250     2216     2222     2229     2205     29     
    17-Jan-07     2245     2197     2205     2216     2214     20     
    Where Date, HighPrice,LowPrice,CLosePrice is the input from a table
    Below is the computation of other columns
    True_Price = (HighPrice+LowPrice+Closeprice)/3
    TPMA = 5 Days Average True_Price (last 5 values of True_Price includeing the current) [Note:First 4 values will be 0/Null ]
    MD = ABS(TPMA[5]-True_Price[5]) + ABS(TPMA[5]-True_Price[4]) + ABS(TPMA[5]-True_Price[3])+ ABS(TPMA[5]-True_Price[2])+ ABS(TPMA[5]-True_Price[1]) [Note:First 4 values will be 0/Null ]
    Please note this 5 days average is a parameter so it can be 5 days , 10 day, 20 day etc so the calculation will based on this parameter+
    For Example if parameter is 10 days then
    TPMA = 10 Days Average of True_Price(last 10 values of True_Price includeing the current) [Note:First 9 values will be 0/Null ]
    MD = ABS(TPMA[10]-True_Price[10]) ABS(TPMA[10]-True_Price[9]) ABS(TPMA[10]-True_Price[8]) ABS(TPMA[10]-True_Price[7]) ABS(TPMA[10]-True_Price[6]) ABS(TPMA[10]-True_Price[5]) ABS(TPMA[10]-True_Price[4]) + ABS(TPMA[10]-True_Price[3])+ ABS(TPMA[10]-True_Price[2])+ ABS(TPMA[10]-True_Price[1]) [Note:First 9 values will be 0/Null ]
    I am really struck with computation of column MD and not sure how to make it generic to work for any value
    Thanks in advance for your help
    Regards
    Rakesh

    Hi
    I am trying to create a Stock Market Technical Indicator named - Commodity Channel Index (CCI)
    Date  High_Price     Low_Price     Close_Price     True_Price     TPMA     MD
    02-Jan-07     2297     2238     2273     2269               
    03-Jan-07     2320     2273     2311     2301               
    04-Jan-07     2325     2275     2285     2295               
    05-Jan-07     2305     2256     2275     2279               
    08-Jan-07     2280     2193     2206     2226     2274     21     
    09-Jan-07     2235     2173     2190     2200     2260     38     
    10-Jan-07     2200     2153     2164     2173     2234     42     
    11-Jan-07     2215     2095     2183     2164     2208     35     
    12-Jan-07     2232     2200     2223     2218     2196     22     
    15-Jan-07     2248     2230     2243     2240     2199     24     
    16-Jan-07     2250     2216     2222     2229     2205     29     
    17-Jan-07     2245     2197     2205     2216     2214     20     
    Where Date, HighPrice,LowPrice,CLosePrice is the input from a table
    Below is the computation of other columns
    True_Price = (HighPrice+LowPrice+Closeprice)/3
    TPMA = 5 Days Average True_Price (last 5 values of True_Price includeing the current) [Note:First 4 values will be 0/Null ]
    MD = ABS(TPMA[5]-True_Price[5]) + ABS(TPMA[5]-True_Price[4]) + ABS(TPMA[5]-True_Price[3])+ ABS(TPMA[5]-True_Price[2])+ ABS(TPMA[5]-True_Price[1]) [Note:First 4 values will be 0/Null ]
    Please note this 5 days average is a parameter so it can be 5 days , 10 day, 20 day etc so the calculation will based on this parameter+
    For Example if parameter is 10 days then
    TPMA = 10 Days Average of True_Price(last 10 values of True_Price includeing the current) [Note:First 9 values will be 0/Null ]
    MD = ABS(TPMA[10]-True_Price[10]) ABS(TPMA[10]-True_Price[9]) ABS(TPMA[10]-True_Price[8]) ABS(TPMA[10]-True_Price[7]) ABS(TPMA[10]-True_Price[6]) ABS(TPMA[10]-True_Price[5]) ABS(TPMA[10]-True_Price[4]) + ABS(TPMA[10]-True_Price[3])+ ABS(TPMA[10]-True_Price[2])+ ABS(TPMA[10]-True_Price[1]) [Note:First 9 values will be 0/Null ]
    I am really struck with computation of column MD and not sure how to make it generic to work for any value
    Thanks in advance for your help
    Regards
    Rakesh

  • SQL Help for System Analysis

    Hi all,
    Can we seek for help in SQL?
    I have an system analysis which calculate the concurrent usage of a computer system.
    I have add all data which is stored in .CSV file and then insert into a table named as Activity.
    Can we select the data from activity and generate an Excel file which report the calculation on the concurrent usage of a computer system?

    fionanycheng wrote:
    Hi all,
    Can we seek for help in SQL?
    I have an system analysis which calculate the concurrent usage of a computer system.
    I have add all data which is stored in .CSV file and then insert into a table named as Activity.
    Can we select the data from activity and generate an Excel file which report the calculation on the concurrent usage of a computer system?
    So, you have data in a .csv file
    Then you load that data into a relational database.
    Now you want to select that data and place it back into a file for Excel ......
    Hmm..   Makes me wonder why you bothered with the database in the middle.
    the database itself is more than capable of efficiently performing your calculations (assuming a reasonably rational table design).
    Maybe you could provide a better description of the business problem to be solved, instead of a pre-conceived (and possibly ill-conceived) technical solution to that unspecified business problem.  The we could provide better advice.

  • [Swing] JTable & Oracle DB: SQL Query for Column Names Change

    Hello,
    I apologise for the 'stupid' thread subject name.
    Now i have a JTable wich i fill with rows from an Oracle DB.
    The query is something like this: "SELECT location_id, location_name FROM locations*bold*", and in the table i will have the columns names LOCATION_ID & LOCATION_NAME.
    I want to change this query like: "SELECT location_id "Location ID", location_name "Location Name" FROM locations".
    The only problem is that i CAN NOT insert "" inside ""
    So if anyone know how to fix this 'problem' please share that with me.
    Thank you,
    B.

    found it.. \" \"
    :)

  • SQL Help for Date Range display

    Gurus,
    I have a sql statement like
    select MIN(HIREDATE), MAX(HIREDATE) FROM EMP WHERE DEPTNO = 30My output looks like
    MIN(HIREDATE)     MAX(HIREDATE)
    12/30/1998        12/30/2001Based on the values of MIN(HIREDATE) , MAX(HIREDATE) values
    I need a SQL to generate the output like
    12/30/1998
    1/30/1999
    2/28/1999
    until Max(HIREDATE) value
    In Feb we dont have 30th day, In that case take the last day of the month.
    Thanks for great help
    C 007

    With 10g.
    Regards Salim.WITH t AS
         (SELECT min(hiredate) min_hiredate,
                 max(hiredate) max_hiredate
            FROM emp_test
            where deptno=30)
    SELECT min_hiredate dt
      FROM t
    model
    dimension by ( 1 rn)
    measures(min_hiredate,months_between(max_hiredate,min_hiredate) diff )
    (min_hiredate[for rn from 1 to diff[1] increment  1]=add_months( min_hiredate[1],cv(rn)-1))
    order by rn
    SQL> WITH t AS
      2       (SELECT min(hiredate) min_hiredate,
      3               max(hiredate) max_hiredate
      4          FROM emp_test
      5          where deptno=30)
      6  SELECT min_hiredate dt
      7    FROM t
      8  model
      9  dimension by ( 1 rn)
    10  measures(min_hiredate,months_between(max_hiredate,min_hiredate) diff )
    11  (min_hiredate[for rn from 1 to diff[1] increment  1]=add_months( min_hiredate[1],cv(rn)-1))
    12  order by rn
    13  /
    DT
    1998-12-30
    1999-01-30
    1999-02-28
    1999-03-30
    1999-04-30
    1999-05-30
    1999-06-30
    1999-07-30
    1999-08-30
    1999-09-30
    1999-10-30
    1999-11-30
    1999-12-30
    2000-01-30
    2000-02-29
    2000-03-30
    2000-04-30
    2000-05-30
    2000-06-30
    2000-07-30
    2000-08-30
    2000-09-30
    2000-10-30
    2000-11-30
    2000-12-30
    2001-01-30
    2001-02-28
    2001-03-30
    2001-04-30
    2001-05-30
    2001-06-30
    2001-07-30
    2001-08-30
    2001-09-30
    2001-10-30
    2001-11-30
    SQL> 

  • Some SQL Help for a Complete Beginner

    ...........

    Use ROLLUP then
    SQL> select id,
      2         case when grouping(id)=1 and grouping(pro_name)=1 then 'Total' else pro_name end pro_name
      3         sum(quantity) quantity
      4    from product
      5   group by rollup(id, pro_name)
      6  having (grouping(id)=0 and grouping(pro_name)=0)
      7      or (grouping(id)=1 and grouping(pro_name)=1)
      8  /
    ID    PRO_NAME               QUANTITY
    11011 Socket Type 3                20
    11110 Wrench Type 2                44
    11111 Bolt Type 1                  40
    22022 Hammer                       30
    22220 Wrench Type 3                44
    22222 Bolt Type 2                  40
    33330 Wrench Type 4                44
    33333 Bolt Type 3                  40
    44440 Nut Type 1                   80
    44444 Bolt Type 4                  40
    55550 Nut Type 2                   80
    55555 Nail Type 1                 400
    66660 Nut Type 3                   80
    66666 Nail Type 2                 400
    77770 Nut Type 4                   80
    77777 Nail Type 3                 400
    88880 Socket Type 1                20
    88888 Nail Type 4                 400
    99990 Socket Type 2                20
    99999 Wrench Type 1                44
          Total                      2346
    21 rows selected.Your price field is CHAR data type. You cant use it with quantity field which is a NUMBER data type.
    The basic structure of your table is wrong you need to modify it.
    Edited by: Karthick_Arp on May 8, 2009 11:47 PM

  • SQL Help for FMS needed

    Hi
    Can somebody please tell me what's wrong with this:
    declare @result as varchar(30)
    if $[$OWTR.Filler] = 'NFE-1'
    begin
      set @result = (select t1.wareHouse from WOR1 t1 inner join OWOR t2 on t1.DocEntry=t2.DocEntry
    where t2.DocNum=$[OWTR.U_SIA_ProdAusg] and t1.VisOrder=$[$23.0.1]-1 AND t1.IssueType='M')
    end
    else
    set @result = 'NFE-1'
    select @result
    Thanks
    Franz

    That was not it.
    I found it ... sometimes it seems to help to ask for help ...
    set @temp = $[$OWTR.Filler]
    changed to
    set @temp = $[OWTR.Filler]
    Thanks anyway
    Franz

  • Server slowness issue: Due to sql delete for 8 lakhs rows

    Hi. We had faced an issue like PeopleSoft server utilization went to 94 % due to a sql execution
    that sql was about deleting 8 lakhs rows. I wonder will it create server slowness? deletion of 8 Lakhs rows will bring the performance down?

    Hi,
    Could you clarificate which kind of PeopleSoft server is it?. Does it is a Process Scheduler or Application Server? How do you find that the cause of the slowness is the execution of a SQL and which process is executing it?.
    How is the performance at DB level when the SQL is executed?
    Please provide more infraestructure information, like Hardware architecture and OS version.
    Regards,
    Andrés Caro

  • Please help to generate the table from column to rows

    Hello -
    I have one table with more than 100 columns there are 70 column start with HC1.....HC70 (they are not in sequence) and has some value 0 or 1
    Table structure:
    HICN_ID HC1 HC2 HC4 HC5 HC6.................................HC70
    1234A 0 1 1 0 1 1
    3456D 1 0 0 1 0 0
    Now What i want is like this..
    HICN_ID HC
    1234A 2
    1234A 4
    1234A 6
    3456D 1
    3456D 5
    Can you please help me on this
    thanks
    nick

    Please look at the same scenario from the below link.
    You can accomplish this by a "pivot" query. Please look at the small testcase that I prepared below:
    SQL> desc t1
    Name Null? Type
    NAME VARCHAR2(10)
    YEAR NUMBER(4)
    VALUE NUMBER(4)
    SQL>
    SQL> select * from t1;
    NAME YEAR VALUE
    john 1991 1000
    john 1992 2000
    john 1993 3000
    jack 1991 1500
    jack 1992 1200
    jack 1993 1340
    mary 1991 1250
    mary 1992 2323
    mary 1993 8700
    9 rows selected.
    SQL> -- now, try out the pivot query
    SQL> select year,
    2 max( decode( name, 'john', value, null ) ) "JOHN",
    3 max( decode( name, 'jack', value, null ) ) "JACK",
    4 max( decode( name, 'mary', value, null ) ) "MARY"
    5 from
    6 (
    7 select name, year, value
    8 from t1
    9 )
    10 group by year ;
    YEAR JOHN JACK MARY
    1991 1000 1500 1250
    1992 2000 1200 2323
    1993 3000 1340 8700
    SQL>
    Hope that helps.
    Source : http://p2p.wrox.com/oracle/11931-sql-query-convert-columns-into-rows.html
    Thanks,
    Balaji K.

  • Input help not showing up for columns in CATS regular application

    I am using standard iView Time Entry in ESS available in EP7 ECC6.0.
    the issue I am having is that there is no popup (input help)  for columns 'Reason Code',  'Region' and 'OT Rsn'. But if I go into ECC6.0 t-code CAT2, the popups are available.
    Any idea what may be causing this issue?
    Tiberiu

    Suresh is right, You need to build your own search help with above table and implement the class
    ie CL_XSS_CAT_VALUE_HELP* in se24

  • Column masking row level security in Peoplesoft Databases

    Hi
    How about the credibility of using VPD( for column masking,row level security) in People soft Databases?where the sensitive data is redundant across 100's of tables.
    My intention is to use the VPD across all the tables that contain the sensitive data ( ssn,bank accno, etc)
    Appreciate your help.
    Chelli

    Hi.
    I also have a trouble like yours,but mine is more simple.
    I'd tried to solve,and find that it's really hard and must lost a lot of time to solve,because some table have 2,3 or more derive information that to use VPD is not easy.
    Can i ask for any aspect to solve problem like this.
    Thanks for any answer and support.
    Thinhbk.

  • Need help with query for converting columns to rows

    Hello,
    I know this is a very common question asked in the forum. I have searched regading this, i did find some threads, but i was not able to achieve what i require from the answers posted. So anybody please help me.
    I have a table which is having multiple columns as follows:
    Insert into table_1 (X,Y,Z,A,B,C,D,E,F,G,H,I) values (0,0,2,0,0,1,3,0,0,0,0,0);I want to convert the result into a two column, multiple rows i.e., I want the result as follows:
    Col1 Col2
    X      0
    Y     0
    Z      2
    A     0
    B     0
    C     1
    D     3
    E     0
    F     0
    G     0
    H     0
    I      0Please anybody help me in writing the query for this..

    Is this what you are expecting:
    SQL> WITH T AS
      2  (
      3  SELECT 0 X, 0 Y, 2 Z, 0 A, 0 B, 1 C, 3 D, 0 E, 0 F, 0 G, 0 H, 0 I FROM DUAL
      4  )
      5  SELECT  'X' col1, X col2 FROM T
      6  UNION ALL
      7  SELECT  'Y' col1, Y col2 FROM T
      8  UNION ALL
      9  SELECT  'Z' col1, Z col2 FROM T
    10  UNION ALL
    11  SELECT  'A' col1, A col2 FROM T
    12  UNION ALL
    13  SELECT  'B' col1, B col2 FROM T
    14  UNION ALL
    15  SELECT  'C' col1, C col2 FROM T
    16  UNION ALL
    17  SELECT  'D' col1, D col2 FROM T
    18  UNION ALL
    19  SELECT  'E' col1, E col2 FROM T
    20  UNION ALL
    21  SELECT  'F' col1, F col2 FROM T
    22  UNION ALL
    23  SELECT  'G' col1, G col2 FROM T
    24  UNION ALL
    25  SELECT  'H' col1, H col2 FROM T
    26  UNION ALL
    27  SELECT  'I' col1, I col2 FROM T
    28  /
    C       COL2                                                                   
    X          0                                                                   
    Y          0                                                                   
    Z          2                                                                   
    A          0                                                                   
    B          0                                                                   
    C          1                                                                   
    D          3                                                                   
    E          0                                                                   
    F          0                                                                   
    G          0                                                                   
    H          0                                                                   
    C       COL2                                                                   
    I          0                                                                   
    12 rows selected.

Maybe you are looking for

  • Help - I need a more specific action listener.

    I have a Jtable which I'm using like a spreadsheet, but with much more complicated functions than can be made in MS Excel. I am using key listeners to notify of an action then running this loop: for(int i=0; i<numRows; i++){ doCalclations(dataOnRow);

  • Fstream can't read or write files 4GB even with -m64?

    Using C++-style streams, I have been unable to read or write files >4GB. For example, when writing 5GB in one go, I get only 1GB. The header for write uses the type streamsize for the size parameter, and according to sizeof, streamsize is 8 bytes (wh

  • Adobe Acrobat 9 Pro - License Agreement ACCEPT does not work

    Today I purchased a license for Adobe Acrobat 9 Pro, downloaded the software and installed. I execute the program and when I get to License Agreement I select accept and nothing happens. I can't get beyond this point. I called Adobe Tech Support and

  • Mobile Home Directories not syn'g address book on login/out

    Mobile Home Directories should be sync'g ~/Library on login and logout .. but its not syn'g anything in !/Library .. so address book changes are not being sync'd. Any ideas? /s

  • Gr/ir wrong posting account-how to track error

    Dear Expert, For some PO, there were wrong posting in IR.After checked in OBYC and material master, user has already maintained the valuation class and the customizing also correct. How this could be happened since the customizing and val.class alrea