Populate data to column frm existing column

Hi,
I need to have 3 more columns and populate data from existing column rows.
For example
I want to have new columns based on int_bckt_1, char-bckt-2 and char_bckt_3
int_bckt_1= raw score
char_bckt_2= Pref
int_bckt_2= Scaled score
Raw score, pref and sacled score columns are new.
The data is populated based on these columns int_bckt_1, char_bckt_2,int_bckt_2
The rule is - i need to populate the data based on sub test id and char-bckt_2. we need to consider sub test id=200
for english
sub test id=200 and char_back_2 =T and subject is english then i need to populate data for all subtestid 500 and subject =english
similar for Perf and Raw score
For Math
sub test id=200 and char_back_2 =T and subject is Math then i need to populate data for all subtestid 500 and subject =Math
i want to do samething for char_bckt_2 =TR too.
I herewith attached my excel sheet for more clear
Raw score, Pref, Scaled score these column is not there in the table i need to have and populate data based on rule
Could you please help me.
Thanks
Ram

Another interpretation:
OK, 3 new columns, so they're all null and you want to populate them and your last reply is your desired output.
If that's correct you can use CASE:
SQL> select * from t;
STUD INT_BCKT_1 CHAR_BCK INT_BCKT_2 CHAR_BC SUBJECT  SUBTESTID      SCALE      A_RAW PR
John         38 T               226 NI      English        200
John         16 T               218 WF      Math           200
John         82 reading         167 poetry  English        500
John         82 Language        166 formal  English        500
John         83 number          170 compu   Math           500
John         83 geometry        172 spatial Math           500
6 rows selected.
SQL>  
SQL> update t
  2  set scale = case when subject = 'English'
  3                   then (select int_bckt_2 from t where subject = 'English' and subtestid = 200)
  4                   when subject = 'Math'
  5                   then (select int_bckt_2 from t where subject = 'Math' and subtestid = 200)
  6              end
  7  ,   a_raw = case when subject = 'English'
  8                   then (select int_bckt_1 from t where subject = 'English' and subtestid = 200)
  9                   when subject = 'Math'
10                   then (select int_bckt_1 from t where subject = 'Math' and subtestid = 200)
11              end
12  ,   pref = case when subject = 'English'
13                   then (select char_bckt_3 from t where subject = 'English' and subtestid = 200)
14                   when subject = 'Math'
15                   then (select char_bckt_3 from t where subject = 'Math' and subtestid = 200)
16              end;
6 rows updated.
SQL>
SQL>
SQL> select * from t;
STUD INT_BCKT_1 CHAR_BCK INT_BCKT_2 CHAR_BC SUBJECT  SUBTESTID      SCALE      A_RAW PR
John         38 T               226 NI      English        200        226         38 NI
John         16 T               218 WF      Math           200        218         16 WF
John         82 reading         167 poetry  English        500        226         38 NI
John         82 Language        166 formal  English        500        226         38 NI
John         83 number          170 compu   Math           500        218         16 WF
John         83 geometry        172 spatial Math           500        218         16 WF
6 rows selected.

