Please convert this query to UPDATE query.

   Hi Experts,

Hello 976208
You can update the columns only in the table which is assigned to the MERGE INTO keywords. -> In this case only in the WEB_SALE_EMP Table.
There is a possibility that you can update / Insert complex codes if and only if this is created as a VIEW!
So, in this case, because you do not have any view on the two tables ( WEB_SALE_EMP and WEB_DELIVERY WD ) you can only update the WEB_SALE_EMP table.
    MERGE INTO WEB_SALE_EMP WE
    USING
        SELECT
            WBE.SHIPNT_ID SHIPNT_ID, WBE.SHIPNT_SRC SHIPNT_SRC, WBE.WB_ID WB_ID, WBE.SHIPNO SHIPNO, WBE.TAG_NO TAG_NO,
            CAST(COALESCE(WD.VALUE,'0') AS NUMBER) WB_VAL,
            SUM(WBE.REV * WBE.AMOUNT) AS Sum_Rev
        FROM WEB_SALE_EMP WBE
        INNER JOIN WEB_DELIVERY WD ON (WBE.WB_ID = WD.PG_ID AND WD.OPERATION = 'DISCOUNT')
        WHERE SHIPMNT_TYPE ='AIR_DISPATCH'
              AND WB_ID = p_PG_ID
              AND SHIPNT_ID = 2
              AND DESCP IS NOT NULL
              AND SALE_CODE IS NOT NULL
              AND UNIT IS NOT NULL
        GROUP BY SHIPNT_ID, SHIPNT_SRC, WB_ID, SHIPNO, TAG_NO,
            CAST(COALESCE(WD.VALUE,'0') AS NUMBER)
        HAVING SUM(WBE.REV * WBE.AMOUNT) > CAST(COALESCE(WD.VALUE,'0') AS NUMBER)
    )v
    ON( we.SHIPNT_ID = v.SHIPNT_ID
        AND we.SHIPNT_SRC = v.SHIPNT_SRC
        AND we.WB_ID = v.WB_ID
        AND we.SHIPNO = v.SHIPNO
        AND we.TAG_NO = v.TAG_NO
    WHEN MATCHED THEN
    UPDATE SET we.DELIVERY_TYPE = 'AIR'
    WHERE DESCP IS NOT NULL
        AND SALE_CODE IS NOT NULL
        AND UNIT IS NOT NULL
        AND we.WB_ID = 9
        AND we.SHIPNT_ID = 3;
Without these columns should your sql works.
I hope this helps you.
Regards,
David
IMPORTANT: Please use always QUALIFIED Column-names in a complex sql code!  (Example: wb_id = ... is bad! -> Good:  TABLE_ALIAS.wb_id = .... !)

Similar Messages

  • Please convert this query to update.

    Hi Experts,
    Please convert this MERGE statment to UPDATE.
    MERGE INTO CUSTOMER_DTLS CDT
        USING
            SELECT CDT.CDT_ID, CDT.CDT_ITEMREQ_NO, CDT_UNIT_NO, CDT.CDT_UPDATE_DT, OST.SalesName, OST.Team, OST.Team_ID
            FROM CUSTOMER_DTLS CDT
            INNER JOIN REVEN_MAP RMP ON CDT.CDT_ID = RMP.ORG_ID
            INNER JOIN SALES_DTLS OST ON RMP.WB_IBU = OST.IBU AND OST.Rep_Code = CDT.CDT_SECSALESREP
            WHERE CDT.PRODUCT_SEC = 'M'
            AND CDT.CDT_ID = 600
        ) SALES_QUERY
        ON(
                CDT.CDT_ID = SALES_QUERY.CDT_ID
            AND CDT.CDT_ITEMREQ_NO = SALES_QUERY.CDT_ITEMREQ_NO
            AND CDT.CDT_UNIT_NO = SALES_QUERY.CDT_UNIT_NO
            AND CDT.CDT_UPDATE_DT = SALES_QUERY.CDT_UPDATE_DT
            AND CDT.PRODUCT_SEC = 'M'
        WHEN MATCHED THEN
        UPDATE SET CDT.CDT_SALES_REP  = SALES_QUERY.SalesName,
                CDT.CDT_OutSide_SALES_DTLS     = SALES_QUERY.Team,
                CDT.CDT_OutSide_Team_ID        = SALES_QUERY.Team_ID
        WHERE CDT.CDT_SALES_REP IS NULL
        AND CDT.PRODUCT_SEC = 'M'
        AND CDT.CDT_ID = 600;
    Please help me.
        Thanks.

    Hi All,
    The merge query first doing join and make it as a SALES_QUERY query.
            SELECT CDT.CDT_ID, CDT.CDT_ITEMREQ_NO, CDT_UNIT_NO, CDT.CDT_UPDATE_DT, OST.SalesName, OST.Team, OST.Team_ID
            FROM CUSTOMER_DTLS CDT
            INNER JOIN REVEN_MAP RMP ON CDT.CDT_ID = RMP.ORG_ID
            INNER JOIN SALES_DTLS OST ON RMP.WB_IBU = OST.IBU AND OST.Rep_Code = CDT.CDT_SECSALESREP
            WHERE CDT.PRODUCT_SEC = 'M'
            AND CDT.CDT_ID = 600
        ) SALES_QUERY
    On top of it using the result of SALES_QUERY checking the following matching.
    ON(
                CDT.CDT_ID = SALES_QUERY.CDT_ID
            AND CDT.CDT_ITEMREQ_NO = SALES_QUERY.CDT_ITEMREQ_NO
            AND CDT.CDT_UNIT_NO = SALES_QUERY.CDT_UNIT_NO
            AND CDT.CDT_UPDATE_DT = SALES_QUERY.CDT_UPDATE_DT
            AND CDT.PRODUCT_SEC = 'M'
    But in your update it's just joining and after that not used any of these values for comparison.
    CDT.CDT_ID, CDT.CDT_ITEMREQ_NO, CDT_UNIT_NO, CDT.CDT_UPDATE_DT, OST.SalesName, OST.Team, OST.Team_ID
    How this works.
    Please explain.
    Thanks.

  • Please convert decode query to case expression

    Please convert decode query to case expression
    Decode(Sign(id), 1, id, null) positive, Decode(Sign(id), -1, id, null) negative from dual;

    this is a serious forums that help people, if you want that we do your "homeworks" i must told you that you should pay us for that.
    Edited by: Fran on 05-jun-2013 23:41
    1002966     
    Handle:      1002966 
    Status Level:      Newbie
    Registered:      Apr 28, 2013
    Total Posts:      20
    Total Questions:      12 (12 unresolved)

  • Please show this query, data not showing why?

    I created a report and write following query,it was working well since last 4 months but today automaticly not showing data I can undertstand why?
    Becuase I didnt make any changes in this query.
    Please help me
    Urgent
    SELECT ALL MERCH_ORDER.ORDERNO, MERCH_ORDER.ORDERDATE, MERCH_ORDER.SHIP_DATE, MERCH_ORDER.PONO,
    MERCH_ORDER.SUBPP, MERCH_ORDER.PJNO, BUYER.B_NAME, BUYER.B_AJENT,
    MERCH_ORDER.ITEM, MERCH_ORDER.FABRIC, MERCH_ORDER.QUALITY, MERCH_ORDER.COMPOSITION,
    MERCH_ORDER.P_SIZE, MERCH_ORDER.QUANTITY, MERCH_ORDER.Q_UNIT,
    MERCH_ORDER.NETWHT, MERCH_ORDER.WT_UNIT, MERCH_ORDER.TERM, MERCH_ORDER.COMM,
    MERCH_ORDER.PRICE, MERCH_ORDER.CUR_SYMB, MERCH_ORDER.STATUS, MERCH_ORDER.REMARKS,
    MERCH_ORDER.WONO, MERCH_ORDER.PRONO, MERCH_ORDER.PES_QUANTITY,
    MERCH_ORDER.PES_Q_UNIT, MERCH_ORDER.PES_PRICE, MERCH_ORDER.PES_CUR_SYMB
    FROM BUYER, MERCH_ORDER
    WHERE MERCH_ORDER.CANCEL IS NULL
    AND (MERCH_ORDER.B_CODE = BUYER.B_CODE)
    and merch_order.orderno not in
    (select export_order1.orderno from export_order1)
    ORDER BY MERCH_ORDER.ORDERNO
    there is no any error and msg header and footer print.

    Maybe , the query in "NOT IN" clause select export_order1.orderno from export_order1
    return the same rows as the following portion return....
    SELECT ALL MERCH_ORDER.ORDERNO, MERCH_ORDER.ORDERDATE, MERCH_ORDER.SHIP_DATE, MERCH_ORDER.PONO,
    MERCH_ORDER.SUBPP, MERCH_ORDER.PJNO, BUYER.B_NAME, BUYER.B_AJENT,
    MERCH_ORDER.ITEM, MERCH_ORDER.FABRIC, MERCH_ORDER.QUALITY, MERCH_ORDER.COMPOSITION,
    MERCH_ORDER.P_SIZE, MERCH_ORDER.QUANTITY, MERCH_ORDER.Q_UNIT,
    MERCH_ORDER.NETWHT, MERCH_ORDER.WT_UNIT, MERCH_ORDER.TERM, MERCH_ORDER.COMM,
    MERCH_ORDER.PRICE, MERCH_ORDER.CUR_SYMB, MERCH_ORDER.STATUS, MERCH_ORDER.REMARKS,
    MERCH_ORDER.WONO, MERCH_ORDER.PRONO, MERCH_ORDER.PES_QUANTITY,
    MERCH_ORDER.PES_Q_UNIT, MERCH_ORDER.PES_PRICE, MERCH_ORDER.PES_CUR_SYMB
    FROM BUYER, MERCH_ORDER
    WHERE MERCH_ORDER.CANCEL IS NULL
    AND (MERCH_ORDER.B_CODE = BUYER.B_CODE)
    OR
    there are no rows which conform to the joining condition between the two tables BUYER and MERCH_ORDER ....
    Regards,
    Simon

  • Please tune this query.

    Hi Experts,
    My below query is taking long time.
    [code]SELECT FAX_LIST.*
        FROM (SELECT /*+ use_nl(fax, src)  */
                    ROW_NUMBER () OVER (ORDER BY fax.ID ASC NULLS FIRST) RN,
                     fax.ACCOUNT_TYPE,
                     fax.BU_FILE_LOCATION,
                     fax.COUNT_PAGES_RECEIVED,
                     NVL (fax.CUSTOMER_NAME, fax.SENDER_NAME) AS CUSTOMER_NAME,
                     fax.FAX_SOURCE,
                     fax.CUSTOMER_NUMBER,
                     fax.CUSTOMER_OMEGA_NUMBER,
                     fax.GENIFAX_RECIPIENT_ID,
                     fax.ID AS FAX_ID,
                     fax.DATE_RECEIVED AS FAX_RECEIVED,
                     fax.IS_LOCKED,
                     fax.LOCKED_BY,
                     fax.ORIGINATOR_CSI,
                     fax.MARGIN,
                     fax.PAYMENT_TYPE,
                     fax.PRIORITY_CODE,
                     fax.PRIORITY_VALUE,
                     FROM_TZ (fax.DATE_RECEIVED, 'UTC')
                        AT TIME ZONE fax.LOCAL_TZ_NAME
                        AS DATE_RECEIVED,
                     fax.SALES_PERSON,
                     fax.SENDER_EMAIL,
                     fax.SENDER_NAME,
                     fax.SUBJECT,
                     fax.WORKGROUP_ID,
                     fax.LOCKED_TIME,
                     src.DESCRIPTION,
                     src.FAX_NUMBER,
                     src.WORKFLOW_ID,
                     fax.CREATED_BY,
                     fax.CREATED_DATE,
                     fax.UPDATE_DATE,
                     fax.UPDATED_BY,
                     fax.RESERVED_BY,
                     fax.PRICE_TO_ORDER,
                     fax.SKU_COUNT_TO_ORDER,
                     NVL (ORL.GET_FTH_WTR (fax.LAST_TRANSITION_ID).CHANGED_BY,
                        CASE
                           WHEN fax.LAST_TRANSITION_ID IS NULL
                                AND fax.GENIFAX_RECIPIENT_ID IS NOT NULL
                           THEN
                              'ORL FEEDER'
                           ELSE
                              'Admin'
                        END)
                        AS LAST_USER,
                     FROM_TZ (
                        NVL (ORL.GET_FTH_WTR (fax.LAST_TRANSITION_ID).CHANGED_DATE,
                             fax.DATE_RECEIVED),
                        'UTC')
                        AT TIME ZONE fax.LOCAL_TZ_NAME
                        AS MOVE_DATETIME,
                     NVL (ORL.GET_FTH_WTR (fax.LAST_TRANSITION_ID).REASON,
                          'Reroute')
                        AS MOVE_REASON,
                     NVL (
                        (SELECT fw.DESCRIPTION
                           FROM ORL.WORKGROUP_TRANSITION wt, ORL.WORKGROUP fw
                          WHERE wt.ID =
                                   ORL.GET_FTH_WTR (fax.LAST_TRANSITION_ID).WORKGROUP_TRANSITION_ID
                                AND fw.ID = wt.CURRENT_WORKGROUP_ID),
                        CASE
                           WHEN fax.LAST_TRANSITION_ID IS NULL
                                AND fax.GENIFAX_RECIPIENT_ID IS NOT NULL
                           THEN
                              'ORL FEEDER STAGING'
                           ELSE
                              'N/A'
                        END)
                        AS OLD_STATUS,
                     (SELECT MAX (PURCHASE_ORDER_NUMBER)
                        FROM ORL.FAX_OFFER_DETAIL
                       WHERE FAX_ID = fax.ID)
                        AS MAXPO,
                     (SELECT CASE COUNT (PURCHASE_ORDER_NUMBER)
                                WHEN 0 THEN NULL
                                ELSE COUNT (PURCHASE_ORDER_NUMBER)
                             END
                                AS POCOUNT
                        FROM ORL.FAX_OFFER_DETAIL
                       WHERE FAX_ID = fax.ID)
                        AS POCOUNT,
                     (SELECT SUM (VALUE) AS ORDER_VALUE
                        FROM ORL.FAX_OFFER_DETAIL
                       WHERE FAX_ID = fax.ID)
                        AS ORDER_VALUE,
                     fax.SALESPERSON_NAME,
                     fax.GROUP_NAME,
                     fax.ROLE_NAME,
                     fax.EMAIL,
                     fax.SALES_CHANNEL
                FROM (SELECT fax.*,
                             map.ORACLE_TZ_NAME AS LOCAL_TZ_NAME,
                             ORL.GET_SALESPERSON (map.ORG_ID, fax.SALES_PERSON).SALESPERSON_NAME
                                AS SALESPERSON_NAME,
                             ORL.GET_SALESPERSON (map.ORG_ID, fax.SALES_PERSON).GROUP_NAME
                                AS GROUP_NAME,
                             ORL.GET_SALESPERSON (map.ORG_ID, fax.SALES_PERSON).ROLE_NAME
                                AS ROLE_NAME,
                             ORL.GET_SALESPERSON (map.ORG_ID, fax.SALES_PERSON).EMAIL
                                AS EMAIL,
                             ORL.GET_SALESPERSON (map.ORG_ID, fax.SALES_PERSON).SALES_CHANNEL
                                AS SALES_CHANNEL
                        FROM APPS_GLOBAL.GLOBAL_BU_MAPPING map,
                             (SELECT *
                                FROM ORL.FAX_HEADER FH
                               WHERE FH.WORKGROUP_ID = 262) fax
                       WHERE map.GEDIS = 'Y'
                             AND map.BU_ID = (SELECT BUID
                                                FROM ORL.WORKGROUP
                                               WHERE ID = fax.WORKGROUP_ID)
                             AND ORL.GET_SALESPERSON (map.ORG_ID, fax.SALES_PERSON).SALESPERSON_NAME =
                                    'A_CARRICK') fax,
                     (SELECT *
                        FROM ORL.FAX_SOURCE FS
                       WHERE FS.WORKFLOW_ID IN
                                (SELECT  /*+ CARDINALITY(t, 1) */
                                       TO_NUMBER (
                                           COLUMN_VALUE)
                                           AS COLUMN_VALUE
                                   FROM TABLE (
                                           SplitClob ('1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
            16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
            32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
            48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
            64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
            80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
            96, 97, 98', ',')) t)) src
               WHERE src.ID(+) = fax.FAX_SOURCE) FAX_LIST
       WHERE RN BETWEEN 1 AND 100
    ORDER BY RN ASC;[/code]
    In my query the following three functions are using.
    ORL.GET_FTH_WTR
    ORL.GET_SALESPERSON
    APPS_GLOBAL.SplitClob
    [code]CREATE OR REPLACE FUNCTION ORL.GET_FTH_WTR(p_LAST_TRANSITION_ID NUMBER)
            RETURN ORL.FTH_WTR_T
            DETERMINISTIC
        IS
            v_REASON nvarchar2(1024 char);
            v_WORKGROUP_TRANSITION_ID number;
            v_CHANGED_BY nvarchar2(64 char);
            v_CHANGED_DATE timestamp(6);
        BEGIN
        SELECT
            WTR.REASON,
            wtr.WORKGROUP_TRANSITION_ID,
            fth.CHANGED_BY,
            fth.CHANGED_DATE
        INTO
            v_REASON,
            v_WORKGROUP_TRANSITION_ID,
            v_CHANGED_BY,
            v_CHANGED_DATE
        FROM
            ORL.FAX_TRANSITION_HISTORY fth,
            ORL.WORKGROUP_TRANSITION_REASON wtr
        WHERE
             fth.ID = p_LAST_TRANSITION_ID
            AND wtr.ID(+) = fth.TRANSITION_REASON_ID;
        RETURN ORL.FTH_WTR_T(v_CHANGED_BY, v_CHANGED_DATE, v_REASON, v_WORKGROUP_TRANSITION_ID);
        EXCEPTION
            WHEN NO_DATA_FOUND THEN
            RETURN ORL.FTH_WTR_T(NULL, NULL, NULL, NULL);
        END GET_FTH_WTR;
    CREATE OR REPLACE function ORL.GET_SALESPERSON(ORG_ID number, SALESPERSON_ID number)
        return ORL.SALESPERSON_T
        deterministic
    is
        apps_bu             varchar2(30);
        salesperson_name    varchar2(150 char);
        email               varchar2(70 char);
        sales_channel       varchar2(60 char);
        role_name           varchar2(60 char);
        group_name          varchar2(60 char);
    begin
        select OWNER_NAME into apps_bu
          from APPS_GLOBAL.GLOBAL_BU_MAPPING
         where ORG_ID = GET_SALESPERSON.ORG_ID;
        execute immediate
        replace('
            select SALESPERSON_NAME
                 , EMAIL
                 , SALES_CHANNEL
                 , ROLE_NAME
                 , GROUP_NAME
              from APPS_**.ORL_ACTIVE_SALESPERSON
             where SALESPERSON_ID = :1
      and  rownum = 1
                ', 'APPS_**', apps_bu)
        into salesperson_name, email, sales_channel, role_name, group_name
        using SALESPERSON_ID;
        return SALESPERSON_T(ORG_ID, SALESPERSON_ID, salesperson_name, email, sales_channel, role_name, group_name);
    exception
        when no_data_found then
            return SALESPERSON_T(null, null, null, null, null, null, null);
    end GET_SALESPERSON;
    CREATE OR REPLACE function APPS_GLOBAL.SplitClob
        p_clob          clob
      , p_delimiter     varchar2 := ','
    return StringTable
    deterministic
    pipelined
    as
        v_current_pos   pls_integer := 1;
        v_delimiter_pos pls_integer;
    begin
        if (p_clob is not NULL) and (p_delimiter is not NULL) then
            while v_current_pos <= length(p_clob) loop
                v_delimiter_pos := instr(p_clob, p_delimiter, v_current_pos);
                if  v_delimiter_pos < 1  then   -- no more delimiters
                    v_delimiter_pos := length(p_clob) + 1;
                end if;
                pipe row( to_char( substr(p_clob,
                                          v_current_pos,
                                          v_delimiter_pos - v_current_pos) ) );
                v_current_pos := v_delimiter_pos + length(p_delimiter);
            end loop;
        end if;
    end SplitClob;
    CREATE OR REPLACE TYPE SALESPERSON_T  AS OBJECT
      SALESPERSON_ID        number(15)
    , SALESPERSON_NUMBER    varchar2(150 char)
    , FIRST_NAME            varchar2(20 char)
    , LAST_NAME             varchar2(40 char)
    , SALES_CHANNEL         varchar2(60 char)
    , ORG_ID                number(15)
    , USER_NAME             varchar2(61 char)
    , EFFECTIVE_START_DATE  date
    , EFFECTIVE_END_DATE    date
    , STATUS_FLAG           varchar2(1 char)
    , EMAIL                 varchar2(70 char)
    , WORK_TELEPHONE        varchar2(60 char)
    , MANAGERS_NAME         varchar2(50 char)
    , FAX_NO                varchar2(60 char)
    , SALESPERSON_NAME      varchar2(30 char)
    , TERRITORY             varchar2(40 char)
    , FO_LOGON              varchar2(150 char)
    , BO_LOGON              varchar2(150 char)
    , SUB_CHANNEL           varchar2(25 char)
    , BUSINESS_SEGMENT      varchar2(3 char)
    , DISCOUNT_NAME         varchar2(30 char)
    , RESPONSIBILITY_ID     number
    , RESPONSIBILITY_KEY    varchar2(30 char)
    CREATE OR REPLACE TYPE STRINGTABLE as table of varchar2(4000);[/code]
    The total number of records in each table.
    [code]SELECT COUNT(*) FROM ORL.FAX_HEADER FH --4397829
    SELECT COUNT(*) FROM APPS_GLOBAL.GLOBAL_BU_MAPPING map --31
    SELECT COUNT(*) FROM ORL.WORKGROUP_TRANSITION  --6735
    SELECT COUNT(*) FROM ORL.WORKGROUP fw --1495
    SELECT COUNT(*) FROM ORL.FAX_OFFER_DETAIL --5904039
    SELECT COUNT(*) FROM  ORL.FAX_SOURCE--2368 --2457[/code]
    Indexes on the columns.
    [code]ORL.WORKGROUP_TRANSITION(ID),
    ORL.WORKGROUP(ID),
    ORL.FAX_OFFER_DETAIL(FAX_ID),
    ORL.FAX_HEADER(WORKGROUP_ID).[/code]
    Please help me to tune this query.
    Thanks in advance.

    Hi,
    Thanks for your reply.
    For split the numbers into different rows , we are sending randomly.
    It's not constant numbers.We have used bind variables.
    For testing purpose I have hard coded the values.
    How to do this split without using user defined function.
    I am sending the actual query along with execution plan without any hints.
    [code]SELECT   FAX_LIST.*
      FROM   (SELECT   ROW_NUMBER () OVER (ORDER BY fax.ID ASC) RN,
                       fax.ACCOUNT_TYPE,
                       fax.BU_FILE_LOCATION,
                       fax.COUNT_PAGES_RECEIVED,
                       NVL (fax.CUSTOMER_NAME, fax.SENDER_NAME) AS CUSTOMER_NAME,
                       fax.FAX_SOURCE,
                       fax.CUSTOMER_NUMBER,
                       fax.CUSTOMER_OMEGA_NUMBER,
                       fax.GENIFAX_RECIPIENT_ID,
                       fax.ID AS FAX_ID,
                       fax.DATE_RECEIVED AS FAX_RECEIVED,
                       fax.IS_LOCKED,
                       fax.LOCKED_BY,
                       fax.ORIGINATOR_CSI,
                       fax.MARGIN,
                       fax.PAYMENT_TYPE,
                       fax.PRIORITY_CODE,
                       fax.PRIORITY_VALUE,
                       FROM_TZ (fax.DATE_RECEIVED, 'UTC') AT TIME ZONE map.ORACLE_TZ_NAME AS DATE_RECEIVED,
                       fax.SALES_PERSON,
                       fax.SENDER_EMAIL,
                       fax.SENDER_NAME,
                       fax.SUBJECT,
                       fax.WORKGROUP_ID,
                       fax.LOCKED_TIME,
                       src.DESCRIPTION,
                       src.FAX_NUMBER,
                       src.WORKFLOW_ID,
                       fax.CREATED_BY,
                       fax.CREATED_DATE,
                       fax.UPDATE_DATE,
                       fax.UPDATED_BY,
                       fax.RESERVED_BY,
                       fax.PRICE_TO_ORDER,
                       fax.SKU_COUNT_TO_ORDER,
                       NVL (
                          ORL.GET_FTH_WTR (fax.LAST_TRANSITION_ID).CHANGED_BY,
                          CASE
                             WHEN fax.LAST_TRANSITION_ID IS NULL
                                  AND fax.GENIFAX_RECIPIENT_ID IS NOT NULL
                             THEN
                                'ORL FEEDER'
                             ELSE
                                'Admin'
                          END
                          AS LAST_USER,
                       FROM_TZ (NVL (ORL.GET_FTH_WTR (fax.LAST_TRANSITION_ID).CHANGED_DATE,fax.DATE_RECEIVED),'UTC')
                       AT TIME ZONE map.ORACLE_TZ_NAME AS MOVE_DATETIME,
                       NVL (ORL.GET_FTH_WTR (fax.LAST_TRANSITION_ID).REASON,'Reroute')AS MOVE_REASON,
                       NVL ((SELECT   fw.DESCRIPTION
                             FROM   ORL.WORKGROUP_TRANSITION wt, ORL.WORKGROUP fw
                            WHERE   wt.ID =
                                       ORL.GET_FTH_WTR (
                                          fax.LAST_TRANSITION_ID
                                       ).WORKGROUP_TRANSITION_ID
                                    AND fw.ID = wt.CURRENT_WORKGROUP_ID),
                          CASE
                             WHEN fax.LAST_TRANSITION_ID IS NULL
                                  AND fax.GENIFAX_RECIPIENT_ID IS NOT NULL
                             THEN
                                'ORL FEEDER STAGING'
                             ELSE
                                'N/A'
                          END
                          AS OLD_STATUS,
                       (SELECT   MAX (PURCHASE_ORDER_NUMBER)
                          FROM   ORL.FAX_OFFER_DETAIL
                         WHERE   FAX_ID = fax.ID)
                          AS MAXPO,
                       (SELECT   CASE COUNT (PURCHASE_ORDER_NUMBER)
                                    WHEN 0 THEN NULL
                                    ELSE COUNT (PURCHASE_ORDER_NUMBER)
                                 END
                                    AS POCOUNT
                          FROM   ORL.FAX_OFFER_DETAIL
                         WHERE   FAX_ID = fax.ID)
                          AS POCOUNT,
                       (SELECT   SUM (VALUE) AS ORDER_VALUE
                          FROM   ORL.FAX_OFFER_DETAIL
                         WHERE   FAX_ID = fax.ID) AS ORDER_VALUE,
                       ORL.GET_SALESPERSON (map.ORG_ID,fax.SALES_PERSON).SALESPERSON_NAME AS SALESPERSON_NAME,
                       ORL.GET_SALESPERSON (map.ORG_ID,fax.SALES_PERSON).GROUP_NAME AS GROUP_NAME,
                       ORL.GET_SALESPERSON (map.ORG_ID,fax.SALES_PERSON).ROLE_NAME AS ROLE_NAME,
                       ORL.GET_SALESPERSON (map.ORG_ID, fax.SALES_PERSON).EMAIL AS EMAIL,
                       ORL.GET_SALESPERSON (map.ORG_ID, fax.SALES_PERSON).SALES_CHANNEL AS SALES_CHANNEL
                FROM   ORL.FAX_HEADER fax,
                       APPS_GLOBAL.GLOBAL_BU_MAPPING map,
                       ORL.FAX_SOURCE src
               WHERE       fax.WORKGROUP_ID = :WORKGROUP_ID
                       AND map.GEDIS = 'Y'
                       AND map.BU_ID = (SELECT   BUID
                                          FROM   ORL.WORKGROUP
                                         WHERE   ID = fax.WORKGROUP_ID)
                       AND ORL.GET_SALESPERSON (map.ORG_ID,fax.SALES_PERSON).GROUP_NAME =:SALES_TEAM
                       AND ORL.GET_SALESPERSON (map.ORG_ID,fax.SALES_PERSON
                          ).SALESPERSON_NAME = :SALESPERSON_NAME
                       AND src.WORKFLOW_ID IN
                                (SELECT TO_NUMBER (COLUMN_VALUE) AS COLUMN_VALUE
                                   FROM table(SplitClob (:WORKFLOW_ID,:WORKFLOW_ID_delim)) t)
                       AND src.ID(+) = fax.FAX_SOURCE) FAX_LIST
    WHERE   RN BETWEEN 1 AND 100;
    Execution Plan
    | Id  | Operation                               | Name                    | Rows  | Bytes | Cost (%CPU)|
    |   0 | SELECT STATEMENT                        |                         |     2 | 12092 | 88923   (1)|
    |   1 |  NESTED LOOPS                           |                         |     1 |    38 |     3   (0)|
    |   2 |   TABLE ACCESS BY INDEX ROWID           | WORKGROUP_TRANSITION    |     1 |     9 |     2   (0)|
    |   3 |    INDEX UNIQUE SCAN                    | PK_WORKGROUP_TRANSITION |     1 |       |     1   (0)|
    |   4 |   TABLE ACCESS BY INDEX ROWID           | WORKGROUP               |  1482 | 42978 |     1   (0)|
    |   5 |    INDEX UNIQUE SCAN                    | PK_WORKGROUP            |     1 |       |     0   (0)|
    |   6 |  SORT AGGREGATE                         |                         |     1 |    16 |            |
    |   7 |   TABLE ACCESS BY INDEX ROWID           | FAX_OFFER_DETAIL        |     1 |    16 |     5   (0)|
    |   8 |    INDEX RANGE SCAN                     | FAX_OFFER_DETAIL_IDX1   |     1 |       |     3   (0)|
    |   9 |  SORT AGGREGATE                         |                         |     1 |    16 |            |
    |  10 |   TABLE ACCESS BY INDEX ROWID           | FAX_OFFER_DETAIL        |     1 |    16 |     5   (0)|
    |  11 |    INDEX RANGE SCAN                     | FAX_OFFER_DETAIL_IDX1   |     1 |       |     3   (0)|
    |  12 |  SORT AGGREGATE                         |                         |     1 |    11 |            |
    |  13 |   TABLE ACCESS BY INDEX ROWID           | FAX_OFFER_DETAIL        |     1 |    11 |     5   (0)|
    |  14 |    INDEX RANGE SCAN                     | FAX_OFFER_DETAIL_IDX1   |     1 |       |     3   (0)|
    |  15 |  VIEW                                   |                         |     2 | 12092 | 88923   (1)|
    |  16 |   WINDOW SORT PUSHED RANK               |                         |     2 |  1378 | 88923   (1)|
    |  17 |    NESTED LOOPS                         |                         |       |       |            |
    |  18 |     NESTED LOOPS                        |                         |     2 |  1378 | 88920   (1)|
    |  19 |      NESTED LOOPS                       |                         | 18420 |    11M| 70490   (1)|
    |  20 |       HASH JOIN RIGHT SEMI              |                         |    69 |  3657 |    49   (3)|
    |  21 |        COLLECTION ITERATOR PICKLER FETCH| SPLITCLOB               |  8168 | 16336 |    29   (0)|
    |  22 |        TABLE ACCESS FULL                | FAX_SOURCE              |  2409 |   119K|    19   (0)|
    |  23 |       TABLE ACCESS BY INDEX ROWID       | FAX_HEADER              |   268 |   160K|  2854   (1)|
    |  24 |        INDEX RANGE SCAN                 | FAX_HEADER_FS_IDX       |  4345 |       |     7   (0)|
    |  25 |      INDEX RANGE SCAN                   | GLOBAL_BU_MAPPING_BUID  |     1 |       |     0   (0)|
    |  26 |       TABLE ACCESS BY INDEX ROWID       | WORKGROUP               |     1 |     8 |     2   (0)|
    |  27 |        INDEX UNIQUE SCAN                | PK_WORKGROUP            |     1 |       |     1   (0)|
    |  28 |     TABLE ACCESS BY INDEX ROWID         | GLOBAL_BU_MAPPING       |     1 |    24 |     1   (0)|
    Note
       - 'PLAN_TABLE' is old version
    Statistics
         894400  recursive calls
             60  db block gets
        7402741  consistent gets
              0  physical reads
              0  redo size
          46309  bytes sent via SQL*Net to client
            430  bytes received via SQL*Net from client
              8  SQL*Net roundtrips to/from client
         848304  sorts (memory)
              0  sorts (disk)
            100  rows processed[/code]
    Please help me.
    Thanks in advance.

  • Please see this query, not showing data Why?

    I created a report and write following query,it was working well since last 4 months but today automaticly not showing data I can undertstand why?
    Becuase I didnt make any changes in this query.
    Please help me
    Urgent
    SELECT ALL MERCH_ORDER.ORDERNO, MERCH_ORDER.ORDERDATE, MERCH_ORDER.SHIP_DATE, MERCH_ORDER.PONO,
    MERCH_ORDER.SUBPP, MERCH_ORDER.PJNO, BUYER.B_NAME, BUYER.B_AJENT,
    MERCH_ORDER.ITEM, MERCH_ORDER.FABRIC, MERCH_ORDER.QUALITY, MERCH_ORDER.COMPOSITION,
    MERCH_ORDER.P_SIZE, MERCH_ORDER.QUANTITY, MERCH_ORDER.Q_UNIT,
    MERCH_ORDER.NETWHT, MERCH_ORDER.WT_UNIT, MERCH_ORDER.TERM, MERCH_ORDER.COMM,
    MERCH_ORDER.PRICE, MERCH_ORDER.CUR_SYMB, MERCH_ORDER.STATUS, MERCH_ORDER.REMARKS,
    MERCH_ORDER.WONO, MERCH_ORDER.PRONO, MERCH_ORDER.PES_QUANTITY,
    MERCH_ORDER.PES_Q_UNIT, MERCH_ORDER.PES_PRICE, MERCH_ORDER.PES_CUR_SYMB
    FROM BUYER, MERCH_ORDER
    WHERE MERCH_ORDER.CANCEL IS NULL
    AND (MERCH_ORDER.B_CODE = BUYER.B_CODE)
    and merch_order.orderno not in
    (select export_order1.orderno from export_order1)
    ORDER BY MERCH_ORDER.ORDERNO

    Where "first table" is merch_order and "second table" is export_order1?
    How many distinct orders are in each table?
    Are there any NULL order numbers in either table?
    I'd put money on the fact that if commenting out a clause causes a number of rows to be returned, that clause is filtering out all the rows. You'll need to go through your data to figure out why the NOT IN clause is filtering out all your rows.
    Justin

  • Please find this query very urgent

    Query-->select value from mytable where value is not null
         union all
    select value from mytable where value is null
    Ex: table name::mytable
    In this table i have one column called 'value' and this column values shold be like this
    12
    null
    13
    null
    11
    null
    ....i executed above query the result will be like this
    12
    13
    11
    null
    null
    null
    the above query executes on the table it's effect only one column result
    but i need multiple columns to be effected same as above one only....Anyone please help me on it and give the query.

    I have a table..MyTable(value number(10))
    select * from Mytable;value
    12
    null
    13
    null
    11
    null
    This is the table i have and the records i have...... and i need output like this
    value
    12
    13
    11
    null
    null
    null ..............>ike this i need output for this i use this query i.e
    Query-->select value from mytable where value is not null
    union all
    select value from mytable where value is null
    ------------>and this query gives only one column result i need multiple results like below: i have table with 2 columns like below
    MyTable2(value1 number(10),value2 number(10))
    select * fromMyTable2value1 value2
    111 null
    null 201
    112 null
    null 200
    110 null
    this is the table i have......... and i need output like below
    value1 value2
    111 201
    112 200
    110 null
    null null
    null null
    NOTE:: If we use ORDER BY table records order must change, i don't want to change any order....please what is the query for that

  • Converting this query to Oracle-Help

    New account as my old email address has changed so I had to create a new one. Sucks!
    Either way can I please get some help with converting the query below to oracle syntax not microsoft sql. Cheers
    select  eventtypeid as Payment_Type,
         sum(commission_amount) as commission_amount,
         startdate as commission_date
    from
    SELECT distinct
              PERIOD.STARTDATE,
              Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE,
    case when Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE in ('2573','185')
         then 'D'
         when Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE in ('1126','1055')
         then 'O'
         when Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE in ('789','4000','785','871','1028','743')
         then 'R'
    else Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE
    end as SDC,
              Master_Usage.GENERICATTRIBUTE2 AS Service_Id,
              Master_Usage.EVENTTYPEID,
              sum(Master_Usage.CONTRIBUTIONVALUE) AS Commission_Amount
    FROM              Master_Usage INNER JOIN PERIOD
                   ON Master_Usage.PERIODSEQ = PERIOD.PERIODSEQ
              INNER JOIN (select distinct
                        lastname,
                        super_distributor_code,
                        distributor_code,
                        participantid,
                        startperiod
                   from Dealer_Hierarchy_107_114
                   where startperiod in ('107','108','110','111','112','114')
                   AND NOT POSITIONTYPEID LIKE 'MI %'
                   and not super_distributor_code = 'null' or distributor_code = 'null') as dealer_hierarchy
                   ON Master_Usage.GENERICATTRIBUTE1 = dealer_hierarchy.PARTICIPANTID and dealer_hierarchy.startperiod in ('107','108','110','111','112','114')
    WHERE          
              (NOT Master_Usage.PRODUCTID = 'IDDV' OR Master_Usage.PRODUCTID IS NULL)
              AND Master_Usage.PERIODSEQ in ('107','108','110','111','112','114')
              and Dealer_Hierarchy.startperiod in ('107','108','110','111','112','114')
              and Master_Usage.NAME not like '%revenue%'
              and Master_Usage.name not like '%GST%'
    group by      PERIOD.STARTDATE,
              Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE,
              Master_Usage.GENERICATTRIBUTE2,
              Master_Usage.EVENTTYPEID
    ) as asf
    group by asf.EVENTTYPEID,
          startdate
    order by commission_amount desc

    please see the bold section,
    could that be the reason ??
    select eventtypeid as Payment_Type,
         sum(commission_amount) as commission_amount,
         startdate as commission_date
    from
    SELECT distinct
              PERIOD.STARTDATE,
              Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE,
    case when Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE in ('2573','185')
         then 'D'
    when Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE in ('1126','1055')
         then 'O'
    when Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE in ('789','4000','785','871','1028','743')
         then 'R'
    else Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE
    end as SDC,
              Master_Usage.GENERICATTRIBUTE2 AS Service_Id,
              Master_Usage.EVENTTYPEID,
              sum(Master_Usage.CONTRIBUTIONVALUE) AS Commission_Amount
    FROM      Master_Usage INNER JOIN PERIOD
                   ON Master_Usage.PERIODSEQ = PERIOD.PERIODSEQ
              INNER JOIN (select distinct
                        lastname,
                        super_distributor_code,
                        distributor_code,
                        participantid,
                        startperiod
                   from Dealer_Hierarchy_107_114
                   where startperiod in ('107','108','110','111','112','114')
                   AND NOT POSITIONTYPEID LIKE 'MI %'
                   and not (super_distributor_code = 'null' or distributor_code = 'null') as dealer_hierarchy
                   ON Master_Usage.GENERICATTRIBUTE1 = dealer_hierarchy.PARTICIPANTID and dealer_hierarchy.startperiod in ('107','108','110','111','112','114')
    WHERE      
              (NOT Master_Usage.PRODUCTID = 'IDDV' OR Master_Usage.PRODUCTID IS NULL)
              AND Master_Usage.PERIODSEQ in ('107','108','110','111','112','114')
              and Dealer_Hierarchy.startperiod in ('107','108','110','111','112','114')
              and Master_Usage.NAME not like '%revenue%'
              and Master_Usage.name not like '%GST%'
    group by      PERIOD.STARTDATE,
              Dealer_Hierarchy.SUPER_DISTRIBUTOR_CODE,
              Master_Usage.GENERICATTRIBUTE2,
              Master_Usage.EVENTTYPEID
    ) as asf
    group by asf.EVENTTYPEID,
         startdate
    order by commission_amount desc

  • Convert this query from Ms Access to Oracle?

    How in the hole world can do this query in oracle?
    TRANSFORM Sum(NET_SALES) AS SALES
    SELECT YEAR_MONTH
    FROM TBLCUSTOMER
    WHERE (CUSTOMER=2083 Or CUSTOMER=1035 Or CUSTOMER=2097)
    AND YEAR_MONTH Between 200709 And 200801
    GROUP BY YEAR_MONTH
    ORDER BY YEAR_MONTH
    PIVOT CUSTOMER;

    Like this perhaps:
    SQL> ed
    Wrote file afiedt.buf
      1  WITH t AS (SELECT TO_DATE('01/01/2008','dd.mm.yyyy') AS dt, 1 AS emplid, 100 as sales FROM dual UNION ALL
      2             SELECT TO_DATE('01/01/2008','dd.mm.yyyy'), 1, 200 FROM dual UNION ALL
      3             SELECT TO_DATE('01/02/2008','dd.mm.yyyy'), 2, 300 FROM dual UNION ALL
      4             SELECT TO_DATE('01/06/2008','dd.mm.yyyy'), 2, 400 FROM dual UNION ALL
      5             SELECT TO_DATE('01/03/2007','dd.mm.yyyy'), 2, 500 FROM dual UNION ALL
      6             SELECT TO_DATE('01/05/2007','dd.mm.yyyy'), 3, 600 FROM dual UNION ALL
      7             SELECT TO_DATE('01/02/2008','dd.mm.yyyy'), 3, 700 FROM dual UNION ALL
      8             SELECT TO_DATE('01/12/2008','dd.mm.yyyy'), 3, 800 FROM dual)
      9  -- END OF TEST DATA
    10  select year, month, emp_1_sales, emp_2_sales, emp_3_sales
    11  from (
    12        select extract(year from dt) as year, extract(month from dt) as month,
    13               sum(decode(emplid, 1, sales, 0)) as emp_1_sales,
    14               sum(decode(emplid, 2, sales, 0)) as emp_2_sales,
    15               sum(decode(emplid, 3, sales, 0)) as emp_3_sales
    16        from t
    17        group by extract(year from dt), extract(month from dt)
    18       )
    19* order by emp_3_sales desc, emp_2_sales desc, emp_1_sales desc
    SQL> /
          YEAR      MONTH EMP_1_SALES EMP_2_SALES EMP_3_SALES
          2008         12           0           0         800
          2008          2           0         300         700
          2007          5           0           0         600
          2007          3           0         500           0
          2008          6           0         400           0
          2008          1         300           0           0
    6 rows selected.
    SQL> ed
    Wrote file afiedt.buf
      1  WITH t AS (SELECT TO_DATE('01/01/2008','dd.mm.yyyy') AS dt, 1 AS emplid, 100 as sales FROM dual UNION ALL
      2             SELECT TO_DATE('01/01/2008','dd.mm.yyyy'), 1, 200 FROM dual UNION ALL
      3             SELECT TO_DATE('01/02/2008','dd.mm.yyyy'), 2, 300 FROM dual UNION ALL
      4             SELECT TO_DATE('01/06/2008','dd.mm.yyyy'), 2, 400 FROM dual UNION ALL
      5             SELECT TO_DATE('01/03/2007','dd.mm.yyyy'), 2, 500 FROM dual UNION ALL
      6             SELECT TO_DATE('01/05/2007','dd.mm.yyyy'), 3, 600 FROM dual UNION ALL
      7             SELECT TO_DATE('01/02/2008','dd.mm.yyyy'), 3, 700 FROM dual UNION ALL
      8             SELECT TO_DATE('01/12/2008','dd.mm.yyyy'), 3, 800 FROM dual)
      9  -- END OF TEST DATA
    10  select extract(year from dt) as year, extract(month from dt) as month,
    11         sum(decode(emplid, 1, sales, 0)) as emp_1_sales,
    12         sum(decode(emplid, 2, sales, 0)) as emp_2_sales,
    13         sum(decode(emplid, 3, sales, 0)) as emp_3_sales
    14  from t
    15  group by extract(year from dt), extract(month from dt)
    16* order by 5 desc, 4 desc, 3 desc
    SQL> /
          YEAR      MONTH EMP_1_SALES EMP_2_SALES EMP_3_SALES
          2008         12           0           0         800
          2008          2           0         300         700
          2007          5           0           0         600
          2007          3           0         500           0
          2008          6           0         400           0
          2008          1         300           0           0
    6 rows selected.
    SQL>If you meant something different, you'd better give an example of how you expect the output to be.

  • LSMW Please answer this query Experts

    Hi all,
    I Know how to use LSMW and upload data . Now I am trying to upload data for xk01 uisng lsmw. SO, the problem is vendor number uses internal assignment here. I don't know wether we use lsmw if lifnr uses internal assignment.Also I need to upload bank details for each vendor which are in a seperate flat file. Guys with real time experience, I think can solve this problem. Please guide me with this.
    Regards,
    Varun.

    You already have another post with the same question. Can you please close this one?

  • Can someone please convert this vi (8.2.1) to 8.0

    can someone please be kind enough to convert this vi I made during class (version 8.2.1) to version 8.0 (which is what I have at home)?
    Thanks.
    Attachments:
    accelerometer.vi ‏19 KB
    accelerometer1.vi ‏19 KB

    Thank you for helping jl487 out Dennis!
    FYI, jl487, LabVIEW has the options File » Save for Previous Version ... that you can use in the future.
    Kameralina
    Ask NI (ni.com/ask)
    Search The KnowledgeBase
    NI Developer Zone
    Measure It. Fix It. ni.com/greenengineering/
    NI Vision ni.com/vision/

  • Is Flip4Mac out for Intel yet? If not would some1 please convert this .mov?

    Is the .mov to .wmv converting software from Flip4Mac out yet? If not could someone pleeease convert this .mov to .wmv for me?
    http://people.brandeis.edu/~rugby/videos/colby-sawyer06.mov
    I was able to do it a while ago using Adobe Premeir and Windows Movie Maker (WMM) but Premeir would always change the dimensions of the video waay too large and when I resized it in WMM quality was lost and it was either too small or too large, I couldn't keep the same dimensions of the original film.
    Any help is appreciated.

    The latest version (v2.1) is supposed to have universal binary support...
    I hope it helps!
    Dual 2.5 GHz PowerPC G5   Mac OS X (10.4.7)  

  • Please Help this query should be simple :)

    Here is what I have written so far: Basically I want it to return all the locations like I have specified that do not have DA-REPL in the area_code table but it is just returning everything it seems.
    select l.location_no, l.zone_code, la.area_code
    from move.location l, move.location_area la
    where la.location_no = l.location_no
    and l.zone_code = 'Z-BIN'
    and (l.location_no like '%%-%%-2%%' or l.location_no like '%%-%%-1%%')
    and la.area_code != 'DA-REPL'
    order by 1
    Here is what my results look like:
    60-02-101     Z-BIN     WA-60
    60-02-101     Z-BIN     WA-BIN
    60-02-101     Z-BIN     WA-BINRESV
    60-02-101     Z-BIN     WA-PALLET
    60-02-102     Z-BIN     WA-60
    60-02-102     Z-BIN     WA-BIN
    60-02-102     Z-BIN     WA-BINRESV
    60-02-102     Z-BIN     WA-PALLET
    60-02-201     Z-BIN     WA-60
    60-02-201     Z-BIN     WA-BIN
    60-02-201     Z-BIN     WA-BINRESV
    60-02-201     Z-BIN     WA-PALLET
    Edited by: 906043 on Feb 20, 2012 2:23 PM

    906043 wrote:
    At it's most basic the query would look like this but this gives me 67,834 results I am dealing with a pretty big warehouse with many "la.area_code" entries I am only trying to get the locations in a specific zone('Z-BIN') that do not have 'DA-REPL' as an la.area_code as this would cause that location never to get replenishments when it becomes empty.
    select l.location_no, l.zone_code, la.area_code
    from move.location l, move.location_area la
    where la.location_no = l.location_no
    l.zone_code = 'Z=BIN'
    and la.area_code != 'DA-REPL'
    order by 1
    Not sure if that helps anymore I am at a loss but still plugging away :)A little attention to code formatting could bring some sanity to yourself. Enclosing that formatted code in the code tags on this forum would bring a lot of sanity to those trying to help you:
    select l.location_no
    ,      l.zone_code
    ,      la.area_code
    from move.location l
    ,    move.location_area la
    where la.location_no = l.location_no
          l.zone_code = 'Z=BIN'
    and   la.area_code != 'DA-REPL'
    order by 1And once it is formatted for easier reading by humans, it's easier to see that you are missing an "and" (maybe "or"?) in your WHERE clause.

  • Convert this query to ABAP and display the results

    Hi Everyone,
    I have a sql query in native sql (oracle). I want execute it in ABAP editor and display the results.
    I need to get this to an internal table and display the results. How do i write the script any help will be great use to me.
    Here is the query:
    <i> select (select decode(extent_management,'LOCAL','*',' ') ||
                   decode(segment_space_management,'AUTO','a ','m ')
              from dba_tablespaces where tablespace_name = b.tablespace_name) || nvl(b.tablespace_name,
                 nvl(a.tablespace_name,'UNKOWN')) name,
           kbytes_alloc kbytes,
           kbytes_alloc-nvl(kbytes_free,0) used,
           nvl(kbytes_free,0) free,
           ((kbytes_alloc-nvl(kbytes_free,0))/
                              kbytes_alloc)*100 pct_used,
           nvl(largest,0) largest,
           nvl(kbytes_max,kbytes_alloc) Max_Size,
           decode( kbytes_max, 0, 0, (kbytes_alloc/kbytes_max)*100) pct_max_used from ( select sum(bytes)/1024 Kbytes_free,
                  max(bytes)/1024 largest,
                  tablespace_name
           from  sys.dba_free_space
           group by tablespace_name ) a,
         ( select sum(bytes)/1024 Kbytes_alloc,
                  sum(maxbytes)/1024 Kbytes_max,
                  tablespace_name
           from sys.dba_data_files
           group by tablespace_name
           union all
          select sum(bytes)/1024 Kbytes_alloc,
                  sum(maxbytes)/1024 Kbytes_max,
                  tablespace_name
           from sys.dba_temp_files
           group by tablespace_name )b
    where a.tablespace_name = b.tablespace_name order by 1;
    </i>
    Thanks,
    Prashant.

    Hi Prashant,
    Native SQL commands in ABAP are placed between EXEC SQL and ENDEXEC. You can place all your statements in between these EXEC SQL and ENDEXEC in a report.
    EXEC SQL [PERFORMING <form>].
      <Native SQL statement>
    ENDEXEC.
    Check this link to know about Native SQL
    http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3b8b358411d1829f0000e829fbfe/frameset.htm
    Thanks,
    Vinay

  • Please resolve this query for me.

    i have table of supplier(supplier id,comp name,contractname,address, city, region, postal code, country, phone, fax),products(product id,sroduct name,supplier id,categoryid, qtyper unit, unitprice,unists in stock,units on order, reorder level,discontinued),order details(order id,productid, unitprice, qty, discount),orders(orderid,customerid,employee id,orderdate, requieredate, shipped date,shipvia, freight, shipname,shipaddress, shipcity,shipregion), customers(customerid,comp name contact name, contact title, address, city, region,postalcode, country, phone, fax), shippers(shipid,company name, phone), employee(allthe details of employee), categories(category id, catagoryname, description,picture)
    1. I want to contact all customers who have received over $1,000 in discounts on orders this year. Give me the name and phone number of the person to contact at the customers site. Also, list the orders where the total discount was greater than $100. Remember, discount is a percentage of the price.
    2. Give me a list of suppliers and products where we do not have the stock on hand to fill the orders to be shipped. List out the customer and order information for each of the products involved.
    3. Give me a list of all orders that were shipped after the required date for the week of Jan 7, 2001. I want to know the name of the employees that were responsible for the orders.
    4. We are having a golf tournament and I need some prizes. Give me a list of the top 5 suppliers by dollar amount in the last year.
    5. Some customers are taking us for a ride on shipping. Give me a list of customers and the orders involved where more than ½ of their orders are being shipped to a region other than their home region.

    Jakas,
    This forum is for the "SQL Developer" tool - you might get a better response on the "SQL and PL/SQL" forum (PL/SQL).
    theFurryOne

Maybe you are looking for

  • Is there way to "export all tracks as audio" without such extreme volume?

    Exporting some songs for a client, and when i use the "export all tracks as audio" function-- the tracks created are much louder than the levels i have them at in the song. I'm paying mind to the 'normalize' function, as well as the automation option

  • Packaging material type

    I have created material using the material type VERP this is a packaging material & I want to add packaging material type in the material master but i am not able to find this field there can you guys please tell me the exact view wherein i can menti

  • Trouble importing Eudora files

    I'm running Thunderbird on a Mac OS X Yosemite. I have *a lot* of old Eudora files that I would like to import into Thunderbird. I'm able to import Eudora folders, but none of the files follow. Eudora Rescue won't run on my Mac (not a PPC). Are there

  • Wont let me invite more than one person to call.

    Evrey time i try to invite more than one person to a skype call it doesnt add them. it shows their picture for a couple of seconds and then it goes away. help?

  • Spotify Starts Automatically (Windows)

    Spotify automatically opens when I log-on to my computer and this slows everything down significantly. I've looked everywhere and through the current help topics, but can't figure out how to get it to stop. Any help would be appreciated.