Set query with exists

I m trying to set 5 rows in my table but all the row are effected with my query
update Payment
set payment.status = 'Captured' where exists( select * from Payment  p
join Invoice i
on p.invoice_id = i.invoice_id
join Customer c
on i.customer_id = c.customer_id
join dppreport d
on  c.first_name = d.firstname and c.last_name = d.[lastname ]
where p.date_draft_start = d.[Process Date] and c.first_name = 'aba' and c.last_name = 'dsd')
am i missing something ???

And i dont see any need for correlation in this update
if update want to update the records filered by this select statement
select * from Payment p
join Invoice i
on p.invoice_id = i.invoice_id
join Customer c
on i.customer_id = c.customer_id
join dppreport d
on c.first_name = d.firstname and c.last_name = d.[lastname ]
where p.date_draft_start = d.[Process Date] and c.first_name = 'aba' and c.last_name = 'dsd'
you can use the below update
As payment table is joined with invoice_id i believe both correlated and normal update will have the same records
if this is not the completed query please ignore
update p set p.status = 'Captured'
from Payment p
join Invoice i
on p.invoice_id = i.invoice_id
join Customer c
on i.customer_id = c.customer_id
join dppreport d
on c.first_name = d.firstname and c.last_name = d.[lastname ]
where p.date_draft_start = d.[Process Date] and c.first_name = 'aba' and c.last_name = 'dsd'
Thanks
Saravana Kumar C

