Need SQL query to get the result.

Region
Month
Trx Type
Resolution Summary
AMERICAS
May-13
Adjustments
Correct
EMEA
May-13
Adjustments
Incorrect
AMERICAS
May-13
Credit Memo
Incorrect
EMEA
May-13
Invoice
Correct
AMERICAS
May-13
Credit Memo
Correct
OFD
May-13
Adjustments
Correct
AMERICAS
May-13
Invoice
Incorrect
LAD
May-13
Adjustments
Correct
LAD
May-13
Adjustments
Correct
OFD
May-13
Adjustments
Correct
Above is my Table and find below the required result.Similarly for other regions as well. Can anyone help me with the SQL Query?
Region
Resolution Summary
Adjustment
Credit Memo
Invoice
Grand Total
AMERICAS
Correct
1
1
2
Incorrect
0
1
1
2

Like this?
SQL> select * from transaction_audit;
REGION   MTH    TRX_TYPE    RESOLUTIO
AMERICAS may-13 ADJUSTMENTS CORRECT
EMEA     may-13 ADJUSTMENTS INCORRECT
AMERICAS may-13 CREDIT MEMO INCORRECT
EMEA     may-13 INVOICE     CORRECT
AMERICAS may-13 CREDIT MEMO CORRECT
OFD      may-13 ADJUSTMENTS CORRECT
AMERICAS may-13 INVOICE     INCORRECT
LAD      may-13 ADJUSTMENTS CORRECT
LAD      may-13 ADJUSTMENTS CORRECT
OFD      may-13 ADJUSTMENTS CORRECT
10 rows selected.
SQL> select region
  2       , resolution_summary
  3       , count(decode(trx_type, 'ADJUSTMENTS', trx_type)) adjustments
  4       , count(decode(trx_type, 'CREDIT MEMO', trx_type)) credit_memo
  5       , count(decode(trx_type, 'INVOICE'    , trx_type)) invoice
  6    from transaction_audit
  7   group
  8      by region
  9       , resolution_summary
10   order
11      by region
12       , resolution_summary
13  /
REGION   RESOLUTIO ADJUSTMENTS CREDIT_MEMO    INVOICE
AMERICAS CORRECT             1           1          0
AMERICAS INCORRECT           0           1          1
EMEA     CORRECT             0           0          1
EMEA     INCORRECT           1           0          0
LAD      CORRECT             2           0          0
OFD      CORRECT             2           0          0
6 rows selected.
SQL>