Similar Messages

  • How to populate the organization_code column in ST table for legacy system

    Hi, dear all,
    Now I use the stage table to load the setup&transaction collection data from a non-EBS legacy system to ASCP system.
    My question is: how to populate the organization_code column in the stage table?If the source system is EBS system, maybe it's an inventory organization code. But for the non-EBS system, which value is need fo this field? keep it as blank? or assign some value for it?
    Thanks
    Edited by: 852938 on 2011-5-4 下午10:24

    I find some words in the implementation guide, it says:"To collect data from your non-Oracle ERP systems or your trading partners' systems,you model each non-Oracle ERP system or trading partner as an Oracle Applications organization and store their setup and transaction data there".
    But I can't find where to model the application organization for the legacy system.
    anyone can give some clues? Thanks in advance.

  • Change Data Table column header color

    How do I change the background color displayed in data table column headers?

    Thanks for your response. Problem is that I'm creating a portlet and the stylesheet.css file does not appear to exist, so Winston's blog does not help.

  • Displaying 'Date & Time' Column

    Hi there, I did do some searching/ reading prior to posting this, but haven't found what I'm looking for...
    I want to copy/ paste all my texts from my Nokia 6288 to my pc...
    -this works no hassle, I simply use the Nokia Phone Browser to load all my 'Inbox' and 'Sent Items' and move them to the desired folder on my hard drive...
    Problem is, in the Nokia Phone Browser, I get columns I can't seem to get in either Windows XP Pro or Windows Vista Business (which has more columns on offer)...
    This means, when im looking at the files on my PC, rather than using the nokia phone browser, i dont get the same details which is a bit of a problem for me...
    So what I want to know is:
    How do i get the Date & Time Column (and all the columns the Nokia Phone Browser displays) to show up in Windows XP or Vista or both?
    Thanks in advance

    Hi Austin,
    I have two remarks about that.
    1) It's better to put the population of change/history attributes into a table trigger of type before row where you assign these values. eg.:
    :NEW.CREATE_DATE := SYSDATE;
    :NEW.CREATE_USER := NVL(V('APP_USER'), USER);The reason is, it will consistently work for all applications which try to insert a record into this table and don't have to worry about change attributes and second, when you use the default property of APEX it will populate the column with the value when the new row was displayed and not when it was saved and third, a user would be able to fake this value and write something else into it (eg. with Firebug or by saving the HTML page) and "create" the record with a different time as you would expect. -> Define the column as "display only doesn't save state"
    2) Don't rely on automatic type conversion, remember that for APEX everything is a string that also means that your default value expression has to return a string to be 100% sure that it work on all systems where the default database format mask of Oracle could be different. Change your code to
    TO_DATE(SYSDATE, 'DD-MON-YYYY HH24:MI')Just some thoughts, but a testcase on apex.oracle.com is always good to reproduce and help with such a problem.
    Patrick
    My APEX Blog: http://www.inside-oracle-apex.com
    The ApexLib Framework: http://apexlib.sourceforge.net
    The APEX Builder Plugin: http://apexplugin.sourceforge.net/ New!

  • Displaying dates as column headers for BEx Query

    Hi all,
    I have to display dates in sequence as descriptions for 15 columns based on the keyed in date in Bex Query Analyser. I'm able to display date as column heading for one column using text variable with replacement path.I could not able to increment date for other descriptions.Could you please help me to solve this issue.
    Ex: Input Date 05/09/2007 then in the out put column headers should be 0509 0609    0709   ............ 1909
    These are only column headers, values for the columns are quantities calculated using formulas.
    It is urgent.
    Thanks in advance.
    Regards,
    Mandadi.

    hi mandadi,
    if u want dates as headers only then u should use a text variable .
    as a rule u can not set off set for text variable so u create restricted key figure with date restricted and set off set.
    now u use this rkf to populate the text variable using replacement path.
    text variable can use replacement path for replacing from any variable and characteristics.
    bye

  • How to export data with column headers in sql server 2008 with bcp command?

    Hi all,
    I want know "how to export data with column headers in sql server 2008 with bcp command", I know how to import data with import and export wizard. when i
    am trying to import data with bcp command data has been copied but column names are not came.
    I am using the below query:-
    EXEC master..xp_cmdshell
    'BCP "SELECT  * FROM   [tempdb].[dbo].[VBAS_ErrorLog] " QUERYOUT "D:\Temp\SQLServer.log" -c -t , -T -S SERVER-A'
    Thanks,
    SAAD.

    Hi All,
    I have done as per your suggestion but here i have face the below problem, in print statment it give correct query, in EXEC ( EXEC master..xp_cmdshell @BCPCMD) it was displayed error message like below
    DECLARE @BCPCMD
    nvarchar(4000)
    DECLARE @BCPCMD1
    nvarchar(4000)
    DECLARE @BCPCMD2
    nvarchar(4000)
    DECLARE @SQLEXPRESS
    varchar(50)
    DECLARE @filepath
    nvarchar(150),@SQLServer
    varchar(50)
    SET @filepath
    = N'"D:\Temp\LDH_SQLErrorlog_'+CAST(YEAR(GETDATE())
    as varchar(4))
    +RIGHT('00'+CAST(MONTH(GETDATE())
    as varchar(2)),2)
    +RIGHT('00'+CAST(DAY(GETDATE())
    as varchar(2)),2)+'.log" '
    Set @SQLServer
    =(SELECT
    @@SERVERNAME)
    SELECT @BCPCMD1
    = '''BCP "SELECT 
    * FROM   [tempdb].[dbo].[wErrorLog] " QUERYOUT '
    SELECT @BCPCMD2
    = '-c -t , -T -S '
    + @SQLServer + 
    SET @BCPCMD
    = @BCPCMD1+ @filepath 
    + @BCPCMD2
    Print @BCPCMD
    -- Print out below
    'BCP "SELECT 
    * FROM   [tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername'
    EXEC
    master..xp_cmdshell
    @BCPCMD
      ''BCP' is not recognized as an internal or external command,
    operable program or batch file.
    NULL
    if i copy the print ourt put like below and excecute the CMD it was working fine, could you please suggest me what is the problem in above query.
    EXEC
    master..xp_cmdshell
    'BCP "SELECT  * FROM  
    [tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername '
    Thanks, SAAD.

  • How to insert data into datagrid dynamically and also programatically with data and column names being retrived from a xml file..

    iam not able to insert data into datagrid corresponding to the column names..as iam inserting both data and column names programatically..ie iam not able to co relate the data with the column names.plzzz help me asap

    A DataGrid is row-based rather than cell-based with each row
    corresponding to an item in an underlying collection (specified in the
    dataProvider property). In order to add data to a DataGrid you
    manipulate the underlying collection, rather than the grid directly.
    Based on the limited description of your problem I would imagine you
    would need to create dynamic objects with property names that correspond
    to the dataFields of your dynamically created datagrid columns.
    So if you had created columns with dataFields "alpha", "beta" and
    "gamma" on your datagrid, you could create an item in your grid by
    adding the following object to your dataProvider:
    var gridItem : Object = new Object();
    gridItem.alpha = "alphaValue";
    gridItem.beta = "betaValue";
    gridItem.gamma = "gammaValue";

  • Want to display a date in column heading.

    Hi all,
    Will be thankful, if anyone can tell me how to solve one of the issue i am facing in webi variable display.
    In universe, i am creating one prompt for date and user will enter the desired date, and with respect to that date, the previous date and previous month last working date will come. In my Webi report , i have 3 dates and one measure(Quantity) with other dimensions like Product and Subproduct. 
    I have one cross table in which in want to show the 3 dates as Column heading, Product as row heading and Quantity(measure) in the table body. I have one more dimension as Area... which i want to show in horizontal way, for each Area, i want to show prompted date, previous date and previous month last date. I have created 3 variables.... 
    1. Current date = Max(date) In Report
    2. Previous date = Min(date) In Report
    3. Previous Month last day = (date) where (Rank = 2) ForEach(date)
    By this way, I am able to show Current date and  Previous Month last day in column heading, but not Previous day. Will appreciate if anyone can help me on the issue. let me know if any other information is required.
    Thanks
    Archit Sarwal

    Hi,
    The previous date is the previous business day, it can be dynamic. And previous month's last day is last business day, it can also be dynamic. And Previous daye can also be previous month's last business day in one of the scenerio.
    Actually i am using 3 filters with prompts (common prompt) in universe side. User will enter the date and corrosponding previous business day and previous month's last business day will come. 3 filters are:
    1. Current_Day = @prompt('Enter Date(YYYYMMDD)','A',,Mono,Free,Persistent)
    2. Previous_Day = (SELECT TOP 1 Date from [TableName] where Date < @prompt('Enter Date(YYYYMMDD)','A',,Mono,Free,Persistent) Order By Date Desc)
    3. Prior_Month last Day = (SELECT TOP 1 Date from [TableName] T where Month(T.Date) = Month(DateAdd(mm,-1,@prompt('Enter Date(YYYYMMDD)','A',,Mono,Free,Persistent))) Order By T.Date Desc)
    Dates are coming correct from Universe.  In Webi, i have created variables...
    CurrentDate = max([Date]) In Report
    LastDate = Min([Date]) In Report
    PriorDate = [(Date]) where ([Rank]=2) ForEach ([Date])
    I have calculated Rank for Date, and Rank 2 shows the Prior Date. Also, i have Entity, and want to show these dates for each entity along with 2 -3 more columns that depends on these 3 dates values. I am attaching the screenshot for the sample.
    Thanks
    Archit Sarwal

  • Moving a table with long data type column

    hi
    1.how to move a table with a long data type column in 8.1.7.3.0 ver database.
    alter table APPLSYS.FND_LOBS_DOCUMENT move lob(BLOB_CONTENT) store as (tablespace testing)
    ERROR at line 1:
    ORA-00997: illegal use of LONG datatype
    2. and a table with varray type column
    alter table APPLSYS.WF_ERROR move lob("USER_DATA"."PARAMETER_LIST") store as (tablespace testing)
    ERROR at line 1:
    ORA-22917: use VARRAY to define the storage clause for this column or attribute
    table description is:
    SQL> desc applsys.wf_error;
    Name Null? Type
    Q_NAME VARCHAR2(30)
    MSGID NOT NULL RAW(16)
    CORRID VARCHAR2(128)
    PRIORITY NUMBER
    STATE NUMBER
    DELAY DATE
    EXPIRATION NUMBER
    TIME_MANAGER_INFO DATE
    LOCAL_ORDER_NO NUMBER
    CHAIN_NO NUMBER
    CSCN NUMBER
    DSCN NUMBER
    ENQ_TIME DATE
    ENQ_UID NUMBER
    ENQ_TID VARCHAR2(30)
    DEQ_TIME DATE
    DEQ_UID NUMBER
    DEQ_TID VARCHAR2(30)
    RETRY_COUNT NUMBER
    EXCEPTION_QSCHEMA VARCHAR2(30)
    EXCEPTION_QUEUE VARCHAR2(30)
    STEP_NO NUMBER
    RECIPIENT_KEY NUMBER
    DEQUEUE_MSGID RAW(16)
    SENDER_NAME VARCHAR2(30)
    SENDER_ADDRESS VARCHAR2(1024)
    SENDER_PROTOCOL NUMBER
    USER_DATA APPS.WF_EVENT_T
    lob column:
    SQL> select owner,table_name,column_name from dba_lobs where table_name='WF_ERROR';
    OWNER TABLE_NAME COLUMN_NAME
    APPLSYS WF_ERROR "USER_DATA"."PARAMETER_LIST"
    APPLSYS WF_ERROR "USER_DATA"."EVENT_DATA"
    pls help me
    thanks and regards
    srinivas

    1. Export and import
    2. Sql*Plus 'copy' command
    It is a good idea to move from 'LONG' to 'CLOB'.

  • Issue with using formatted date value column in order by clause...

    Hi,
    1) Through a function I am listing all the months in a year.
    like JAN-2007, FEB-2007,MAR-2007......
    2) i am comparing these values against a date value column in a table.
    And if there are no values in a particular period it will return a null value (simply to say, i am using an outer join)
    3) The issue.....
    When join both the queries then the order of the dates is not mainted .....
    My requirement is......
    Jan-2007 = 3
    Feb-2007 = 5
    Mar-2007 = null
    etc.....
    should be acheived.
    But I end up in the alphabetical order of the months....
    like
    Apr-2007 = 5
    Aug-2007 = 10
    etc.....
    Can anybody let me know how can i acheive my resultant output to be ordered by the date and not by character.
    When I use the date column in the order by I run into an error....
    saying....
    ORA-01858: a non-numeric character was found where a numeric was expected
    Its a kind of urgent...
    Any help is appreciated....
    KK

    When I use a outer join as follows....
    "and upper(to_char(a.task_planned_start_date,'mon-rrrr')) = d.period_name(+)"
    All the null periods are ending at the bottom.It's standard behavoiur.
    Seems, you need to sort by a.task_planned_start_date.
    Look below:
    SQL> select e.ename, ec.ename from emp e, emp_copy ec
      2  where e.empno = ec.empno(+);
    ENAME      ENAME
    SMITH      SMITH
    ALLEN
    WARD       WARD
    JONES
    MARTIN     MARTIN
    BLAKE
    CLARK      CLARK
    SCOTT
    KING       KING
    TURNER
    ADAMS      ADAMS
    JAMES
    FORD       FORD
    MILLER
    14 rows selected.
    SQL> select e.ename, ec.ename from emp e, emp_copy ec
      2  where e.empno = ec.empno(+)
      3  order by ec.ename
      4  /
    ENAME      ENAME
    ADAMS      ADAMS
    CLARK      CLARK
    FORD       FORD
    KING       KING
    MARTIN     MARTIN
    SMITH      SMITH
    WARD       WARD
    JAMES
    TURNER
    ALLEN
    MILLER
    BLAKE
    JONES
    SCOTT
    14 rows selected.
    SQL> select e.ename, ec.ename from emp e, emp_copy ec
      2  where e.empno = ec.empno(+)
      3  order by e.ename
      4  /
    ENAME      ENAME
    ADAMS      ADAMS
    ALLEN
    BLAKE
    CLARK      CLARK
    FORD       FORD
    JAMES
    JONES
    KING       KING
    MARTIN     MARTIN
    MILLER
    SCOTT
    SMITH      SMITH
    TURNER
    WARD       WARD
    14 rows selected.Rgds.

  • How to use selectOneList in a updateable data table column

    Hi,
    Could someone tell me how to use selectOneList (source from a vo X) in an updateable data table column (from another vo Y)?
    I successfully created a page with the data table. However, strange things happened:
    1) the values populated on the selectOneList column don't match the underlying value in vo Y. in fact, every rows in the column got the same value.
    2) when I update one of the rows, the column value in every other rows turns to the new value.
    3) when I sort other columns in the table, the values shown in the selectOneList column get toggled between blank and some incorrect value.
    I believe it is something related to the fact that the same iterator is used to the source view object. If this is the case, how can I solve it?

    See #7 here:
    http://radio.weblogs.com/0118231/stories/2005/06/24/jdeveloperAdfScreencasts.html

  • How to get data with out having any date/timestamp columns by year wise

    hi,
    how can i select years wise rows from tables,if that have not any date/timestamp column.

    Well Govind it quite depends on what is the data type of that column and the format in which it is stored.
    If the data type is varchar2/varchar and all the values are in a uniform format then there is no problem. All you need to use is the to_date function to convert the supplied strings to default date format and then use to_char function to only extract the YY or YYYY or RR or RRRR aspect of the data.
    For example: If the column is called 'hire_date' and it's data type is varchar2 and the entries in this column are all in a uniform format, say month,date,year like January,12,1999. What you need to do is convert this string to a default date value using to_date function, like to_date(hire_date,'format_model') In the format model mention the format of the hire_date string. The out put of this function can be fed into to_char to extract the year, like to_char(output_of_to_date,'YYYY')
    I hope you got what I meant. Let me know if it was of any use.

  • How to compare the date value with the date datatype column?

    Hi,
    I am executed a query to get output for the particular date in two different database.
    I got output in one db environment, but in the another environment i didnt get the output.
    APP_DECISION_DATE column contains date datatype
    ex:
    SQL> select DECISIONED_STAGE_ID,DECISIONED_STAGE_USER_ID from naap10_application where APP_DECISION_DATE = TO_DATE('23-JAN-07',
    'DD-MON-YY'); 2
    DECISIONED_STAGE_ID DECISIONED_STAG
    2006060106 SYSTEM
    DATABASE - II
    SQL> select DECISIONED_STAGE_ID,DECISIONED_STAGE_USER_ID from naap10_application where APP_DECISION_DATE=
    TO_DATE('31-JAN-2007','DD-MON-RRRR') and application_id=2007010028552;
    no rows selected
    in the same db i got the output while i used the TO_DATE(APP_DECISION_DATE)
    SQL> select DECISIONED_STAGE_ID,DECISIONED_STAGE_USER_ID from naap10_application where TO_DATE(APP_DECISION_DATE)=
    TO_DATE('31-JAN-2007','DD-MON-YYYY') and application_id=2007010028552; 2
    DECISIONED_STAGE_ID DECISIONED_STAG
    2006060113 SYSTEM
    is it necessary to use TO_DATE function while i am using the data datatype column in the WHERE CLAUSE?
    Thanks in advance.
    siva

    Sorry & thanks sathish,
    Now i got the result.
    SQL> select DECISIONED_STAGE_ID,DECISIONED_STAGE_USER_ID from naap10_application where APP_DECISION_DATE BETWEEN TO_DATE ('31.01.2007 00:00:00', 'DD.MM.YYYY HH24:MI:SS') AND TO_DATE ('31.01.2007 23:59:59', 'DD.MM.YYYY HH24:MI:SS')
    2 and application_id=2007010028552;
    DECISIONED_STAGE_ID DECISIONED_STAG
    2006060113 SYSTEM
    ================================
    But one doubt,
    When i created the column with the date datatype how it gets the time value,
    And in one environment db i got the result but in another environment i dont get,
    Shall i want to change any session status of date?

  • Display last 12 months data in column chart

    Hi All,
    I have one  dashbord  requirement in list box i have (example:):  "oct-11" i need to display previous 12 mnth data in column chart anybody help in excel formula how to display last 12 mnths based on list box selection.
    example:  if i select oct-11 from list box i need to display in chart like
    nov-10 dec-10 nov-10...................................oct-11
    please provide how to write in logic in excel

    Hi Shankar,
    Try this formula in excel : DATE(YEAR(A1),MONTH(A1)-1,DAY(A1))
    A1 will be your cell which is the destination of your List box. & then drag it till 12 months.
    If you are not having day from your list box then manually enter 1 in any cell and map that cell in place of A1 for day.
    HTH.
    Neeraj..

  • How do I sort data in columns using Pages

    How do I sort data in columns (alphabetically) using Pages?

    If you are referring to text or numbers in a column (not table), then get the free Service plug-in WordService, from Devon Technologies. Put it in the
    /Users/yourlogin/Library/Services folder location.
    Select your data to be sorted. From the Pages menu > Services > Sort Ascending will do the trick. This will work with Pages ’09 and Pages v5.2 or later, as well as Apple Mail, TextEdit, etc.
    The WordService files include a PDF (Read Me) that describes the services included with the package.
    The Service items will only appear in the Services submenu when you have selected your data prior to sort. If these WordService items do not appear in the Services menu as they should per the preceding sentence, then you will need to enable them.
    System Preferences > Keyboard > Shortcuts > Services. Scroll through the right hand list of services until you encounter Sort Ascending and ensure that it is selected.
    If you were referring to sorting a column of data in a table:
    Pages ’09
    Select all cells containing your unordered data. In the Table Inspector, under Edit Rows & Columns, choose Sort Ascending.
    Pages v5.2
    Select cells as before. In the Table heading (A, B, C, etc.) when you roll over the letter, a down-arrow appears. Click, and choose Sort Ascending from the drop down menu.

Maybe you are looking for