Similar Messages

  • Query with EXISTS & ORDER BY is slow on 10g

    On Oracle 10g, the below query is taking 100 secs to return 500 records. It returns in 1 sec on Oracle 8.1.6. If I remove the ORDER BY clause it executes in 1 second on Oracle 10g also. I need to keep the ORDER BY and have to tune it for Oracle 10g. Optimizer is set to CHOOSE.
    Any suggestions please...
    Query & Table details:
    --------- 8< ---------
    SELECT T1.SRC_ATTR_1, T1.SRC_ATTR_2, T1.DST_ATTR_1, T1.DST_ATTR_2
    FROM TBL_DIRECTION_1 T1
    WHERE EXISTS
    (SELECT 1
    FROM TBL_DIRECTION_2 T2, TBL_MASTER SRC_M, TBL_MASTER DST_M
    WHERE SRC_M.OBJ_ID = T2.SRC_OBJ_ID AND DST_M.OBJ_ID = T2.DST_OBJ_ID AND
    SRC_M.ATTR_1 = T1.SRC_ATTR_1 AND SRC_M.ATTR_2 = T1.SRC_ATTR_2 AND
    DST_M.ATTR_1 = T1.DST_ATTR_1 AND DST_M.ATTR_2 = T1.DST_ATTR_2)
    ORDER BY 1, 2, 3, 4
    1. TBL_OBJ_MASTER
    columns
    OBJ_ID
    ATTR_1
    ATTR_2
    keys, constraints & indexes
    PRIMARY KEY (OBJ_ID)
    UNIQUE INDEX (ATTR_1, ATTR_2)
    2. TBL_DIRECTION_1
    columns
    SRC_ATTR_1
    SRC_ATTR_2
    DST_ATTR_1
    DST_ATTR_2
    keys, constraints & indexes
    UNIQUE CONSTRAINT (SRC_ATTR_1, SRC_ATTR_2, DST_ATTR_1, DST_ATTR_2)
    INDEX (SRC_ATTR_1, SRC_ATTR_2)
    3. TBL_DIRECTION_2
    columns
    SRC_OBJ_ID
    DST_OBJ_ID
    keys, constraints & indexes
    PRIMARY KEY (SRC_OBJ_ID, DST_OBJ_ID)
    INDEX (SRC_OBJ_ID)
    INDEX (DST_OBJ_ID)
    --------- 8< ---------
    Thanks in advance.
    S.

    To cut down the explanation I did not give the actual query in my first post.
    TBL_DIRECTION_1 = IPD_OMC_HANDOVER_DATA_2G
    TBL_DIRECTION_2 = NEIGHBOURS
    TBL_OBJ_MASTER= IPD_MASTER_CELLS
    ----------- 8< -----------
    TKPROF: Release 10.2.0.2.0 - Production on Thu Sep 7 12:12:24 2006
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Trace file: /apps/oracle/admin/MAGNETD2/dump/user/magnetd2_ora_22210.trc
    Sort options: default
    count = number of times OCI procedure was executed
    cpu = cpu time in seconds executing
    elapsed = elapsed time in seconds executing
    disk = number of physical reads of buffers from disk
    query = number of buffers gotten for consistent read
    current = number of buffers gotten in current mode (usually for update)
    rows = number of rows processed by the fetch or execute call
    alter session set sql_trace true
    call count cpu elapsed disk query current rows
    Parse 0 0.00 0.00 0 0 0 0
    Execute 1 0.01 0.00 0 0 0 0
    Fetch 0 0.00 0.00 0 0 0 0
    total 1 0.01 0.00 0 0 0 0
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 103
    begin :id := sys.dbms_transaction.local_transaction_id; end;
    call count cpu elapsed disk query current rows
    Parse 4 0.00 0.00 0 0 0 0
    Execute 4 0.00 0.00 0 0 0 4
    Fetch 0 0.00 0.00 0 0 0 0
    total 8 0.00 0.00 0 0 0 4
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 103
    select 'x'
    from
    dual
    call count cpu elapsed disk query current rows
    Parse 2 0.00 0.00 0 0 0 0
    Execute 2 0.00 0.00 0 0 0 0
    Fetch 2 0.00 0.00 0 0 0 2
    total 6 0.00 0.00 0 0 0 2
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 103
    Rows Row Source Operation
    1 FAST DUAL (cr=0 pr=0 pw=0 time=19 us)
    begin
    if :enable = 0 then
    sys.dbms_output.disable;
    else
    sys.dbms_output.enable(:size);
    end if;
    end;
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 1
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.00 0.00 0 0 0 1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 103
    SELECT HO2G.SRC_CSR,
    HO2G.SRC_CELL_ID,
    HO2G.DST_CSR,
    HO2G.DST_CELL_ID,
    HO2G.SRC_BSC,
    HO2G.DST_BSC DST_BSC_OR_RNC,
    HO2G.HO_ATT,
    HO2G.HO_SUCC,
    DECODE(HO2G.HO_ATT, 0, 0, ROUND(HO2G.HO_SUCC * 100 / HO2G.HO_ATT, 2)) HO_SUCC_PER,
    HO2G.HI_ATT,
    HO2G.HI_SUCC,
    DECODE(HO2G.HI_ATT, 0, 0, ROUND(HO2G.HI_SUCC * 100 / HO2G.HI_ATT, 2)) HI_SUCC_PER,
    HO2G.SRC_OMC,
    0 COPY,
    0 REMOVE_2WAYS,
    0 DST_CELL_IS_3G
    FROM IPD_OMC_HANDOVER_DATA_2G HO2G
    WHERE HO2G.SRC_CELL_ID LIKE '%' AND HO2G.SRC_CSR LIKE '%' AND
    HO2G.SRC_BSC LIKE '104' AND HO2G.SRC_REGION LIKE '%' AND
    ((HO2G.HO_SUCC <> 0 AND HO2G.HI_SUCC = 0) OR
    (HO2G.HO_SUCC = 0 AND HO2G.HI_SUCC <> 0)) AND EXISTS
    (SELECT 1
    FROM NEIGHBOURS N, IPD_MASTER_CELLS SIMC, IPD_MASTER_CELLS DIMC
    WHERE N.CELL_PLA_PLA_ID = 0 AND N.CELL_PLAN_SEQ_NUM = 0 AND
    N.SOURCE_CELL_SEQ_NO = SIMC.IMC_CELL_SEQ_NO AND
    N.DESTINATION_CELL_SEQ_NO = DIMC.IMC_CELL_SEQ_NO AND
    HO2G.SRC_CSR = SIMC.IMC_CSR AND
    HO2G.SRC_CELL_ID = SIMC.IMC_CELL_ID AND
    HO2G.DST_CSR = DIMC.IMC_CSR AND
    HO2G.DST_CELL_ID = DIMC.IMC_CELL_ID
    ORDER BY 1, 2, 3, 4
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 21.55 21.07 0 758573 0 100
    total 3 21.55 21.07 0 758573 0 100
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 103
    Rows Row Source Operation
    100 TABLE ACCESS BY INDEX ROWID IPD_OMC_HANDOVER_DATA_2G (cr=758573 pr=0 pw=0 time=2875024 us)
    69027 INDEX FULL SCAN C_IOHD_2G_UK_1 (cr=748680 pr=0 pw=0 time=20019259 us)(object id 73059)
    69027 NESTED LOOPS (cr=748260 pr=0 pw=0 time=17537106 us)
    83140 NESTED LOOPS (cr=498840 pr=0 pw=0 time=11921339 us)
    83140 TABLE ACCESS BY INDEX ROWID IPD_MASTER_CELLS (cr=249420 pr=0 pw=0 time=5816876 us)
    83140 INDEX UNIQUE SCAN IMC_CSR_CELL_ID_I (cr=166280 pr=0 pw=0 time=4106053 us)(object id 73005)
    83140 TABLE ACCESS BY INDEX RforumID=75, To cut down the explanation I did not give the actual query in my first post.
    TBL_DIRECTION_1 = IPD_OMC_HANDOVER_DATA_2G
    TBL_DIRECTION_2 = NEIGHBOURS
    TBL_OBJ_MASTER= IPD_MASTER_CELLS
    ----------- 8< -----------
    TKPROF: Release 10.2.0.2.0 - Production on Thu Sep 7 12:12:24 2006
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Trace file: /apps/oracle/admin/MAGNETD2/dump/user/magnetd2_ora_22210.trc
    Sort options: default
    count = number of times OCI procedure was executed
    cpu = cpu time in seconds executing
    elapsed = elapsed time in seconds executing
    disk = number of physical reads of buffers from disk
    query = number of buffers gotten for consistent read
    current = number of buffers gotten in current mode (usually for update)
    rows = number of rows processed by the fetch or execute call
    alter session set sql_trace true
    call count cpu elapsed disk query current rows
    Parse 0 0.00 0.00 0 0 0 0
    Execute 1 0.01 0.00 0 0 0 0
    Fetch 0 0.00 0.00 0 0 0 0
    total 1 0.01 0.00 0 0 0 0
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 103
    begin :id := sys.dbms_transaction.local_transaction_id; end;
    call count cpu elapsed disk query current rows
    Parse 4 0.00 0.00 0 0 0 0
    Execute 4 0.00 0.00 0 0 0 4
    Fetch 0 0.00 0.00 0 0 0 0
    total 8 0.00 0.00 0 0 0 4
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 103
    select 'x'
    from
    dual
    call count cpu elapsed disk query current rows
    Parse 2 0.00 0.00 0 0 0 0
    Execute 2 0.00 0.00 0 0 0 0
    Fetch 2 0.00 0.00 0 0 0 2
    total 6 0.00 0.00 0 0 0 2
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 103
    Rows Row Source Operation
    1 FAST DUAL (cr=0 pr=0 pw=0 time=19 us)
    begin
    if :enable = 0 then
    sys.dbms_output.disable;
    else
    sys.dbms_output.enable(:size);
    end if;
    end;
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 1
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.00 0.00 0 0 0 1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 103
    SELECT HO2G.SRC_CSR,
    HO2G.SRC_CELL_ID,
    HO2G.DST_CSR,
    HO2G.DST_CELL_ID,
    HO2G.SRC_BSC,
    HO2G.DST_BSC DST_BSC_OR_RNC,
    HO2G.HO_ATT,
    HO2G.HO_SUCC,
    DECODE(HO2G.HO_ATT, 0, 0, ROUND(HO2G.HO_SUCC * 100 / HO2G.HO_ATT, 2)) HO_SUCC_PER,
    HO2G.HI_ATT,
    HO2G.HI_SUCC,
    DECODE(HO2G.HI_ATT, 0, 0, ROUND(HO2G.HI_SUCC * 100 / HO2G.HI_ATT, 2)) HI_SUCC_PER,
    HO2G.SRC_OMC,
    0 COPY,
    0 REMOVE_2WAYS,
    0 DST_CELL_IS_3G
    FROM IPD_OMC_HANDOVER_DATA_2G HO2G
    WHERE HO2G.SRC_CELL_ID LIKE '%' AND HO2G.SRC_CSR LIKE '%' AND
    HO2G.SRC_BSC LIKE '104' AND HO2G.SRC_REGION LIKE '%' AND
    ((HO2G.HO_SUCC <> 0 AND HO2G.HI_SUCC = 0) OR
    (HO2G.HO_SUCC = 0 AND HO2G.HI_SUCC <> 0)) AND EXISTS
    (SELECT 1
    FROM NEIGHBOURS N, IPD_MASTER_CELLS SIMC, IPD_MASTER_CELLS DIMC
    WHERE N.CELL_PLA_PLA_ID = 0 AND N.CELL_PLAN_SEQ_NUM = 0 AND
    N.SOURCE_CELL_SEQ_NO = SIMC.IMC_CELL_SEQ_NO AND
    N.DESTINATION_CELL_SEQ_NO = DIMC.IMC_CELL_SEQ_NO AND
    HO2G.SRC_CSR = SIMC.IMC_CSR AND
    HO2G.SRC_CELL_ID = SIMC.IMC_CELL_ID AND
    HO2G.DST_CSR = DIMC.IMC_CSR AND
    HO2G.DST_CELL_ID = DIMC.IMC_CELL_ID
    ORDER BY 1, 2, 3, 4
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 21.55 21.07 0 758573 0 100
    total 3 21.55 21.07 0 758573 0 100
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 103
    Rows Row Source Operation
    100 TABLE ACCESS BY INDEX ROWID IPD_OMC_HANDOVER_DATA_2G (cr=758573 pr=0 pw=0 time=2875024 us)
    69027 INDEX FULL SCAN C_IOHD_2G_UK_1 (cr=748680 pr=0 pw=0 time=20019259 us)(object id 73059)
    69027 NESTED LOOPS (cr=748260 pr=0 pw=0 time=17537106 us)
    83140 NESTED LOOPS (cr=498840 pr=0 pw

  • ES 2 and JDBC: Query with a multi set return

    I know that ES does not have a Query that returns multiple result sets, is there one in ES2?
    If not, what are people using for this functionality?
    Cheers

    I'm looking for this functionality as well.
    While using scripting is a solution it's not exactly a viable long term solution.  I'm sure the scripting option was intended to cover off potential one off situations that required a bit more programmatic control than the default toolbox supplied.  We are going to have to create a custom script for every process because of the multi query limitation.  We don't even have the option of a JDBC component that returns results from a stored procedure as LC doesn't even have that.  If that was available we could at least work around the limited result sets.
    Limiting the number of result sets for the multi query to one is extremely short sighted.  Not to mention the inabilility for the multi query to return a hierarchal xml payload.
    In general the LC database connectivity options are puzzling.  Why is there no JDBC connector for stored procedures that returns data? Why is the multi query limited to a flat structure and one result set?  Surely there are PDF's that need to be populated with complex data structures?
    Perhaps even more frustratiing is that it isn't possible to reuse existing legacy data stores/stored procedures in a new process without creating a new approach to data access to comply with LC's deliberately limited JDBC options.  Why have the data integration capabilities of JBOSS (in our case) been handicapped?
    Overall, LC has been a great help in providing a shared business workflow option for our enterprise but the data access needs to be improved to enable LC to operate with existing systems and to provide more options for transforming business process on paper into business processes in LC.

  • Please help to re-write this query using exists or with

    Hi please help to re-write this query using exists or with, i need to write same code for 45 day , 90 days and so on but sub query condition is same for all
    SELECT SUM (DECODE (t_one_mon_c_paid_us, 0, 0, 1)) t_two_y_m_mul_ca_
    FROM (SELECT SUM (one_mon_c_paid_us) t_one_mon_c_paid_us
    FROM (
    SELECT a.individual_id individual_id,
    CASE
    WHEN NVL
    (b.ship_dt,
    TO_DATE ('05-MAY-1955')
    ) >= SYSDATE - 45
    AND a.country_cd = 'US'
    AND b.individual_id in (
    SELECT UNIQUE c.individual_id
    FROM order c
    WHERE c.prod_cd = 'A'
    AND NVL (c.last_payment_dt,
    TO_DATE ('05-MAY-1955')
    ) >= SYSDATE - 745)
    THEN 1
    ELSE 0
    END AS one_mon_c_paid_us
    FROM items b, addr a, product d
    WHERE b.prod_id = d.prod_id
    AND d.affinity_1_cd = 'ADH'
    AND b.individual_id = a.individual_id)
    GROUP BY individual_id)
    Edited by: user4522368 on Aug 23, 2010 9:11 AM

    Please try and place \ before and after you code \Could you not remove the inline column select with the following?
    SELECT a.individual_id individual_id
         ,CASE
            when b.Ship_dt is null then
              3
            WHEN b.ship_dt >= SYSDATE - 90
              3
            WHEN b.ship_dt >= SYSDATE - 45
              2
            WHEN b.ship_dt >= SYSDATE - 30
              1
          END AS one_mon_c_paid_us
    FROM  items           b
         ,addr            a
         ,product         d
         ,order           o
    WHERE b.prod_id       = d.prod_id
    AND   d.affinity_1_cd = 'ADH'
    AND   b.individual_id = a.individual_id
    AND   b.Individual_ID = o.Individual_ID
    and   o.Prod_CD       = 'A'             
    and   NVL (o.last_payment_dt,TO_DATE ('05-MAY-1955') ) >= SYSDATE - 745
    and   a.Country_CD    = 'US'

  • Not able to migrate a query with not exist clause

    Hi all,
    I'm using Toplink 10.1.3 and I am trying to rewrite the following query with Expression Framework:
    select distinct r.e_ogg_oper_k_oggetto
    FROM regola_accettazione_oper_banc r, oggetto_operazione_bancaria o
    where not exists (
    select 1
    FROM limitaz_ogg_tipo_oper_banc l
    where nvl(l.d_fine_validita,trunc(sysdate)+1)>trunc(sysdate)
    and l.d_inizio_validita <= trunc(sysdate)
    and l.e_tpodv_k_tipo_operazione=:appoggio.tipo_operaz
    and l.e_ogg_oper_k_oggetto=r.e_ogg_oper_k_oggetto
    and l.e_uni_oper_k_unita_oper_util= :appoggio.e_uni_oper_k_unita_oper_esegui )
    and r.e_oper_ban_k_operaz_bancaria=:appoggio.form
    and r.e_ogg_oper_k_oggetto=o.k_oggetto
    and o.e_ogg_oper_k_oggetto is null
    and o.k_oggetto != nvl(:appoggio.oggetto_autom,,'0')
    and o.k_oggetto like substr(:appoggio.oggetto,1,2)||'%'
    and r.d_inizio_validita <= :appoggio.d_contab
    and to_date(nvl(to_char(r.d_fine_validita,DD/MM/YYYY'),31/12/3999'),'DD/MM/YYYY')> :appoggio.d_contab
    and o.f_natura_oggetto in ('G','P') and r.f_oggetto_automatizzato!='S'
    I'm not able to "attach" the not exist clause to the rest of query.
    How can I do it?
    Thank you very much.

    Not exists can be used in an expression through using a ReportQuery sub-query.
    i.e.
    ExpressionBuilder outerBuilder = new ExpressionBuilder();
    ReadAllQuery outerQuery = new ReadAllQuery(Employee.class, outerBuilder);
    ExpressionBuilder subBuilder = new ExpressionBuilder();
    ReportQuery subQuery = new ReportQuery(Address.class, subBuilder);
    subQuery.addAttribute("id");
    subQuery.setSelectionCriteria(
    subBuilder.get("city").equal(outerBuilder.get("address").get("city")
    .and(subBuilder.notEqual(outerBuilder.get("address")))));
    outerQuery.setSelectionCriteria(
    outerBuilder.notExists(subQuery));
    List results = (List) session.executeQuery(outerQuery);
    Refer to the documentation section on sub-queries for more information.
    I would suggest simlpifying the where clause until you get the sub-query working to start.
    You can also always use a custom SQL query in TopLink.

  • Global query block is causing a DNS server to fail a query with error code Name Error exists in the DNS database for WPAD

    Global query block is causing a DNS server to fail a query with error code Name Error exists in the DNS database for WPAD on a Windows 2008 server.

    The global query block list is a feature that prevents attacks on your network by blocking DNS queries for specific host names.  This feature has caused the DNS server to fail a query with error code NAME ERROR for wpad.contoso.com. even though data
    for this DNS name exisits in the DNS database.  Other queries in all locally authoritative zones for other names that begin with labels in the block list will also fail, but no event will be logged when further queries are blocked until the DNS server
    service on this computer is restarted.

  • Query to get value sets associated with its descriptive flexfield

    Hi All,
    Here i have a issue
    I am trying to get Value sets associated with its descriptive flex field of Receivable application and
    also if i want this for particular responsibility i.e., GW RBC Receivable Super User.
    I hope u got it.
    Please suggest me some query to get this.
    This is very important for me.

    Hi, I think your question should be addressed to the OEBS experts

  • Set READ UNCOMMITED for a query with a table join (Ver 12.5. and 15.5)

    Hi all,
    this is an example of how to set the READ UNCOMMITED isolation level for a simple query:
    select col_a from mytable at isolation 0
    What about a query with an equi-join?
    Is it:
    select col_a
    from mytable t1, mytable t2
    at isolation 0
    I am sorry for the simple question, I did not find a auitable example in the documentation.
    Best Regards
    Arthur

    Yeah, the docs aren't very good at providing a robust set of examples so you've gotta:
    1 - review the command syntax and then
    2 - try a few examples until you find the format that works
    1 - From the ASE 15.5 Commands reference manual we find the following syntax:
    =========================
    select ::=
              select [all | distinct]
              [top unsigned_integer]
              select_list
              [into_clause]
              [from_clause]
              [where_clause]
              [group_by_clause]
              [having_clause]
              [order_by_clause]
              [compute_clause]
              [read_only_clause]
              [isolation_clause]
              [browse_clause]
              [plan_clause]
    =========================
    This shows us that the isolation clause is attached at the 'end' of the query as a query-level specifier (along with the 'group by', 'order by' and 'having' clauses).
    From this syntax I'd say your proposed query looks correct so ...
    2 - Try running your example to see if you get a syntax error ("When in doubt, try it out!"), eg:
    =========================
    select s.name,c.name
    from sysobjects s, syscolumns c
    where s.id = c.id
    at isolation 0
    go
    name
    sysobjects
    sysobjects
    sysobjects
    ... snip ...
    =========================

  • Error executing a query with large result set

    Dear all,
    after executing a query which uses key figures with exception aggregation the BIA-server log (TrexIndexServerAlert_....trc) displays the following messages:
    2009-09-29 10:59:00.433 e QMediator    QueryMediator.cpp(00324) : 6952; Error executing physical plan: AttributeEngine: not enough memory.;in executor::Executor in cube: bwp_v_tl_c02
    2009-09-29 10:59:00.434 e SERVER_TRACE TRexApiSearch.cpp(05162) : IndexID: bwp_v_tl_c02, QueryMediator failed executing query, reason: Error executing physical plan: AttributeEngine: not enough memory.;in executor::Executor in cube: bwp_v_tl_c02
    --> Does anyone know what this message exactly means? - I fear that the BIA-Installation is running out of physical memory, but I appreciate any other opinion.
    - Package Wise Read (SAP Note 1157582) does not solve the problem as the error message is not: "AggregateCalculator returning out of memory with hash table size..."
    - To get an impression of the data amount I had a look at table RSDDSTAT_OLAP of a query with less amount of data:
       Selected rows      : 50.000.000 (Event 9011)
       Transferred rows :   4.800.000 (Event 9010)
    It is possible to calculate the number of cells retreived from one index by multiplying the number of records from table RSDDSTAT_OLAP by the number of key figures from the query. In my example it is only one key figure so 4.800.000 are passed to the analytical engine.
    --> Is there a possibility to find this figure in some kind of statistic table? This would be helpful for complex queries.
    I am looking forward to your replies,
    Best regards
    Bjoern

    Hi Björn,
    I recommend you to upgrade to rev 52 or 53. Rev. 49 is really stable but there are some bugs in it and if you use BW SP >= 17 you can use some features.
    Please refer to this thread , you shouldn't´t use more than 50% (the other 50% are for reporting) of your memory, therefor I have stolen this quote from Vitaliy:
    The idea is that data all together for all of your BIA Indexes does not consume more then 50% of total RAM of active blades (page memory cannot be counted!).
    The simpliest test is during a period when no one is using the accelerator, remove all indexes (including temporary) from main memory of the BWA, and then load all indexes for all InfoCubes into ain memory. Then check your RAM utilization.
    Regards,
    -Vitaliy
    Regards,
    Jens

  • Best way to give a default value to a New Column with existing rows

    Adding some columns to SQL tables with existing data rows. There are also views created from these tables. The views are used in some report/query software so NULL values are not good. Interested in learning about the best way to set a default value. 
    These are the ways that I can think of
    1) ALTER TABLE using the DEFAULT to add the column and set the default value
    ++ Adds a constraint which is not terrible. Constraints are just not used much in this shop.
    2) ALTER TABLE to add the column then do an UPDATE statement to update the values
    ++ might be an issue for tables with millions of rows
    3) ALTER TABLE to add the column then use ISNULL in the CREATE VIEW

    It is a large table with 444 columns and max row size of 2268. 907k records took 1 minute 38 seconds to UPDATE the column. I have about 12 fields to add to this table and about 44 tables (not all this large of course) so it will take some time to
    UPDATE.  Although ... i just tried updating 3 columns in a single UPDATE and it took 1 minute 36 seconds. So If I did all 12 fields in a single UPDATE it would be about the same time as a single Field.  I will think about it.

  • Issue in select query with where clause

    Hi guys,
    I'm facing an issue while using select query with the where clause. When I'm selecting all the data from the table it returns the correct result. But when I'm using the where clause to get the specific rows from the table it returns no rows. But the data I'm trying to fetch using the where condition exists in the table.
    Here is my query which causing the issue,
    select * from mytable where myfield = 'myvalue'
    But if I use the following query it returns the result correctly.
    select * from mytable
    Also the myfield value 'myvalue' exists in the table.
    I have tried by running this query in both SQL Developer and SQL Plus. I have tried this query in mssql as well. It works perfectly and returns correct result sets for both the queries I have mentioned above. I'm unable to predict the issue as I'm new to ORACLE. Please help.
    Thanks,
    Ram.

    Hi Ram,
    I experienced an issue similar to this with a varchar2 field. Some of our records had a hidden newline character at the end of them, which was making queries like the one below fail:
    select * from employees
    where email = '[email protected]'The best way I found to detect this was to use
    select 'XX'||email||'XX' from employeesTo make sure that there were no newlines. But that is just a guess. If you could provide some example table data and the outputs of your selects, it would be helpful.
    Jeff

  • Query with || operator in IN clause

    Hi All,
    I am having two table emp_demo,dept_demo , below are the structure of the table :
    create table emp_demo(
    empno number primary key,
    ename varchar2(20),
    deptno number,
    dept_loc varchar2(20),
    dname varchar2(20)
    create table dept_demo(
    deptno number,
    dept_loc varchar2(20),
    dname varchar2(20)
    Query 1 :
    select * from emp_demo e where e.deptno||e.dept_loc||e.dname IN ( select d.deptno||d.dept_loc||d.dname from dept_demo d)
    Query 2 : 
    select * from emp_demo e where e.deptno  IN ( select d.deptno from dept_demo d)
    and e.dept_loc  IN ( select d.dept_loc from dept_demo d)
    and e.dname  IN ( select d.dname from dept_demo d)
    Could anyone please confirm that both the query will returns the same results in any condition.
    Thanks,
    Rajendra

    I agree with Karthick.
    Your query with || cannot be guaranteed to return the correct results, as it's possible that the concatenation of different strings could result in the same overall string
    As an illustrative example...
    if you have two strings... forename "FRED" and surname "SAMUEL BLOGGS" (very posh double barrelled surname)
    The concatenating these together can give us "FRED SAMUEL BLOGGS".
    Now what if the two strings we had were: forenames "FRED SAMUEL" and surname "BLOGGS"
    concatenating those together will also give us "FRED SAMUEL BLOGGS"
    So we had two lots of data, with different starting strings that resulted in the same overall string.
    In terms of your query, you should ideally join the data as Karthick showed, but just so you know, if you're wanting to do an IN clause on multiple columns, you do not concatenate the data together (it get's even more messy if the datatypes are different), but you actually treat all the columns as a set of data.  You do that using syntax like this...
    select *
    from emp_demo e
    where (e.deptno,e.dept_loc,e.dname) IN (select d.deptno,d.dept_loc,d.dname
                                            from   dept_demo d)
    Your second query is also completely different from the first query as it removes the relationship between the individual columns.  So, just because the dept_no is in the dept_demo table, and the dept_loc is also in the dept_demo table and the dname is also in the dept_demo table, doesn't mean that they all exist together on the same row of the dept_demo table.  I very much doubt that is what you wanted.
    SQL is set based.  That's a key thing to remember. 

  • APD using Query with multiple structures as a data source

    All,
    I want to set up an automatic process which executes a query and exports it to a shared drive as a csv file. I have tried various options , when I try to use APD to set up the extract, I get an error and this is because the query that I am trying to use has Strucutres in both rows and columns. Hence, I am unable to use this option. I tried RSCRM_BAPI, It works well, but there is an issue with scheduling this in Process chain. I created an event and scheduled this as a job to trigger after "event" as per SAP instructions, but the job does not exist and it is not possible to trigger it through the Process chain unless the variables are hard coded in the query which I do not want to do.
    Can any one tell me if there is a way to deal with APD using Query with multiple structures?
    Would really appreciate if some one can give me the right solution...
    Thanks

    Hi Tanu ,
    APD is an option but its not very good with large amount of data or hiearachies or if you have attributes in you query structure .
    One more option for this requirement is use of report program using function module RRW3_GET_QUERY_VIEW_DATA .
    This will work fine with multiple structure etc .
    There are some overheads with this FM  ex: if amount of data is too much then program will give dump .Solution for that is we call the FM in LOOP by diving amount of data need to be fetched .ex:  we can read data quarter wise.
    For using this function module what you can do is write an ABAP program (At SE38 ) .which will call this FM and then write the output into a flat file which you can save at application server (AL11) .From there other system can read it .
    To automate this whole process you can further add all the report programs into a process chain (RSPC) which can be schedule as per requirement .
    To pass input parameters you can use variants that will pass the values to the report .
    Check thi link for sample code :
    [http://www.tricktresor.de/content/index.php?navID=696&aID=496]
    Hope this will be helpful .
    Regards,
    Jaya Tiwari

  • My Time Capsule does not work with existing WiFi

    Following a question solved on March 24 by LaPastenague, but gone bad again.
    Apple AirPort Time Capsule
    I felt the need for a physical backup of my data, as I would not completely trust the different clouds. I use, and have used Dropbox for 4-5 years and are very satisfied with that, but I am still not sure if or when a political lunatic will shut off the internet.
    I purchased the Apple AP Time Capsule 2T, because all my other stuff are Apple, and that it's wireless. My old backup is Maxtor 300 GB.
    Since we stay 2-3 weeks on two locations, one in Norway and one in Sweden (two different countries) we must use Mobile Broadband 4G, cables or fibre connections are useless for us, and we don't have it up to the houses. I have one mini router for each country, we bring with us iPhones, iPads, iMac, Apple TV, APExpress. When we pass the boarder I change the mini router, and the system continues working perfect on the WiFi, except the APExpress that needs to be reconfigured,  but then it works.
    The APTC was difficult to make working as it would not accept to be in an existing network, but with good help from the Apple Community, LaPastenague, with forcing the TC connect to the APE with Ethernet cable in bridge mode, ref "My Time Capsule does not work with existing WiFi" from March 24, the problem was solved and all gadgets worked together in a perfect harmony, until we changed location.
    Now, as I have my second WiFi network, and the APExspress is reconfigured, it's like the TC thinks, I am the base boss here, I am not taking orders from APE one more time, and it simply does not work, not only that, it fluctuates all the time.
    I have a slight feeling that the two WiFi bands are making the trouble as during the configuration of the TC sometime the last figure 6 and 7 pops up, and that has something two do with the two different 2,4 and 5 GHZ bands
    So, I am curious if you have any idea ?
    I am thinking of returning the TC if I don't make it work now, but how do I delete all the data that's on it?

    I can deal with the last question first and easily.
    I am thinking of returning the TC if I don't make it work now, but how do I delete all the data that's on it?
    Open the airport utility .. go to the disk tab and select erase.
    When you select erase you will get mulitiple options.
    Quick removes the file table but does not delete the files,, it takes 2min or less.
    A Zero out data is the secure way,, by writing 0 ie low level drive format.
    It can take several hours..
    7 pass will take a week.. not recommended..
    35 pass erase is ridiculous.. it would take a month.. put an ax through the TC. It is quick and better.
    Now, as I have my second WiFi network, and the APExspress is reconfigured, it's like the TC thinks, I am the base boss here, I am not taking orders from APE one more time, and it simply does not work, not only that, it fluctuates all the time.
    The fact that it did work and has now failed might point to faulty unit.
    The only way to tell is reset it properly to factory and start over.
    Universal Factory Reset.. any model TC or AE.
    Unplug your TC/AE from power or turn off at the power point.
    Hold in reset. and power the TC/AE back on..  all without releasing reset and keep holding in for about 10sec. (this is often difficult without a 2nd person or a 3rd arm).
    Release it when the status light flashes rapidly. If it doesn’t flash rapidly you have missed it and try again.
    Note..
    Be Gentle! Feel the switch click on. It has a positive feel..  add no more pressure after that.
    TC/AE will reboot after a couple of minutes with default factory settings and will wipe out previous configurations of the router.
    No files are deleted on the hard disk in a TC.. No reset of the TC deletes files.. to do that you use erase from the airport utility.
    Generally having multiple wireless AP should not cause problems.. but it is better to set channels manually.. so it doesn't go beserk rotating channels.
    Remember to keep all names short, no spaces and pure alphanumeric.
    Sadly though the Apple routers have no logging now and no SNMP and almost nothing to help diagnose a problem, so if it continues .. take it back to apple.. they have given you no other method of fixing it.

  • Problem with existing script, can't get text of item

    I'm taking an earlier script and condensing it so that it will only work from one SELECTED folder. I thought it would be simple but i seam to be running into a few issues
    This is the error I get
    Result:
    error "Can’t get last text item of alias \"Images:2012-2013:WK21:Freedom:Freedom_WK21_PSD:\"." number -1728 from last text item of alias "Images:2012-2013:WK21:Freedom:Freedom_WK21_PSD:"
    property type_list : {"8BPS"}
    property extension_list : {"psd"}
    script o
              property theseNames : {}
    end script
    -- empty log file
    do shell script "echo  'Files not processed in Photoshop :'  > ~/Desktop/LogPhotoshopError.txt"
    set noError to true
    --at the beginning of the script, ask whether to replace or skip existing files? to apply to all?
    --use the result for the if file exists?
    display dialog "Should I replace or skip exisiting files?" buttons {"Replace", "Skip (Faster)"} default button 2 with icon 1
    set skipFiles to (button returned of the result) is "Skip (Faster)"
    --Below is what I removed
    --set dtF to paragraphs of (do shell script "ls -F ~/Desktop | grep '/' | cut -d'/' -f1")
    --set tc to (count dtF)
    --repeat with i from 1 to tc
    --          set folderName to item i of dtF --<:  is the folder name, no need to use text item delimiters -->":"
    --          if folderName does not start with "2_" and folderName does not start with "Hot" and folderName does not start with "Press" and folderName does --not start with "Design" and folderName does not start with "Keywords" and folderName does not start with "Season" and folderName does not
    --start with "Sue" and folderName does not start with "Design" then
    --Setup list of folders and process details of folders
    tell application "Finder" to set folderName to (choose folder with prompt "Select Folder")
    set {oldTID, my text item delimiters} to {my text item delimiters, "_WK"}
    set FolderEndName to last text item of folderName
    set brandName to first text item of folderName
    set my text item delimiters to "_PSD"
    set weekNumber to first text item of FolderEndName
    set my text item delimiters to oldTID
    set theFolder to ("Hal 9000:Users:matthew:Desktop:" & folderName)
    --set up names to destination folders and create locally based on brand name and week number
    set this_local_folder to "Images:2012-2013"
    set localWeekFolder to my getFolderPath("WK" & weekNumber, this_local_folder)
    set localBrandFolder to my getFolderPath(brandName, localWeekFolder)
    set localBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", localBrandFolder)
    set localBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", localBrandFolder)
    set localBrandFolder_PSD to my getFolderPath(brandName & "_WK" & weekNumber & "_PSD", localBrandFolder)
    set this_Network_folder to "DCKGEN:Brands:Zoom:Brand - Zoom:Upload Photos:2013:"
    set networkWeekFolder to my getFolderPath("Week" & weekNumber, this_Network_folder)
    set networkBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", networkWeekFolder)
    set website_images to "DCKGEN:Website_Images:"
    --set up names to destination folders and create over Netwrok for FTP collection (based on a mounted drive)
    set this_ftp_folder to "Impulse:"
    set ftpWeekFolder to my getFolderPath("Week" & weekNumber, this_ftp_folder)
    set ftpBrandFolder to my getFolderPath(brandName, ftpWeekFolder)
    set ftpBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", ftpBrandFolder)
    set ftpBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", ftpBrandFolder)
    --taking the folder identify which process it must follow.  F R E E D O M   W I T H  P N G
    if brandName is equal to "Freedom" then
              try
                        tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
              on error
                        set o's theseNames to {} -- no psd files or "8BPS"
              end try
              set numOfNames to (count o's theseNames)
              repeat with j from 1 to numOfNames
                        set thefile to theFolder & ":" & (item j of o's theseNames)
      --    F R E E D O M     Folder Photoshop Process W I T H  P N G
                        set thisName to (item j of o's theseNames)
                        tell application "Finder"
                                  set t_ext to name extension of file thefile
                                  if t_ext is not "" then set thisName to text 1 thru -((count t_ext) + 2) of thisName
                                  set b to exists file (localBrandFolder_PSD & thisName & ".psd")
                        end tell
                        if not b or (b and not skipFiles) then -- not exists file or file exists and "replace" (continue the rest of the script).
                                  tell application "Adobe Photoshop CS5.1"
      -- I remove the command activate, Photoshop stay in background
                                            set ruler units of settings to pixel units
                                            try
      open (alias thefile) showing dialogs never
                                                      set origName to name of current document
                                                      set myOptions to {class:JPEG save options, quality:12}
                                                      set myPNGOptions to {class:PNG save options, interlaced:false}
                                                      set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
                                                      tell current document
      --If the quick mask mode has been left on then delete the channel Quick Mask
                                                                if (quick mask mode) then delete channel ¬
                                                                          "Quick Mask"
      --If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
                                                                if (exists layer "Original Layer") then ¬
                                                                          tell layer "Original Layer" to set name to "Original Image"
      save in (localBrandFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
                                                                (delete layer "Original Image") flatten
      resize image resolution 300 resample method none
      --sharpen image
      filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
      save in (ftpBrandFolder_High_Res & name) as JPEG with options myOptions without copying
      --Prepare for Low RES by resetting image history
                                                                set current history state to history state 3
      delete current layer
      merge visible layers
                                                                resize image width 1020
      resize image resolution 300 resample method none
      filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
      --add save to lowResFolder with same options
      save in (networkBrandFolder_Low_Res & name) as PNG with options myPNGOptions without copying
      flatten
      save in (networkBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
                                                                set newFile to file path
                                                                set newFile2 to newFile as string -- for testing end of name
                                                                if newFile2 ends with "_2.jpg" or newFile2 ends with "_3.jpg" or newFile2 ends with "_4.jpg" or newFile2 ends with "_5.jpg" or newFile2 ends with "_6.jpg" or newFile2 ends with "_7.jpg" or newFile2 ends with "_8.jpg" or newFile2 ends with "_9.jpg" or newFile2 ends with "_10.jpg" or newFile2 ends with "11.jpg" then -- exclude website_images
                                                                          my duplicateFile(newFile, {ftpBrandFolder_Low_Res})
                                                                else
                                                                          save in (website_images & name) as JPEG with options myOptions without copying
                                                                end if
      close saving no
                                                      end tell
                                            on error
                                                      set noError to false
                                                      my myLogs(thefile) -- write path to log file in Desktop
                                                      try
      close saving no --if exists, close current document
                                                      end try
                                            end try
                                  end tell
                        end if
              end repeat
      --End F R E E D O M  W I T H  P N G
    end if
    if not noError then do shell script "/usr/bin/open  ~/Desktop/LogPhotoshopError.txt'"
    on myLogs(t)
              try
                        do shell script "echo " & (quoted form of t) & ">> ~/Desktop/LogPhotoshopError.txt'"
              end try
    end myLogs
    on duplicateFile(tFile, foldersPath) -- tFile is an alias, foldersPath is a list of folder
              tell application "Finder" to repeat with folderPath in foldersPath
                        with timeout of 200 seconds -- adjust it,  error if the copy  is longer that 200 seconds
      duplicate tFile to folder folderPath with replacing
                        end timeout
              end repeat
    end duplicateFile
    on getFolderPath(tName, folderPath)
              tell application "Finder" to tell folder folderPath
                        if not (exists folder tName) then
                                  return (make new folder at it with properties {name:tName}) as string
                        else
                                  return (folder tName) as string
                        end if
              end tell
    end getFolderPath
    tell application "Finder"
              open "Hal 9000:Users:matthew:Desktop:LogPhotoshopError.txt"
    end tell

    I'm getting close or at least I hope this is how it looks now, but appears not pick up the files in the folder?
    The result
              exists folder "Freedom_WK20_HR" of folder "impulse:Week20:Freedom:"
              get folder "Freedom_WK20_HR" of folder "impulse:Week20:Freedom:"
              get name of every file of alias (alias "Images:2012-2013:WK20:Freedom:Freedom_WK20_PSD:") whose {"8BPS"} contains file type or {"psd"} contains name extension
              open "Hal 9000:Users:matthew:Desktop:LogPhotoshopError.txt"
    end tell
    --------------------MAIN SCRIPT BELOW__------------------
    property type_list : {"8BPS"}
    property extension_list : {"psd"}
    script o
              property theseNames : {}
    end script
    -- empty log file
    do shell script "echo  'Files not processed in Photoshop :'  > ~/Desktop/LogPhotoshopError.txt"
    set noError to true
    --at the beginning of the script, ask whether to replace or skip existing files? to apply to all?
    --use the result for the if file exists?
    display dialog "Should I replace or skip exisiting files?" buttons {"Replace", "Skip (Faster)"} default button 2 with icon 1
    set skipFiles to (button returned of the result) is "Skip (Faster)"
    --Setup list of folders and process details of folders
    tell application "Finder"
              set theFolder to (choose folder with prompt "Select Folder")
              set folderName to name of theFolder
              set {oldTID, my text item delimiters} to {my text item delimiters, "_WK"}
              set FolderEndName to last text item of folderName
              set brandName to first text item of folderName
              set my text item delimiters to "_PSD"
              set weekNumber to first text item of FolderEndName
              set my text item delimiters to oldTID
      --set up names to destination folders and create locally based on brand name and week number
              set this_local_folder to "Images:2012-2013"
              set localWeekFolder to my getFolderPath("WK" & weekNumber, this_local_folder)
              set localBrandFolder to my getFolderPath(brandName, localWeekFolder)
              set localBrandFolder_PSD to my getFolderPath(brandName & "_WK" & weekNumber & "_PSD", localBrandFolder)
              set this_Network_folder to "DCKGEN:Brands:Zoom:Brand - Zoom:Upload Photos:2013:"
              set networkWeekFolder to my getFolderPath("Week" & weekNumber, this_Network_folder)
              set networkBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", networkWeekFolder)
              set website_images to "DCKGEN:Website_Images:"
      --set up names to destination folders and create over Netwrok for FTP collection (based on a mounted drive)
              set this_ftp_folder to "Impulse:"
              set ftpWeekFolder to my getFolderPath("Week" & weekNumber, this_ftp_folder)
              set ftpBrandFolder to my getFolderPath(brandName, ftpWeekFolder)
              set ftpBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", ftpBrandFolder)
              set ftpBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", ftpBrandFolder)
      --taking the folder identify which process it must follow.
              if brandName is equal to "BHS" then
                        try
                                  tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
                        on error
                                  set o's theseNames to {} -- no psd files or "8BPS"
                        end try
                        set numOfNames to (count o's theseNames)
                        repeat with j from 1 to numOfNames
                                  set thefile to theFolder & ":" & (item j of o's theseNames)
      --    B H S    Folder Photoshop Process
                                  set thisName to (item j of o's theseNames)
                                  tell application "Finder"
                                            set t_ext to name extension of file thefile
                                            if t_ext is not "" then set thisName to text 1 thru -((count t_ext) + 2) of thisName
                                            set b to exists file (localBrandFolder_PSD & thisName & ".psd")
                                  end tell
                                  if not b or (b and not skipFiles) then -- not exists file or file exists and "replace" (continue the rest of the script).
                                            tell application "Adobe Photoshop CS5.1"
      -- I remove the command activate, Photoshop stay in background
                                                      set ruler units of settings to pixel units
                                                      try
      open (alias thefile) showing dialogs never
                                                                set origName to name of current document
                                                                set myOptions to {class:JPEG save options, quality:12}
                                                                set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
                                                                tell current document
      --If the quick mask mode has been left on then delete the channel Quick Mask
                                                                          if (quick mask mode) then delete channel ¬
                                                                                    "Quick Mask"
      --If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
                                                                          if (exists layer "Original Layer") then ¬
                                                                                    tell layer "Original Layer" to set name to "Original Image"
      save in (localBrandFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
                                                                          (delete layer "Original Image") flatten
      resize image resolution 300 resample method none
      --sharpen image
      filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
      save in (ftpBrandFolder_High_Res & name) as JPEG with options myOptions without copying
      --Prepare for Low RES by resetting image history
                                                                          set current history state to history state 3
                                                                          flatten
                                                                          resize image width 1348
      resize image resolution 300 resample method none
      filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
      --add save to lowResFolder with same options
      save in (networkBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
                                                                          set newFile to file path
                                                                          set newFile2 to newFile as string -- for testing end of name
                                                                          if newFile2 ends with "_2.jpg" or newFile2 ends with "_3.jpg" or newFile2 ends with "_4.jpg" or newFile2 ends with "_5.jpg" or newFile2 ends with "_6.jpg" or newFile2 ends with "_7.jpg" or newFile2 ends with "_8.jpg" or newFile2 ends with "_9.jpg" or newFile2 ends with "_10.jpg" or newFile2 ends with "11.jpg" then -- exclude website_images
                                                                                    my duplicateFile(newFile, {ftpBrandFolder_Low_Res})
                                                                          else
                                                                                    my duplicateFile(newFile, {ftpBrandFolder_Low_Res, website_images})
                                                                          end if
      close saving no
                                                                end tell
                                                      on error
                                                                set noError to false
                                                                my myLogs(thefile) -- write path to log file in Desktop
                                                                try
      close saving no --if exists, close current document
                                                                end try
                                                      end try
                                            end tell
                                  end if
                        end repeat
      --End BHS
      --taking the folder identify which process it must follow. B U R T O N
              else if brandName is equal to "Burton" then
                        try
                                  tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
                        on error
                                  set o's theseNames to {} -- no psd files or "8BPS"
                        end try
                        set numOfNames to (count o's theseNames)
                        repeat with j from 1 to numOfNames
                                  set thefile to theFolder & ":" & (item j of o's theseNames)
      --    B U R T O N    Folder Photoshop Process
                                  set thisName to (item j of o's theseNames)
                                  tell application "Finder"
                                            set t_ext to name extension of file thefile
                                            if t_ext is not "" then set thisName to text 1 thru -((count t_ext) + 2) of thisName
                                            set b to exists file (localBrandFolder_PSD & thisName & ".psd")
                                  end tell
                                  if not b or (b and not skipFiles) then -- not exists file or file exists and "replace" (continue the rest of the script).
                                            tell application "Adobe Photoshop CS5.1"
      -- I remove the command activate, Photoshop stay in background
                                                      set ruler units of settings to pixel units
                                                      try
      open (alias thefile) showing dialogs never
                                                                set origName to name of current document
                                                                set myOptions to {class:JPEG save options, quality:12}
                                                                set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
                                                                tell current document
      --If the quick mask mode has been left on then delete the channel Quick Mask
                                                                          if (quick mask mode) then delete channel ¬
                                                                                    "Quick Mask"
      --If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
                                                                          if (exists layer "Original Layer") then ¬
                                                                                    tell layer "Original Layer" to set name to "Original Image"
      save in (localBrandFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
                                                                          (delete layer "Original Image") flatten
      resize image resolution 300 resample method none
      --sharpen image
      filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
      save in (ftpBrandFolder_High_Res & name) as JPEG with options myOptions without copying
      --Prepare for Low RES by resetting image history
                                                                          set current history state to history state 3
                                                                          flatten
                                                                          resize image width 1020
      resize image resolution 300 resample method none
      filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
      --add save to lowResFolder with same options
      save in (networkBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
                                                                          set newFile to file path
                                                                          set newFile2 to newFile as string -- for testing end of name
                                                                          if newFile2 ends with "_2.jpg" or newFile2 ends with "_3.jpg" or newFile2 ends with "_4.jpg" or newFile2 ends with "_5.jpg" or newFile2 ends with "_6.jpg" or newFile2 ends with "_7.jpg" or newFile2 ends with "_8.jpg" or newFile2 ends with "_9.jpg" or newFile2 ends with "_10.jpg" or newFile2 ends with "11.jpg" then -- exclude website_images
                                                                                    my duplicateFile(newFile, {ftpBrandFolder_Low_Res})
                                                                          else
                                                                                    my duplicateFile(newFile, {ftpBrandFolder_Low_Res, website_images})
                                                                          end if
      close saving no
                                                                end tell
                                                      on error
                                                                set noError to

Maybe you are looking for