Similar Messages

  • SQL query to get the list of approvals

    Hi,
    Could someone let me know the SQL query to get the list of all the pending approvals for a user in OIM 11g R2.
    Thanks

    There are a few ways to do this:
    -  The easiest would be to use a Relationship Query from the CMC. To do this, go to the Universes section on the CMC, right click on the relevant universe, select tools >> Check Relationships.
    - Use Query Builder. You will need more than one query to pull the information you need. You could try something like the below (for Webi)
    SELECT SI_NAME, SI_WEBI, SI_DATACONNECTION FROM CI_APPOBJECTS
    WHERE SI_KIND = 'universe' and SI_NAME = 'Universe Name'
    This will give you a list of Webi Reports by SI_ID.
    You'll need another query to list Webi report names:
    SELECT SI_NAME FROM CI_INFOOBJECTS WHERE SI_ID IN (SI_ID from query above)
    - This is trivial via Auditing / the Activity universe. This of course will only return reports that have already run.
    Best.
    Srinivas

  • SQL query to get the Datetime 06 hours prior to the table Datetime value

    Hi Experts,
                    I'm just trying to create a SQL query to get the Datetime which should be 06 hours prior to my Table column value(Executiontime),
    Eg: my Executiontime(column) value is 07:00AM means, this query should fetch the detail of first VMName from table at 01:00AM, 
    SQL Table Name: TestTable
    Columns: VMName(varchar),status(varchar) Executiontime(Datetime)
    SQL Query : Select Top 1 VMName from
    TestTable where convert(date,Exeutiontime)=convert(date,getdate()) and
    status='0' and ExecutionTime > dateadd(hour,6,getdate())
    Request someone to alter this Query to my requirement or give me the new one.
    Regards,
    Sundar
    Sundar

    Hi All,
            Thanks for your Prompt response. I tried the below queries, but still I don't have any luck. Actually the queries are returning the value before the condition met (say when the time difference is more than 06 hours). I want the
    query to return exactly @ 06 hour difference or less than 06 hours,
    Query 01: Select Top 1 VMName from TestTable where
    convert(date,Exeutiontime)=convert(date,getdate())
    and status='0'
    and ExecutionTime >
    dateadd(hour,-6,getdate())
    Query 02: Select
    Top 1 VMName from TestTable where
    status='0'
    and ExecutionTime >
    dateadd(hour,-6,getdate())
    Query 03: Select
    Top 1 VMName from TestTable where status='0'
    and ExecutionTime >
    dateadd(hour,-6,ExecutionTime)
              Can someone point out the mistake please.
    Regards,
    Sundar
    Sundar

  • HOW TO CHANGE SQL QUERY TO GET SPECIFIC RESULT

    I HAVE FOLLOWING QUERY AND ITS FUNCTIONING BUT I WANT ALL THOSE RECORD SHOULD BE DISPLADE WICH HAVE NO TRANSACTION IN SALES ANS SALES RETURN WHILE RETREVING DATA FROM DATABASE.
    I TRIED TO USE + OPERATOR BUT I DON'T KNOW HOW TO CHANGE THE QUERY TO GET THE RESULT
    MAIN TABLE IS BEING USED TO FETCH RECORD
    SALES_HEADER,SALES_DETAIL
    SALES_HEADERR,SALES_DETAILR
    STOCK_REG
    AND THE QUERY IS
    select s.item_code,S.DESCR,s.GRAND_TOTAL,
    sum(decode(d.dayno,01,NVL(S.QTY,0),0)) DAY1,
    sum(decode(d.dayno,02,NVL(S.QTY,0),0)) DAY2,
    sum(decode(d.dayno,03,NVL(S.QTY,0),0)) DAY3,
    sum(decode(d.dayno,04,NVL(S.QTY,0),0)) DAY4,
    sum(decode(d.dayno,05,NVL(S.QTY,0),0)) DAY5,
    sum(decode(d.dayno,06,NVL(S.QTY,0),0)) DAY6,
    sum(decode(d.dayno,07,NVL(S.QTY,0),0)) DAY7,
    sum(decode(d.dayno,08,NVL(S.QTY,0),0)) DAY8,
    sum(decode(d.dayno,09,NVL(S.QTY,0),0)) DAY9,
    sum(decode(d.dayno,10,NVL(S.QTY,0),0)) DAY10,
    sum(decode(d.dayno,11,NVL(S.QTY,0),0)) DAY11,
    sum(decode(d.dayno,12,NVL(S.QTY,0),0)) DAY12,
    sum(decode(d.dayno,13,NVL(S.QTY,0),0)) DAY13,
    sum(decode(d.dayno,14,NVL(S.QTY,0),0)) DAY14,
    sum(decode(d.dayno,15,NVL(S.QTY,0),0)) DAY15,
    sum(decode(d.dayno,16,NVL(S.QTY,0),0)) DAY16,
    sum(decode(d.dayno,17,NVL(S.QTY,0),0)) DAY17,
    sum(decode(d.dayno,18,NVL(S.QTY,0),0)) DAY18,
    sum(decode(d.dayno,19,NVL(S.QTY,0),0)) DAY19,
    sum(decode(d.dayno,20,NVL(S.QTY,0),0)) DAY20,
    sum(decode(d.dayno,21,NVL(S.QTY,0),0)) DAY21,
    sum(decode(d.dayno,22,NVL(S.QTY,0),0)) DAY22,
    sum(decode(d.dayno,23,NVL(S.QTY,0),0)) DAY23,
    sum(decode(d.dayno,24,NVL(S.QTY,0),0)) DAY24,
    sum(decode(d.dayno,25,NVL(S.QTY,0),0)) DAY25,
    sum(decode(d.dayno,26,NVL(S.QTY,0),0)) DAY26,
    sum(decode(d.dayno,27,NVL(S.QTY,0),0)) DAY27,
    sum(decode(d.dayno,28,NVL(S.QTY,0),0)) DAY28,
    sum(decode(d.dayno,29,NVL(S.QTY,0),0)) DAY29,
    sum(decode(d.dayno,30,NVL(S.QTY,0),0)) DAY30,
    sum(decode(d.dayno,31,NVL(S.QTY,0),0)) DAY31,
    sum(S.qty) TU
    FROM
    (select nvl(sales_detail.qty+sales_detail.bonus,0) as qty,
    sales_detail.item_code AS ITEM_CODE,
    stock_reg.descr AS descr,
    s_date as sale_date,stock_reg.GRAND_TOTAL AS GRAND_TOTAL FROM
    SALES_DETAIL,SALES_HEADER,STOCK_REG
    WHERE SALES_DETAIL.S_ID = SALES_HEADER.S_ID AND
    SALES_DETAIL.ITEM_CODE = STOCK_REG.ITEM_CODE(+) AND
    STOCK_REG.COMCODE='C1'
    UNION all
    select -1*nvl(sales_detailR.qty+sales_detailR.bonus,0) as qty,
    sales_detailR.item_code AS ITEM_CODE,
    stock_reg.descr AS descr,
    RETURN_date as sale_date,stock_reg.GRAND_TOTAL AS GRAND_TOTAL FROM
    SALES_DETAILR,SALES_HEADERR,STOCK_REG
    WHERE SALES_DETAILR.SR_ID = SALES_HEADERR.SR_ID AND
    SALES_DETAILR.ITEM_CODE = STOCK_REG.ITEM_CODE(+) AND
    STOCK_REG.COMCODE='C1') S,
    (select level as dayno
    from dual
    connect by level <= 31) d
    where d.dayno = to_char(s.sALE_date, 'DD') AND TO_DATE(S.SALE_DATE) BETWEEN '&FROMDATE' AND '&TODATE'
    GROUP BY S.ITEM_CODE,S.DESCR,S.GRAND_TOTAL

    well my query running successfully just the quesion was that i wanted to bring some changes in the query to retrieve the complete record which has no transaction in sales
    for exmple
    if i write the quey
    select dept.deptno,sum(sal) from emp,dept
    where dept.deptno = emp.deptno
    group by dept.deptno
    the recult comes as
    DEPTNO SUM(SAL)
    10 8750
    20 10875
    30 9400
    though there is another deptno which is deptno no 40
    have no sal
    and when i use this query
    select dept.deptno,sum(sal) from emp,dept
    where dept.deptno = emp.deptno(+)
    group by dept.deptno
    it shows the dept no 40 also
    DEPTNO SUM(SAL)
    10 8750
    20 10875
    30 9400
    40
    so to get this i posted query which was to long to understand easily.
    i accept that i sholud post short query to make other understand
    so check out this
    select STOCK_rEG.item_code AS ITEM_CODE,SUM(qty) as qty
    FROM
    SALES_DETAILR,SALES_HEADERR,STOCK_REG
    WHERE SALES_DETAILR.SR_ID = SALES_HEADERR.SR_ID AND
    SALES_DETAILR.STOCKCODE = STOCK_REG.STOCKCODE
    AND RETURN_DATE = '01-APR-08'
    GROUP BY STOCK_rEG.item_code
    ORDER BY TO_NUMBER(ITEM_CODE) ASC
    when i execute this query i get the following result
    ITEM_CODE QTY
    84 2
    102 3
    108 3
    116 6
    166 3
    170 3
    thoug there is other items are aalso available in stock which transaction
    yet not been done or not been sold out/
    so when i use the outer join i get the same result
    select STOCK_rEG.item_code AS ITEM_CODE,SUM(qty) as qty
    FROM
    SALES_DETAILR,SALES_HEADERR,STOCK_REG
    WHERE SALES_DETAILR.SR_ID = SALES_HEADERR.SR_ID AND
    SALES_DETAILR.STOCKCODE(+) = STOCK_REG.STOCKCODE
    AND RETURN_DATE = '01-APR-08'
    GROUP BY STOCK_rEG.item_code
    ORDER BY TO_NUMBER(ITEM_CODE) ASC
    ITEM_CODE QTY
    84 2
    102 3
    108 3
    116 6
    166 3
    170 3
    hope i tried to make u understand on better way

  • OIM sql Query for getting the status of the task which got failed

    Hi Everyone,
    We have a requirement like we need to get the status of a particular task(say Create User in OID resource - Completed\Rejected status) for the particular user.We are able to get the status of the resource provisioed to the user but not the status of the particular task getting trigerred for the user.can someone put some light on this.We need to get the SQL query for this.
    Thanks in Advance.
    Regards,
    MKN

    Hi
    Use this sample query to get the task status, also check the cooments
    SELECT USR.USR_LOGIN, OSI.SCH_KEY,SCH.SCH_STATUS,STA.STA_BUCKET FROM
    OSI,SCH,STA,MIL,TOS,PKG,OIU,USR,OBJ,OST
    WHERE OSI.MIL_KEY=MIL.MIL_KEY
    AND SCH.SCH_KEY=OSI.SCH_KEY
    AND STA.STA_STATUS=SCH.SCH_STATUS
    AND TOS.PKG_KEY=PKG.PKG_KEY
    AND MIL.TOS_KEY=TOS.TOS_KEY
    AND OIU.USR_KEY=USR.USR_KEY
    AND OIU.OST_KEY=OST.OST_KEY
    AND OST.OBJ_KEY=OBJ.OBJ_KEY
    AND OSI.ORC_KEY=OIU.ORC_KEY
    AND OBJ.OBJ_NAME='AD User'
    AND OST.OST_STATUS = 'Provisioning' -- filter accordinglly
    AND STA.STA_BUCKET = 'Pending' -- filter accordinglly
    AND PKG.PKG_NAME='AD User' -- filter accordinglly
    AND MIL.MIL_NAME='System Validation' ---- filter accordinglly
    Thanks,
    Kuldeep

  • SQL Query to get the # of files in folders in a library

    Anyone has the SQL query to list the number of files in each folders in a SharePoint library?

    Technically it's a grey area of support as MS don't mind you doing it but won't help you if you encounter problems, the script is much better though.
    Scratch that, the script isn't that good. It's using .items which won't work on large lists and is slow. The version below is untested but should be significantly faster and work on large lists.
    $starttime = Get-Date
    #Creating new site object
    $siteurl = Read-Host "Enter the name of your site and press enter"
    $site = New-Object Microsoft.SharePoint.SPSite($siteurl)
    #Assigning all webs (sites) to $webs
    $webs = $site.Allwebs
    #System Libraries defined so they won't be touched##
    $systemlibs =@("Converted Forms", "Customized Reports", "Documents", "Form Templates",
    "Images", "List Template Gallery", "Master Page Gallery", "Pages",
    "Reporting Templates", "Site Assets", "Site Collection Documents",
    "Site Collection Images", "Site Pages", "Solution Gallery",
    "Style Library", "Theme Gallery", "Web Part Gallery", "wfpub")
    Write-Host "Total number of webs that will be traversed: " $webs.count
    $DocLibsCount = 0
    $DocLibwItems = 0
    $totalitems = 0
    $subfolderitems = 0
    foreach($web in $webs)
    $listcoll = $web.lists
    foreach($list in $listcoll)
    if($list -eq $null)
    Write-Host
    else
    $base = $list.GetType()
    if($base.name -eq "SPDocumentLibrary")
    if ($systemlibs -contains $list)
    { continue}
    else
    $DocLibsCount += 1
    $totalitems += $List.itemcount
    $name = $list.Title
    $folders = $web.GetFolder($name).SubFolders
    for($etr = 0;$etr -lt $folders.count; $etr++)
    if($folders[$etr].Name -ne "Forms")
    Write-Host "Processing SubFolder ItemCount" -ForegroundColor Red
    $tempcount = $folders[$etr].ItemCount
    $subfolderitems += $tempcount
    Write-Host
    Write-Host
    Write-Host "Total # of Document Libraries: " $DocLibsCount -ForegroundColor Green
    Write-Host "Total # of Document Libraries that contain items: " $DocLibwItems -ForegroundColor Green
    Write-Host "Total # of items: " $totalitems -ForegroundColor Green
    Write-Host "Total # of items in DocLib\Subfolders: " $subfolderitems -ForegroundColor Green
    $finishtime = Get-Date
    Write-Host
    Write-Host “Script Duration” –ForegroundColor Yellow
    Write-Host “Started: “ $starttime –ForegroundColor Yellow
    Write-Host “Finished: “ $finishtime –ForegroundColor Yellow
    Stop-SPAssignment -Global

  • Need Sql Query that Suppress the repeating rows.

    Hi Sir,
    I have below data set.
    DeptID  Sum(SAL) Avg(Sal)
      10      1300      1300
      10      2450      1300
      10      5000      1300
      20      800        800
      20      1100      800
      20      2975      800
      20      3000      800
      30      800        800
      30      1100      800
      30      2975      800
      40      3000      800
      40      4000      900
    I Need  SQL query that can remove the duplicate or suppress.Just like below data set.
    Output:
    DeptID  Sum(SAL) Avg(Sal)
      10      1300      1300
                2450      1300
                5000      1300
      20       800        800
                1100      800
                2975      800
                3000      800
                800        800
      30      1100      800
                2975      800
      40      3000      800
               4000      900
    Could you please help me on this..

    Your requiremnt is more of a reporting request which should not be handled in SQL. For example in SQL Plus you can use the BREAK command
    SQL> break on deptno
    SQL> select deptno, ename from emp order by deptno;
        DEPTNO ENAME
            10 KING
               CLARK
            20 JONES
               SCOTT
               SMITH
               ADAMS
            30 TURNER
               MARTIN
               WARD
               ALLEN
               BLAKE
    11 rows selected.
    SQL>
    But if you still wish to do it in SQL you can use ROW_NUMBER analytic function and achieve it like this
    select decode(rno, 1, deptno) deptno
         , ename
      from (
              select row_number() over(partition by deptno order by ename) rno
                   , deptno
                   , ename
                from emp

  • SQL Query to get the desired result

    Can someone give the SQL to get this output.
    input is like this in table.
    cola     colb     fromdate     todate
    1     100     1/5/2010     1/9/2010
    1     101     1/10/2010     1/25/2010
    1     102     1/26/2010     12/31/2900
    2     201     3/1/2011     3/10/2011
    2     202     3/11/2011     12/31/2900
    3     301     1/5/2010     1/9/2010
    3     302     1/10/2010     1/25/2010
    3     303     1/26/2010     1/28/2010
    3     304     1/29/2010     12/31/2900
    I want to get the output like this.
    cola     colb     fromdate     todate
    1     100     1/5/2010     1/9/2010
    2     201     3/1/2011     3/10/2011
    3     301     1/5/2010     1/9/2010
    More info:
    I want to get the rows where fromdate is the min(fromdate) from each cola's unique values i.e. 1,2,3
    Please let me know the SQL.
    Thanks.
    [email protected]

    This way!!!
    with data(cola, colb, st_dt, ed_dt) as
    select 1,     100,     to_date('01/05/2010', 'MM/DD/YYYY'),     to_date('01/09/2010', 'MM/DD/YYYY') from dual union all
    select 1,     101,  to_date('01/10/2010', 'MM/DD/YYYY'),     to_date('01/25/2010', 'MM/DD/YYYY') from dual union all
    select 1,     102,     to_date('01/26/2010', 'MM/DD/YYYY'),     to_date('12/31/2900', 'MM/DD/YYYY') from dual union all
    select 2,     201,     to_date('03/01/2011', 'MM/DD/YYYY'),     to_date('03/10/2011', 'MM/DD/YYYY') from dual union all
    select 2,     202,     to_date('03/11/2011', 'MM/DD/YYYY'),     to_date('12/31/2900', 'MM/DD/YYYY') from dual union all
    select 3,     301,     to_date('01/05/2010', 'MM/DD/YYYY'),     to_date('01/09/2010', 'MM/DD/YYYY') from dual union all
    select 3,     302,     to_date('01/10/2010', 'MM/DD/YYYY'),     to_date('01/25/2010', 'MM/DD/YYYY') from dual union all
    select 3,     303,     to_date('01/26/2010', 'MM/DD/YYYY'),     to_date('01/28/2010', 'MM/DD/YYYY') from dual union all
    select 3,     304,     to_date('01/29/2010', 'MM/DD/YYYY'),     to_date('12/31/2900', 'MM/DD/YYYY') from dual
    select cola, colb, st_dt, ed_dt
      from (
            select cola, colb, st_dt, ed_dt,
                   row_number() over (partition by cola order by st_dt) rn
              from data
           ) a
    where a.rn = 1;
    COLA COLB ST_DT     ED_DT  
       1  100 05-JAN-10 09-JAN-10
       2  201 01-MAR-11 10-MAR-11
       3  301 05-JAN-10 09-JAN-10

  • SQL query to get the monitor target on a monitor

    Hi!
    I have a list of some custom created Monitors. I need a list of which computers that are using the monitors, the "Monitor target". Please help me with this. It need to be a SQL Query because my powershell have stopped working.

    Yes that is what i have explained you with the screenshot right it is the one in your screen shot also which is mentioned as (This). If this is a default group then you will not get agents for that refer the below link on how to pull agent list of the Target
    group
    http://msdn.microsoft.com/en-us/library/bb960484.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1
    Or look at this. You can see what groups the agents are associated manually one by one by using the default SCOM Task.
    Go to Administration==> Agent managed==> Select the agent ==> Right click it and click View ==> Select state view.
    Once you select this you will have another window opened for that particular agent.
    Then click on the name of the agent and on the right hand side bottom you will have a default made task to check to what group's or Targets this agent is associated to. Run that task and you will get the output.
    Look at the ones highlighted in RED
    Below is the screenshot for your reference. Hope this helps
    Gautam.75801

  • Need sql query to get OIM request pending approval details for one user

    HI OIM Guru,
    It would be great help if someone can provide me sql query by which i can find out how many requests are pending for approval for one user ?

    1. Below query will give you status of all the request.
    SELECT REQ.REQUEST_ID , REQ.REQUEST_STATUS FROM REQUEST REQ
    2. You can have following status
    Obtaining Operation Approval
    Obtaining Template Approval
    Operation Approval Approved
    Operation Approval Rejected
    Post Operation Processing Initiated
    Request Approval Rejected
    Request Closed
    Request Completed
    Request Created
    Request Failed
    Request Withdrawn
    Template Approval Rejected
    3. Now prepare the query from above sapmle, the requset status string should not contains foloowing values.
    Rejected
    Failed
    Closed
    Withdrawn
    Completed
    The builded query will give you the desired result for 11g
    for 10 G
    Get the OST_STATUS from Req table, and do you logic above stated
    -Kuldeep
    Edited by: Kuldeep on May 22, 2012 1:04 AM

  • Need sql query  to get sales channel code

    Hi Experts,
    As per my requirement i need to get the sales channel code by passing invoice number or transaction number ,or concurrent request id, with out any join condition . Please help me on this.
    Regards
    Deb

    1. Below query will give you status of all the request.
    SELECT REQ.REQUEST_ID , REQ.REQUEST_STATUS FROM REQUEST REQ
    2. You can have following status
    Obtaining Operation Approval
    Obtaining Template Approval
    Operation Approval Approved
    Operation Approval Rejected
    Post Operation Processing Initiated
    Request Approval Rejected
    Request Closed
    Request Completed
    Request Created
    Request Failed
    Request Withdrawn
    Template Approval Rejected
    3. Now prepare the query from above sapmle, the requset status string should not contains foloowing values.
    Rejected
    Failed
    Closed
    Withdrawn
    Completed
    The builded query will give you the desired result for 11g
    for 10 G
    Get the OST_STATUS from Req table, and do you logic above stated
    -Kuldeep
    Edited by: Kuldeep on May 22, 2012 1:04 AM

  • SQL query to get the without SCCM agent for a Server

    Hello every one,
    Can I get the SQL query for a server without a SCCM agent . 

    Here you go!!
    Add the version for windows 2012 server if you have them as well in your environment
       v_R_System.Netbios_Name0
      ,v_R_System.Full_Domain_Name0
      ,v_R_System.User_Name0
      ,case
    When v_R_System.Operating_System_Name_and0 LIKE N'%Server 6.1'THEN 'Windows Server 2008 R2'
    When v_R_System.Operating_System_Name_and0 LIKE N'%Server 6.0'THEN 'Windows Server 2008'
    When v_R_System.Operating_System_Name_and0 LIKE N'%Server 5.2'THEN 'Windows Server 2003 R2'
     ELSE 'Unknown Version' END AS 'OS version'
    FROM
      v_R_System
    WHERE
      v_R_System.Operating_System_Name_and0 LIKE N'%server%' and v_R_System.Client0 is null
    Kindly mark as answer/Vote as helpful if a reply from anybody helped you in this forum. Delphin

  • I run this query to get  the result like below, but even though my query is running fine I dont get the expected result.

    I am looking for only column compare for making my target table same as source table.
    My query:
    select case when column_name_s is null and column_name_t is not null
                then 'alter table GRADE_CONVERSION drop ' || column_name_t || ';'
                when column_name_s is not null and column_name_t is null
                then 'alter table GRADE_CONVERSION add ' || column_name_s || ' ' || data_type_s ||';'
                else 'alter table GRADE_CONVERSION modify ' || column_name_t || ' ' || data_type_t ||';'
           end alterations
      from (select s.column_name column_name_s,t.column_name column_name_t,
                   s.data_type data_type_s,t.data_type data_type_t
              from (select column_id,column_name,data_type
                      from all_tab_cols@database
                     where owner = 'erhan'
                       and table_name = 'GRADE_CONVERSION'
                   ) s
                   full outer join
                   (select column_id,column_name,data_type
                      from all_tab_cols@database
                     where owner = 'sarigul'
                       and table_name = 'GRADE_CONVERSION'
                   ) t
                on s.column_name = t.column_name
    Tables:
    Target table:         GRADE_CONVERSION table in sarigul@database
    LETTER_GRADE
    VARCHAR2(2)
    GRADE_POINT
    NUMBER(3,2)
    MAX_GRADE
    NUMBER(3)
    MIN_GRADE
    NUMBER(3)
    Source table:       GRADE_CONVERSION table in erhan@database
    LETTER_GRADE
    VARCHAR2(2)
    GRADE_POINT
    NUMBER(3,2)
    MAX_GRADE
    NUMBER(3)
    MIN_GRADE
    NUMBER(3)
    CREATED_BY
    VARCHAR2(30)
    CREATED_DATE
    DATE
    MODIFIED_BY
    VARCHAR2(30)
    MODIFIED_DATE
    DATE
    want to see the result similar to this *(please ignore the column names here this is just a plain exemple:)
    Alter table Target_table modify BOOK_ID Varchar2 (4);
    Alter table Target_table add ISBN_10 Varchar2(13), null;
    Alter table Target_table drop TITLE;

    I am looking for only column compare for making my target table same as source table.
    My query:
    select case when column_name_s is null and column_name_t is not null
                then 'alter table GRADE_CONVERSION drop ' || column_name_t || ';'
                when column_name_s is not null and column_name_t is null
                then 'alter table GRADE_CONVERSION add ' || column_name_s || ' ' || data_type_s ||';'
                else 'alter table GRADE_CONVERSION modify ' || column_name_t || ' ' || data_type_t ||';'
           end alterations
      from (select s.column_name column_name_s,t.column_name column_name_t,
                   s.data_type data_type_s,t.data_type data_type_t
              from (select column_id,column_name,data_type
                      from all_tab_cols@database
                     where owner = 'erhan'
                       and table_name = 'GRADE_CONVERSION'
                   ) s
                   full outer join
                   (select column_id,column_name,data_type
                      from all_tab_cols@database
                     where owner = 'sarigul'
                       and table_name = 'GRADE_CONVERSION'
                   ) t
                on s.column_name = t.column_name
    Tables:
    Target table:         GRADE_CONVERSION table in sarigul@database
    LETTER_GRADE
    VARCHAR2(2)
    GRADE_POINT
    NUMBER(3,2)
    MAX_GRADE
    NUMBER(3)
    MIN_GRADE
    NUMBER(3)
    Source table:       GRADE_CONVERSION table in erhan@database
    LETTER_GRADE
    VARCHAR2(2)
    GRADE_POINT
    NUMBER(3,2)
    MAX_GRADE
    NUMBER(3)
    MIN_GRADE
    NUMBER(3)
    CREATED_BY
    VARCHAR2(30)
    CREATED_DATE
    DATE
    MODIFIED_BY
    VARCHAR2(30)
    MODIFIED_DATE
    DATE
    want to see the result similar to this *(please ignore the column names here this is just a plain exemple:)
    Alter table Target_table modify BOOK_ID Varchar2 (4);
    Alter table Target_table add ISBN_10 Varchar2(13), null;
    Alter table Target_table drop TITLE;

  • SQL query to get the responsibility name

    Hi,
    I require an SQL query which would give the responsibilty name to which the concurrent programs are assigned.
    Thanks& Regards,

    SELECT          fcpv.user_concurrent_program_name
    FROM            fnd_request_groups frg,
                    fnd_request_group_units frgu,
                    fnd_concurrent_programs_vl fcpv,
                    fnd_responsibility_vl frv
    WHERE           frgu.request_group_id = frg.request_group_id
    AND             frgu.request_unit_id = fcpv.concurrent_program_id
    AND             frv.request_group_id = frg.request_group_id
    AND           frgu.request_unit_type = 'P'
    AND             frv.responsibility_name =<Responsibility Name>Regards
    Prashant Pathak

  • SQL query to get the current session info

    I've a query in my application to view the all the sessions within database
    select
    substr(a.spid,1,9) pid,
    substr(b.sid,1,5) sid,
    substr(b.serial#,1,5) ser#,
    substr(b.machine,1,6) box,
    substr(b.username,1,10) username,
    -- b.server,
    substr(b.osuser,1,8) os_user,
    substr(b.program,1,30) program
    from
    v$session b,
    v$process a
    where
    b.paddr = a.addr
    and type='USER'
    order by spid;
    Can someone help me with a query to view the info of the session where I'm in currently?
    Thanks,
    Gabriel Stephen.

    here's one way to do it.
    select
       substr(a.spid,1,9) pid,
       substr(b.sid,1,5) sid,
       substr(b.serial#,1,5) ser#,
       substr(b.machine,1,6) box,
       substr(b.username,1,10) username,
       -- b.server,
       substr(b.osuser,1,8) os_user,
       substr(b.program,1,30) program
    from
       v$session b,
       v$process a
    where
       b.paddr = a.addr
       and type='USER'
       and b.sid=(select sid from v$mystat where rownum=1)
    order by spid-------------
    Anwar

Maybe you are looking for

  • Final Cut Studio 2 Apple Loops, Jam Packs and Logic express 8 installation?

    Hi(Bonjour)! I've currently use Final Cut Studio 2 +Soundtrack Pro 2.0.2+ application with all included Apple Loops. I own several Jam Pack Apple Loops packages (with a less than impressive integration with Garage Band for older one). I purchased Log

  • Re installing premiere on my new mac

    how can I reinstall the program.  I had a PC with the program and it crashed and now I need to install it onto my new mac.

  • Payment Grantee Procedure

    Hello In Sales Order Header.... Billing Tab there is a Payment Grantee Procedure and Financial Document Number. What is the use of these fields in Foreign Trade Data. How are these fields determined in Sales order and what is the impact of these fiel

  • Passing value from Portal Form as parameter to portal report

    I have a portal form that I have created using the custom form layout editor to build/modify the display of the form. When I run the form and I have a record queried I would like to be able to click a link and pass the value of a field as a parameter

  • Oracle Certification without attending classes

    Hi All, I am currently planning to pursue my OCA and OCP from oracle. However, is it possible that I can only take the exam without attending classes at oracle and get the certificate. Or is it mandatory for someone to attend classes at oracle or ora