EJB QL - removal from 2 tables in one query

Hi All,
I have a question - can I delete data from 2 tables in the one EJB 3 query ?
For example:
delete from AaaaaSaaaaRaaaaa a, AaaaaFaaaaaRaaaaa b where a.id = b.id and a.startTime < :STARTTIMEAaaaaSaaaaRaaaaa and AaaaaFaaaaaRaaaaa - two separated entities mapped on the different tables.
In this case I got exception:
ERROR [PARSER] line 1:76: unexpected token: ,Thanks !

I think .. answer is - NO :(
Another question - how to delete data from 2 tables in the one query in some other way (with condition above and with EJB QL)?
Thanks

Similar Messages

  • Translation language 'FR' entires all got removed from table: RSZELTTXT

    Hi All,
    We are doing global BI implementation.
    We need the reports run in English and French.
    We have spent a great amount of time and made the needed entries for translation in French language, in the table: RSZELTXT, for all the english entries corresponding to all BW query elements.
    Today suddenly, we have found that all the entries related to 'FR' language got completely removed.
    All the BW team members are pretty sure that no body touched this table.
    How could this happen?
    Thanks in advance.
    Thanks & Best Regards,
    - Shashi

    Hi All,
    I have mistyped the table name in the body of the thread;
    Here is the correct one;
    Translation language 'FR' entires all got removed from table: RSZELTTXT
    Thanks,
    - Shashi

  • HT4413 Will the files that you transfer to the new mac, be removed from the old one or just copied?

    Will the files that you transfer to the new mac, be removed from the old one or just copied?

    Copied.

  • Rows in all tables in one query

    Hi All,
    How can i find the numbers of rows (records) in all the tables except system tables with single query.
    In one tran table i have around 10,00,000 (TEN LACS) rows. while processing it take time. Plz suggest some solution for this.
    Regards,
    Mummy

    Hi,
    You could use the NUM_ROWS column in the ALL_TABLES table. This column only gets populated if you collect statistics on the relevant tables though.
    See: http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_2105.htm#REFRN20286
    You can analyze the relevant tables first and then use a SUM. For instance this query gets the total number of rows in the tables in the schema MAST:
    select sum(num_rows) from all_tables where owner = 'MAST';
    Regards,
    Marco
    =
    www.marcostuijvenberg.nl

  • SSIS-How to pass multiple value to stored procedure from table row one by one using ssis package??

    I want to execute a stored procedure using ssis.But the problem  I am having is that there is a table with 200 rows with only
    single column.Now i want to execute stored procedure using value one by one from table .once the stored procedure is executed with top value from table i also want to delete that topmost column value and execute with next table value.and store the result in
    text file.
    please help me..or provide a package.

    If you want to do it in SSIS, a way to do this is by using For Each Loop as mentioned above.
    Create 1 OBJECT type variable (list of values) and one STRING type variable (one value at a time)
    Use EXE SQL Task with ResultSet = FULL RESULT SET and query = SELECT COL FROM TABLE ORDER BY COL ASC...output this to the OBJECT type variable 
    Next, a For Each loop container with Foreach ADO Enumerator, ADO object source variable = Object type variable and map that to String type variable with index = 0.
    Within your for each loop container, select another EXEC SQL Task and pass in an input parameter (the String type variable) and query = EXEC PROC ? -- WHERE ? = String type variable.
    This will execute your store procedure just for that one value out of the whole list.
    Now within the same For Each loop, select another EXEC SQL Task and again pass in an input parameter (the same String type variable) and query = DELETE FROM TABLE WHERE COL = ? -- WHERE ? = the current value 
    The above process should A) get the list of values from the table B) pick one value at a time and execute the proc and delete and right after delete that value from the table.
    Hope this helps.
    -- some further investigation/tweaking may require but it should help you get started.

  • Can not delete data from table which is queried in my stored procedure

    Hi,
    Anyone knows how to fix it:
    I have a table. In a stored procedure, I have a simple query running on this table.
    When I want to delete one record from that table, I got error message:
    ORA-04091: table *** is mutating, trigger/function may not see it.
    Thanks first.

    Rick, the only time you should get a mutating table error is when a trigger is involved. FK problems have separate error codes (and would be a different problem than the one that started this thread). Using a DBA id check all the tables subject to DML by your function and by whatever calls your function for triggers. Only the owner or a DBA can see the existence of triggers on a non-owned table. This has caused some of the developers I work with to think tables that had triggers do not have them since they do not work under the owning or a DBA ID.
    By your description of what you are trying to do in the function we do that all the time without problem.
    How large is the function? How/When is it called?
    Mark D Powell

  • Remove from Table

    Hello all. I have a listbox that i am using to design cycles and add cycle steps to a table. If i make a mistake i can clear the whole table by reinitializing to default value. My problem is that i cannot figure out how to remove the last step in the table. Any help is Greatly appreciated.
    Thanks
    Mike 
    I have attached my main vi. just delete the two subvis and it will run fine. 
    Attachments:
    Build TEST.vi ‏88 KB

    Hi Moderator,
    This is the second attachment that is behaving like this
    This mail also had the same problem
    http://forums.ni.com/ni/board/message?board.id=170&message.id=158868
    On one attempt to download, it asked me to download some software/exe, a pic of which i have attached.
    Regards
    Dev
    Attachments:
    msg.jpg ‏24 KB

  • Delete data from tables in one step

    HI ,
    There is a way to delete in one step data from 3 tables with specific key  something like similar to join but with delete operation .
    Thanks
    joy

    You need to use OPENSQL comands to do this with option DELETE CASCADE
    Please check this
    http://help.sap.com/saphelp_nw70/helpdata/en/34/ee7fbd293911d3a97d00a0c9449261/content.htm

  • From table hard coded in query

    (1)The below query i have encounterd in the code for which i m handling CR.
    kindly help me in understanding what does it means FROM TABLE inthe below
    query..
    select distinct transport_mode, orgp_id_2
    into p_transport_mode, p_consignee_id
    from packing_lists
    where org_id = p_org_id
    and id in(select * from table(pacc19.inlist(p_pal_ids)));
    (2) In the below function i couldnt understand
    typevar50 &
    v_data.extend;
    What could they be.?
    FUNCTION inlist(
    p_string IN VARCHAR2)
    RETURN typevar50
    IS
    v_string LONG DEFAULT p_string || ',';
    v_data typevar50 := typevar50();
    v_position NUMBER;
    BEGIN
    LOOP
    EXIT WHEN v_string IS NULL;
    v_position := INSTR(v_string, ',');
    v_data.extend;
    v_data(v_data.COUNT) := LTRIM(RTRIM(SUBSTR(v_string, 1, v_position - 1)));
    v_string := SUBSTR(v_string, v_position + 1);
    END LOOP;
    RETURN v_data;
    END;
    FUNCTION inlist(
    p_string IN VARCHAR2,
    p_delimeter IN VARCHAR2)
    RETURN typevar50
    IS
    v_string LONG DEFAULT p_string || '~';
    v_data typevar50 := typevar50();
    v_position NUMBER;
    BEGIN
    LOOP
    EXIT WHEN v_string IS NULL;
    v_position := INSTR(v_string, '~');
    v_data.extend;
    v_data(v_data.COUNT) := LTRIM(RTRIM(SUBSTR(v_string, 1, v_position - 1)));
    v_string := SUBSTR(v_string, v_position + 1);
    END LOOP;
    RETURN v_data;
    END;
    Kindly help
    Reg.
    AAK
    Message was edited by:
    460425

    typevar50 is a Nested Table Type. The TABLE operator is used to treat this Nested Table Type as a regular table
    SQL> create type nt as table of varchar2(10)
      2  /
    Type created.
    SQL> declare
      2      n nt;
      3  begin
      4     n := nt();
      5     n.extend(3);
      6     n(1) := 'Test1';
      7     n(2) := 'Test2';
      8     n(3) := 'Test3';
      9     --
    10     for rec in (select *
    11                   from table (cast (n as nt))
    12                )
    13     loop
    14        dbms_output.put_line (rec.column_value);
    15     end loop;
    16  end;
    17  /
    Test1
    Test2
    Test3
    PL/SQL procedure successfully completed.There's more information on Nested Tables here:
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_82a.htm#2064937
    Message was edited by:
    Alex Nuijten, changed the name of the nested table type

  • Spool out data from tables by querying user_tables

    I want to write a script to export data from tables that I query out of user_tables.
    like
    for all the tables returned by this query
    select table_name from user_tables where table_name like '%LK';
    I want to run a select * from on them and print the data out.
    Is it possible to do this?
    Thanks,

    I have a nice filedump routine that takes any query provided and produces a flat file. You have options regarding headers, separators, trailing separators, append vs. write mode, etc. Simple to use and works great. I built it into a mail routine that I worked on. We use it regularly in our production environment without issue.
    For details ...see my posting called :
    PL/SQL Mail Utility :: Binary/Ascii/Cc/Bcc/FileDump
    BarryC
    http://www.myoracleportal.com

  • FROM table @ database

    In a SQL statement how can you substitute the database name for a column in a query ?

    select * from table@databaselink
    one time:
    create public synonym syn_table for table@databaselink;
    the this statement delivers the same result:
    select * from syn_table;

  • Update SAME column name in two tables from ONE query

    Dear All Seniors
    Please tell me is it possible to update a same column name in two tables.
    I have two tables in same schema
    (1)table name
    pem.igp_parent
    column name
    igp_no.
    igp_type
    (2)table name
    pem.igp_child
    column name
    igp_no.
    igp_type
    i want to update igp_no column in one query please tell me how it would be possible.
    thanks
    yassen

    You want to update the data from what to what? Where is the new data coming from?
    If you are trying to put the same data in two different tables, that strongly implies that you have a normalization problem that needs to be addressed.
    Why do you want a single query rather than updating each table in turn? Can you join the two target tables to produce a key-preserved view?
    Justin

  • How merge query results from joined table into one additional column

    <code>
    Here is example
    TABLE A:
    id | value
    1 | a
    2 | a
    3 | b
    TABLE B
    id | id_in_table_a | value
    1 | 1 | d
    2 | 1 | e
    3 | 2 | g
    </code>
    this select should get all columns from table A where value = 'a' and all values related to this record from B merged to one column separated for example with pipe, so the output should looks like this
    <code>
    id | value | merged_column
    1 | a | d|e
    2 | a | g
    </code>
    thanks for help

    If you are on 10g, you can use this:
    SQL> create table a
      2  as
      3  select 1 id, 'a' value from dual union all
      4  select 2, 'a' from dual union all
      5  select 3, 'b' from dual
      6  /
    Tabel is aangemaakt.
    SQL> create table b
      2  as
      3  select 1 id, 1 id_in_table_a, 'd' value from dual union all
      4  select 2, 1, 'e' from dual union all
      5  select 3, 2, 'g' from dual
      6  /
    Tabel is aangemaakt.
    SQL> select id
      2       , value
      3       , rtrim(v,'|') merged_column
      4    from ( select id
      5                , value
      6                , v
      7                , rn
      8             from a
      9                , b
    10            where a.id = b.id_in_table_a
    11            model
    12                  partition by (a.id)
    13                  dimension by (row_number() over (partition by a.id order by b.id) rn)
    14                  measures (a.value, cast(b.value as varchar2(20)) v)
    15                  rules
    16                  ( v[any] order by rn desc = v[cv()] || '|' || v[cv()+1]
    17                  )
    18         )
    19   where rn = 1
    20  /
       ID VALUE MERGED_COLUMN
        1 a     d|e
        2 a     g
    2 rijen zijn geselecteerd.Regards,
    Rob.

  • Can you check for data in one table or another but not both in one query?

    I have a situation where I need to link two tables together but the data may be in another (archive) table or different records are in both but I want the latest record from either table:
    ACCOUNT
    AccountID     Name   
    123               John Doe
    124               Jane Donaldson           
    125               Harold Douglas    
    MARKETER_ACCOUNT
    Key     AccountID     Marketer    StartDate     EndDate
    1001     123               10526          8/3/2008     9/27/2009
    1017     123               10987          9/28/2009     12/31/4712    (high date ~ which means currently with this marketer)
    1023     124               10541          12/03/2010     12/31/4712
    ARCHIVE
    Key     AccountID     Marketer    StartDate     EndDate
    1015     124               10526          8/3/2008     12/02/2010
    1033     125               10987         01/01/2011     01/31/2012  
    So my query needs to return the following:
    123     John Doe                        10526     8/3/2008     9/27/2009
    124     Jane Donaldson             10541     12/03/2010     12/31/4712     (this is the later of the two records for this account between archive and marketer_account tables)
    125     Harold Douglas               10987          01/01/2011     01/31/2012     (he is only in archive, so get this record)
    I'm unsure how to proceed in one query.  Note that I am reading in possibly multiple accounts at a time and returning a collection back to .net
    open CURSOR_ACCT
              select AccountID
              from
                     ACCOUNT A,
                     MARKETER_ACCOUNT M,
                     ARCHIVE R
               where A.AccountID = nvl((select max(M.EndDate) from Marketer_account M2
                                                    where M2.AccountID = A.AccountID),
                                                      (select max(R.EndDate) from Archive R2
                                                    where R2.AccountID = A.AccountID)
                   and upper(A.Name) like parameter || '%'
    <can you do a NVL like this?   probably not...   I want to be able to get the MAX record for that account off the MarketerACcount table OR the max record for that account off the Archive table, but not both>
    (parameter could be "DO", so I return all names starting with DO...)

    if I understand your description I would assume that for John Dow we would expect the second row from marketer_account  ("high date ~ which means currently with this marketer"). Here is a solution with analytic functions:
    drop table account;
    drop table marketer_account;
    drop table marketer_account_archive;
    create table account (
        id number
      , name varchar2(20)
    insert into account values (123, 'John Doe');
    insert into account values (124, 'Jane Donaldson');
    insert into account values (125, 'Harold Douglas');
    create table marketer_account (
        key number
      , AccountId number
      , MktKey number
      , FromDt date
      , ToDate date
    insert into marketer_account values (1001, 123, 10526, to_date('03.08.2008', 'dd.mm.yyyy'), to_date('27.09.2009', 'dd.mm.yyyy'));
    insert into marketer_account values (1017, 123, 10987, to_date('28.09.2009', 'dd.mm.yyyy'), to_date('31.12.4712', 'dd.mm.yyyy'));
    insert into marketer_account values (1023, 124, 10541, to_date('03.12.2010', 'dd.mm.yyyy'), to_date('31.12.4712', 'dd.mm.yyyy'));
    create table marketer_account_archive (
        key number
      , AccountId number
      , MktKey number
      , FromDt date
      , ToDate date
    insert into marketer_account_archive values (1015, 124, 10526, to_date('03.08.2008', 'dd.mm.yyyy'), to_date('02.12.2010', 'dd.mm.yyyy'));
    insert into marketer_account_archive values (1033, 125, 10987, to_date('01.01.2011', 'dd.mm.yyyy'), to_date('31.01.2012', 'dd.mm.yyyy'));
    select key, AccountId, MktKey, FromDt, ToDate
         , max(FromDt) over(partition by AccountId) max_FromDt
      from marketer_account
    union all
    select key, AccountId, MktKey, FromDt, ToDate
         , max(FromDt) over(partition by AccountId) max_FromDt
      from marketer_account_archive;
    with
    basedata as (
    select key, AccountId, MktKey, FromDt, ToDate
      from marketer_account
    union all
    select key, AccountId, MktKey, FromDt, ToDate
      from marketer_account_archive
    basedata_with_max_intervals as (
    select key, AccountId, MktKey, FromDt, ToDate
         , row_number() over(partition by AccountId order by FromDt desc) FromDt_Rank
      from basedata
    filtered_basedata as (
    select key, AccountId, MktKey, FromDt, ToDate from basedata_with_max_intervals where FromDt_Rank = 1
    select a.id
         , a.name
         , b.MktKey
         , b.FromDt
         , b.ToDate
      from account a
      join filtered_basedata b
        on (a.id = b.AccountId)
    ID NAME                     MKTKEY FROMDT     TODATE
    123 John Doe                  10987 28.09.2009 31.12.4712
    124 Jane Donaldson            10541 03.12.2010 31.12.4712
    125 Harold Douglas            10987 01.01.2011 31.01.2012
    If your tables are big it could be necessary to do the filtering (according to your condition) in an early step (the first CTE).
    Regards
    Martin

  • SAP Query - Additional field that collects information from table RESB

    Hello gurus. I have a question.
    I want to create a SAP Query that shows me the stock level of a list of materials, and also show me the total quantity of order reservations in an additional field.
    I created an InfoSet with table MARD, which is the one that holds the Stock information in a plant. Then I created an additional field which would read information from table RESB, the table that holds order reservations per material.
    So I wrote this piece of code:
    SELECT * FROM RESB
    WHERE MATNR EQ MARD-MATNR and
           WERKS EQ MARD-WERKS.
    ENDSELECT.
    if ( sy-dbcnt NE '0').
          MOVE RESB-BDMNG to ZQTY.
    ELSE.
          MOVE '' to ZQTY.
    ENDIF.
    This works fine. However, this is currently just catching the first record in table RESB that matches my condition.
    What I would like is to collect every instance of RESB-BDMNG and add them to field "ZQTY", have it loop in RESB until it finishes finding every record that match the MATNR and WERKS. With this I could get the total number of order reservations that this material has in that table.
    Could someone share some coding that would help me achieve this?

    Yes! That did it. That's what I needed to do. Thank you so much.
    While I'm at it, let me ask you a related question.
    When I execute the query, in the first records of the query where there's no value from RESB to transfer, the value of field ZQTY appears empty. Once it finds the first record in RESB and it populates ZQTY with a value, then the rest of the records with no hit get the proper value of 0.
    Do you know why the first records in the query appear empty and not with a 0? Is there anything I should add to the coding to fix this?

Maybe you are looking for

  • Itunes will no longer see/open either of my iphones

    iTunes will no longer see, and therefore open, either of my iPhones both 3GS one version 4.3.5 (8L1) one version 5.1 (9B176) the computer is Win OS7 carrier is AT&T itunes stopped working so I updated it.  iTunes now works but it will nolonger see ei

  • How do I edit a PDF file that was created with Acrobat 6

    I was given a PDF catalog file from one of my manufactures to use on my web  site, I was told that I need to edit the file and take out the last page which  is for my eyes only not the public, but the way they instructed me to do so has  not worked,

  • Power mac G4 933mhz keeps making that Loading sound after everything is loaded?

    Everyting loaded as always. But now the continual loading sound does not stop even though everything works fine. What could it be

  • IFS-21030 Database Operation time out

    Hi everyone, I really need help with this one. I try to search for a folder with a certain value for a custom attribute. It ALWAYS takes a very long time, but some times it returns successfully and sometimes it gives me a "Database Operation timed ou

  • Partners in partners tab in CHARM

    Hi Everybody , I copied standard partner function procedure SDCR0001 to ZDCR0001 and added few new partners. It is working fine . But my issue is in partners tab in CRMD_ORDER i am getting all partner functions in system . I need to have only partner