Insert into one table by query from other table

Dear sir, i have inserted in to Table A as below:
ROLE_ID
USER_ID
AUTH_STAT
BRANCH_CODE
Teller1
Phearom
A
001
Teller2
Phearom
A
001
I want to insert the same more value for field ROLE_ID, USER_ID and AUTH_STAT, except BRANCH_CODE must change. Value of field BRANCH_CODE in can query form Table B.
Kindly give me some idea.
Thank and Regard.
Phearom

7d8870ae-222b-4d73-8251-86f34b1ad49e wrote:
Dear sir, i have inserted in to Table A as below:
ROLE_ID
USER_ID
AUTH_STAT
BRANCH_CODE
Teller1
Phearom
A
001
Teller2
Phearom
A
001
I want to insert the same more value for field ROLE_ID, USER_ID and AUTH_STAT, except BRANCH_CODE must change. Value of field BRANCH_CODE in can query form Table B.
Kindly give me some idea.
Thank and Regard.
Phearom
You don't seem to have taken any notice of the advice given in your last thread: Insert multi row
about reading Re: 2. How do I ask a question on the forums?
and following the advice there.
In fact, I suspect this is just another thread on the same problem.
Unless you give us the information required, we can't really help

Similar Messages

  • Fetch data from two tables and insert into one table

    I have similar to the following data in two tables (@Plant, @PlantDirector) and need to consolidate into one table (@PlantNew) as follows.
    DECLARE @Plant TABLE (PlantID INT, PlantName VARCHAR(100))
    INSERT INTO @Plant (PlantID, PlantName) VALUES (1, 'Name One'),(2, 'Name Two'),(3, 'Name Three'),(4, 'Name Four'),(5, 'Name Five'),(6, 'Name Six')
    Director data for the Plants exist in the following table. Assistant value 1 means Assistant Director and 0 means Director. 
    Data exists only for subset of plants and a Plant may have one or both roles.
    DECLARE @PlantDirector TABLE (PlantID INT, PlantDirectorID INT, Assistant bit)
    INSERT INTO @PlantDirector (PlantID, PlantDirectorID, Assistant) VALUES (2, 111, 1),(2, 222, 0),(4, 333, 0),(6,444,1)
    The above data needs to be inserted into one table (@PlantNew) as follows: 
    PlantID in @Plant table is IDENTITY value and needs to be inserted as-is into this table.
    PlantDirExists will get a value of 1 if at least one record exists in @PlantDirector table for a PlantID. PlantAssistantDirID and PlantDirID should be set to the corresponding PlantDirID or NULL appropriately depending on the data.
    DECLARE @PlantNew TABLE (PlantID INT, PlantName VARCHAR(100), PlantDirExists bit, PlantAssistantDirID INT, PlantDirID INT)
    INSERT INTO @PlantNew (PlantID, PlantName, PlantDirExists, PlantAssistantDirID, PlantDirID)
    VALUES (1, 'Name One', 0, NULL, NULL),(2, 'Name Two', 1, 111, 222),(3, 'Name Three', 0, NULL, NULL),(4, 'Name Four', 1, NULL, 333),(5, 'Name Five', 0, NULL, NULL),(6, 'Name Six',1, 444, NULL)
    How do I achieve the above using SQL ? Thanks.

    like this
    INSERT @PlantNew  (PlantID, PlantName, PlantDirExists, PlantAssistantDirID, PlantDirID) 
    SELECT p.PlantID,
    p.PlantName,
    CASE WHEN pd.PlantID IS NULL THEN 0 ELSE 1 END,
    PlantAssistantDirID,
    PlantDirID
    FROM @Plant p
    LEFT JOIN (SELECT PlantID,
    MAX(CASE WHEN Assistant = 1 THEN PlantDirectorID END) AS PlantAssistantDirID,
    MAX(CASE WHEN Assistant = 0 THEN PlantDirectorID END) AS PlantDirID
    @PlantDirector
    GROUP BY PlantID)pd
    ON pd.PlantID = p.PlantID
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
    You're missing a FROM
    insert into @PlantNew
    SELECT p.PlantID,
    p.PlantName,
    CASE WHEN pd.PlantID IS NULL THEN 0 ELSE 1 END,
    PlantAssistantDirID,
    PlantDirID
    FROM @Plant p
    LEFT JOIN (SELECT PlantID,
    MAX(CASE WHEN Assistant = 1 THEN PlantDirectorID END) AS PlantAssistantDirID,
    MAX(CASE WHEN Assistant = 0 THEN PlantDirectorID END) AS PlantDirID
    from @PlantDirector
    GROUP BY PlantID)pd
    ON pd.PlantID = p.PlantID

  • Help! about insert into one table from two tables'data?

    hi,all friends!
    i have a question:
    i have two table as like this:
    table_one(id,ipaddr,col1,col2) primary key(id,ipaddr)
    table_two(id,ipaddr,col1,col3,col4) primary key(id,ipaddr)
    about table_one and table_two,it's columns may change execept id and ipaddr,
    how can i insert the data of table_one and table_two into table_three,the columns of table_three may change with the columns of table_one and table_two
    table_three may dynamic create,but it's primary key is (id,ipaddr)
    thanks!
    pls help!
    any suggestion welcome!

    insert into table_3
    (id, ipaddr, col1, col2, col3, col4)
    select t1.id, t1.ipaddr, t1.col1, t1.col2, t2.col3, t2.col4
    from table_1 t1, table_2 t2
    where t2.id = t1.id
    and t2.ipaddr = t1.ipaddr;

  • Insert into one table, update another with one form

    Does anyone know how to do this?
    I'm writing a small system where I need to have a master project record in one table, and small little project events in a sub notes table. I want to be able to insert a record with notes into the sub table and update the status in the master table -- all from one form.
    Any thoughts would be very, very appreciated :) -LR

    Hi Lee,
    in case your main Insert transaction provides a value which can be used to identify the master table´s primary key, I think you should set up a Custom Trigger to update a specific record in the master table.
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Fetch data from one table and insert into two tables in desired format

    I have similar to the following data in a table and it is not normalized. The groupID is being used to group two records of similar nature.
    DECLARE @OldDoc TABLE (oldDocID INT, groupID INT, deptID INT)
    INSERT INTO @OldDoc (oldDocID, groupID) VALUES (1, NULL, 111),(2,NULL,111),(3,1,111),(4,NULL,333),(5,1,222),(6,NULL,333),(7,2,222),(8,2,333),(9,NULL,111),(10,3,222),(11,NULL,333),(12,3,444)
    I need to process the data from the above table (@OldDoc) and write into two new tables (@NewDoc and @NewDocGroup) as follows.
    oldDocID should be stored as newDocID when inserting to @NewDoc table. Only records with groupID NULL and one record (first one) per group should be considered (For example, oldDocID 5 is not considered as 3 and 5 belong to the same groupID 1) for insertion. 
    DECLARE @NewDoc TABLE (newDocID INT)
    INSERT INTO @NewDoc (newDocID) VALUES (1),(2),(3),(4),(6),(7),(9),(10),(11)
    All records from @OldDoc should be considered for insertion into @NewDocGroup table. OldDocID is inserted as NewDocID and deptID is as-is. Instead of groupID, the ID of the first record in the 
    group should be considered as parentNewDocID (For example, 3 is considered as parentNewDocID for newDocID 5 as 3 and 5 belong to the same groupID in @OldDoc table) for the newDocID.
    DECLARE @NewDocGroup (newDocID INT, parentNewDocID INT, deptID INT)
    INSERT INTO @NewDocGroup (newDocID, parentNewDocID, deptID) VALUES (1,1,111),(2,2,111),(3,3,111),(4,4,333),(5,3,222),(6,6,333),(7,7,222),(8,7,333),(9,9,111),(10,10,222),(11,11,333),(12,10,444)
    How do I accomplish the above using SQL ? Thanks for the help.

    >> I have similar to the following data in a table and it is not normalized. The group_id is being used to group two records [sic] of similar nature. <<
    Rows are not records. Tables have to have a key by definition. You do not do math with identifiers, so they should not be numeric. Let's ignore that error for now. In short, you are posting garbage. If you had followed Forum Netiquette, would you have posted
    this? 
    CREATE TABLE Old_Documents
    (old_doc_id INTEGER NOT NULL PRIMARY KEY, 
     group_id INTEGER, 
     dept_nbr INTEGER NOT NULL
       REFERENCES Departments (dept_nbr));
    INSERT INTO Old_Documents(old_doc_id, group_id, dept_nbr) 
    VALUES  (1, NULL, 111), 
    (2, NULL, 111), 
    (3, 1, 111), 
    (4, NULL, 333), 
    (5, 1, 222), 
    (6, NULL, 333), 
    (7, 2, 222), 
    (8, 2, 333), 
    (9, NULL, 111), 
    (10, 3, 222), 
    (11, NULL, 333), 
    (12, 3, 444);
    >> I need to process the data from the above table (Old_Documents) and write into two new tables (New_Documents and New_Documents_Groups) as follows. <<
    Just like punch cards and mag tape data processing! Being old and being new are a status, not another kind of entity. But that is how mag tapes work. And you even use the verb "fetch" from tape files. This design flaw is called  attribute splitting.
    Do you have a Male_Personnel and Female_Personnel table? NO! It is just Personnel! 
    >> old_doc_id should be stored as new_doc_id when inserting to New_Documents table. Only records [sic] with group_id NULL and one record [sic] (first [sic; no ordering in a table] one) per group should be considered (For example, old_doc_id 5 is not considered
    as 3 and 5 belong to the same group_id =1) for insertion. <<
    Think about your punch card mindset. Why did you physically materialize that redundant New_Documents table? Let me answer that: this is how you work with punch cards! In SQL we use a VIEW:
    CREATE VIEW New_Documents (new_doc_id)
    AS 
    SELECT old_doc_id 
      FROM Old_Documents;
    >> All records [sic] from Old_Documents should be considered for insertion into New_Documents_Groups table. The old_doc_id is inserted as new_doc_id and dept_nbr is as-is. Instead of group_id, the ID [sic: which identifier??] of the first [sic: tables
    have no ordering like a deck of punch cards] record [sic] in the group should be considered as parent_new_doc_id (For example, 3 is considered as parent_new_doc_id for new_doc_id 5 as 3 and 5 belong to the same group_id in Old_Documents table) for the new_doc_id.
    <<
    Why not use 5 as the parent? My guess is that you are trying to form equivalence classes. See:
    https://www.simple-talk.com/content/print.aspx?article=2020
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • How to insert into 2 tables from the same page (with one button  link)

    Hi,
    I have the following 2 tables....
    Employees
    emp_id number not null
    name varchar2(30) not null
    email varchar2(50)
    hire_date date
    dept_id number
    PK = emp_id
    FK = dept_id
    Notes
    note_id number not null
    added_on date not null
    added_by varchar2(30) not null
    note varchar2(4000)
    emp_id number not null
    PK = note_id
    FK = emp_id
    I want to do an insert into both tables via the application and also via the same page (with one button link). I have made a form to add an employee with an add button - adding an employee is no problem.
    Now, on the same page, I have added a html text area in another region, where the user can write a note. But how do I get the note to insert into the Notes table when the user clicks the add button?
    In other words, when the user clicks 'add', the employee information should be inserted into the Employees table and the note should be inserted into the Notes table.
    How do I go about doing this?
    Thanks.

    Hi,
    These are my After Submit Processes...
    After Submit
    30     Process Row of NOTES     Automatic Row Processing (DML)     Unconditional
    30     Process Row of EMPLOYEES     Automatic Row Processing (DML)     Unconditional
    40     reset page     Clear Cache for all Items on Pages (PageID,PageID,PageID)     Unconditional
    40     reset page     Clear Cache for all Items on Pages (PageID,PageID,PageID)     Unconditional
    40     reset page     Clear Cache for all Items on Pages (PageID,PageID,PageID)     Unconditional
    40     reset page     Clear Cache for all Items on Pages (PageID,PageID,PageID)     Unconditional
    50     Insert into Tables     PL/SQL anonymous block     Conditional
    My pl/sql code is the same as posted earlier.
    Upon inserting data into the forms and clicking the add button, I get this error...
    ORA-06550: line 1, column 102: PL/SQL: ORA-00904: "NOTES": invalid identifier ORA-06550: line 1, column 7: PL/SQL: SQL Statement ignored
         Error      Unable to process row of table EMPLOYEES.
    Is there something wrong with the pl/sql code or is it something else?

  • Insert into multiple tables; grab id from first

    I apologize if this has been answered elsewhere, but I tried
    searching and got no results.
    I'm trying to insert the contents of one form into two
    tables. After inserting some fields into one table, I want to grab
    the key/id from the first table into the second table with the
    other fields.
    I've tried a few different things, including trying to use
    SCOPE_IDENTITY(), but just kept getting lots of errors.
    The current version of my code works perfectly, *except for
    the fact that it doesn't insert the ID*!
    Can anyone tell me what I'm doing wrong? or offer another way
    of doing this?
    Thanks for your help, as usual.

    MarianneStone wrote:
    > The current version of my code works perfectly, *except
    for the fact that it doesn't insert > the ID*!
    > Can anyone tell me what I'm doing wrong?
    The EmployeeID is not inserted because the getMyID query
    cannot find the newly inserted record. When using a UUID to
    identify the new records ..
    <cfquery name="qAddDeptHead" datasource="#db#"
    result="result">
    INSERT INTO Employee(... , EmpUUID)
    VALUES ( ... , '#CreateUUID()#')
    </cfquery>
    You have to use that _same_ UUID to find the record, _not_
    create a new one.
    <cfquery name="getMyID" datasource="#db#">
    SELECT EmployeeID, EmpUUID
    FROM Employee
    WHERE Employee.EmpUUID='#UseTheSameUUIDFromTheFirstQuery#'
    </cfquery>
    As an aside, you could probably do this in two queries not
    three. Just drop the second SELECT query and use an INSERT
    INTO/SELECT .. FROM Table statement instead. Plus you should also
    consider using cfqueryparam for your query parameters. It has many
    benefits.
    http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_p-q_18.html#1102474
    > Can anyone ... offer another way of doing this?
    There are a few options. For ColdFusion 8, you could use the
    result attribute. After running the INSERT you can grab the new
    EmployeeID by using #yourResult.IDENTITYCOL#
    <cfquery name="qAddDeptHead" datasource="#db#"
    result="yourResult">
    INSERT INTO Employee ( Columns here )
    VALUES (... values here ...)
    </cfquery>
    For earlier versions, you can either use SCOPE_IDENTITY() or
    a UUID value - as you are currently doing now.
    > I've tried a few different things, including trying to
    use SCOPE_IDENTITY(),
    > but just kept getting lots of errors.
    If you use SCOPE_IDENTITY() turn off the rowcount, or the
    query variable "qAddDeptHead" may be undefined when you try and use
    it.
    <cfquery name="qAddDeptHead" datasource="#db#"
    result="yourResult">
    SET NOCOUNT ON;
    INSERT INTO Employee ( Columns here )
    VALUES (... values here ...)
    SELECT EmployeeID AS NewEmployeeID
    SET NOCOUNT OFF;
    </cfquery>
    <cfquery name="qNewEmpPosition" datasource="#db#">
    INSERT INTO EmployeePositions(EmployeeID, .... )
    VALUES ( #qAddDeptHead.NewEmployeeID#, ....)
    </cfquery>

  • Inserting into a table which is created "on the fly" from a trigger

    Hello all,
    I am trying to insert into a table from a trigger in Oracle form. The table name however, is inputted by the user in am item form.
    here is what the insert looks like:
    insert into :table_name
    values (:value1, :value2);
    the problem is that forms does not recognize ::table_name. If I replace :table_name with an actual database table, it works fine. However, I need to insert to a table_name based from oracle form item.
    By the way, the table|_name is built on the fly using a procedure before I try to insert into it.
    Any suggestion on how can I do that? My code in the trigger is:
    declare
    dm_drop_tbl(:table_name,'table) // a call to an external procedure to drop the table
    dm_create_tbl(:table_name,'att1','att2');
    insert into :table_name
    values (:value1, :value2);
    this give me an error:
    encounter "" when the symbol expecting one.....

    Hi ,
    You should use the FORMS_DDL built_in procedure. Read the on-line documentation of forms ...
    Simon

  • Strange result from insert into...select query

    Hello guys,
    I need your preciuos help for a question maybe simple, but that I can't explain by myself!
    I have a query of "insert into...select" that, as I have explained in the title, returns a strange result. In facts, If I execute ONLY the SELECT statement the query returns the expected result (so 2 rows); instead If I execute the entire statement, that is the "insert into...select", the query returns 0 rows inserted!!
    Following an example of the query:
    INSERT
    INTO TITOLI_ORI
    COD_TITOLO_RICCONS ,
    D_ESTRAZIONE ,
    COD_SOCIETA ,
    COD_PIANO_CONTABILE ,
    COD_CONTO_CONTABILE ,
    COD_RUBRICATO_STATISTICO_1 ,
    COD_NDG ,
    NUM_ESEGUITO ,
    CUR_IMPORTO_RICCONS ,
    CUR_IMPORTO_BICO ,
    FLG_MODIFICATO ,
    CUR_NON_ASSEGNATO ,
    FLG_QUOTATO ,
    COD_CATEG ,
    TIP_COPERTURA ,
    TIPTAS_TITOLO
    SELECT NEWID,
    '28-feb-2111',
    COD_SOCIETA,
    COD_PIANO_CONTABILE,
    COD_CONTO_CONTABILE,
    COD_RUBRICATO_STATISTICO_1,
    COD_NDG,
    NUM_ESEGUITO,
    CUR_VAL_IMPEGNI,
    'ABC' as CUR_IMPORTO_BICO,
    0 as FLG_MODIFICATO,
    NULL as CUR_NON_ASSEGNATO,
    FLG_QUOTATO,
    COD_CATEG,
    TIP_COPERTURA,
    TIP_TASSO
    FROM
    (SELECT S.COD_SOC AS COD_SOCIETA,
    S.TIP_PIANO_CNTB AS COD_PIANO_CONTABILE,
    S.COD_CONTO_CNTB AS COD_CONTO_CONTABILE,
    S.COD_RUBR_STAT AS COD_RUBRICATO_STATISTICO_1,
    TRC.COD_RAGGR_IAS AS COD_RAGGRUPPAMENTO_IAS,
    TRC.COD_NDG AS COD_NDG,
    TRC.COD_ESEG AS NUM_ESEGUITO,
    CAST((TRC.IMP_PLUS_MINUS_VAL/TRC.IMP_CAMB) AS FLOAT) AS CUR_VAL_IMPEGNI,
    TRC.TIP_QUOTAZ AS FLG_QUOTATO,
    TRC.COD_CAT_TIT AS COD_CATEG,
    TIP_COP AS TIP_COPERTURA,
    T.TIP_TASSO AS TIP_TASSO
    FROM S_SLD_CNTB S
    INNER JOIN
    (SELECT DISTINCT COD_SOC,
    TIP_PIANO_CNTB,
    COD_CONTO_CNTB,
    COD_RUBR_STAT ,
    COD_INTER_TIT AS COD_INTER
    FROM S_COLLEG_CONTO_CNTB_TIT
    WHERE COD_SOC = 'ME'
    ) CCC
    ON S.COD_SOC = CCC.COD_SOC
    AND S.TIP_PIANO_CNTB = CCC.TIP_PIANO_CNTB
    AND S.COD_CONTO_CNTB = CCC.COD_CONTO_CNTB
    AND S.COD_RUBR_STAT = CCC.COD_RUBR_STAT
    INNER JOIN S_TIT_RICCONS TRC
    ON CCC.COD_INTER = TRC.COD_INTER_TIT
    AND CCC.COD_SOC = TRC.COD_SOC
    AND TRC.COD_RAGGR_IAS = RTRIM('VALUE1 ')
    AND TRC.COD_RAGGR_IAS NOT IN ('VALUE2')
    AND TRC.DES_TIP_SLD_TIT_RICCONS IN ('VALUE3')
    AND TRC.DES_MOV_TIT = RTRIM('VALUE4 ')
    AND TRC.COD_CAT_TIT = RTRIM('VALUE4 ')
    AND TRC.COD_INTER_TIT = RTRIM('VALUE5')
    AND '28-feb-2011' = TRC.DAT_RIF
    LEFT JOIN S_TIT T
    ON T.COD_INTER_TIT = TRC.COD_INTER_TIT
    AND T.COD_SOC = TRC.COD_SOC
    AND '28-feb-2011' = T.DAT_RIF
    INNER JOIN S_ANAG_SOGG AG
    ON TRC.COD_NDG = AG.COD_NDG
    AND AG.COD_SOC = TRC.COD_SOC
    AND '28-feb-2011' = AG.DAT_RIF
    WHERE S.DAT_RIF = '28-feb-2011'
    AND (S.FLG_ANULL_BICO = 0
    OR S.FLG_ANULL_BICO IS NULL)
    AND S.COD_SOC = 'V6'
    AND LENGTH(RTRIM(S.COD_CONTO_CNTB)) = 10
    AND S.TIP_PIANO_CNTB = 'V7'
    AND TRC.IMP_PLUS_MINUS_VAL < 0
    AND SUBSTR(S.COD_CONTO_CNTB,1,7) IN (RTRIM('VALUE8 '))
    Thanks a lot

    Right, I have executed this steps:
    - I have changed the query with the select count(*)
    - Changed the insert into with the select count(*)
    - Executed the insert into
    These are the result:
    SQL> select count(*) from TITOLI_ORI2;
    COUNT(*)
    1
    BUT:
    SQL> select * from TITOLI_ORI2;
    A
    0
    The insert into that I've modified is this:
    INSERT INTO bsc.TITOLI_ORI2
    select count(*)
    FROM
    (SELECT bsc.NEWID,
    TO_DATE('28-feb-2111','DD-MON-YYYY') as data,
    COD_SOCIETA,
    COD_PIANO_CONTABILE,
    COD_CONTO_CONTABILE,
    COD_RUBRICATO_STATISTICO_1,
    COD_NDG,
    NUM_ESEGUITO,
    CUR_VAL_IMPEGNI,
    'ABC' AS CUR_IMPORTO_BICO,
    0 AS FLG_MODIFICATO,
    NULL CUR_NON_ASSEGNATO,
    FLG_QUOTATO,
    COD_CATEG,
    TIP_COPERTURA,
    TIP_TASSO
    FROM
    (SELECT S.COD_SOC AS COD_SOCIETA,
    S.TIP_PIANO_CNTB AS COD_PIANO_CONTABILE,
    S.COD_CONTO_CNTB AS COD_CONTO_CONTABILE,
    S.COD_RUBR_STAT AS COD_RUBRICATO_STATISTICO_1,
    TRC.COD_RAGGR_IAS AS COD_RAGGRUPPAMENTO_IAS,
    TRC.COD_NDG AS COD_NDG,
    TRC.COD_ESEG AS NUM_ESEGUITO,
    CAST((TRC.IMP_PLUS_MINUS_VAL/TRC.IMP_CAMB) AS FLOAT) AS CUR_VAL_IMPEGNI,
    TRC.TIP_QUOTAZ AS FLG_QUOTATO,
    TRC.COD_CAT_TIT AS COD_CATEG,
    TIP_COP AS TIP_COPERTURA,
    T.TIP_TASSO AS TIP_TASSO
    FROM bsc.S_SLD_CNTB S
    INNER JOIN
    (SELECT DISTINCT COD_SOC,
    TIP_PIANO_CNTB,
    COD_CONTO_CNTB,
    COD_RUBR_STAT ,
    COD_INTER_TIT AS COD_INTER
    FROM bsc.S_COLLEG_CONTO_CNTB_TIT
    WHERE COD_SOC = 'ME'
    ) CCC
    ON S.COD_SOC = CCC.COD_SOC
    AND S.TIP_PIANO_CNTB = CCC.TIP_PIANO_CNTB
    AND S.COD_CONTO_CNTB = CCC.COD_CONTO_CNTB
    AND S.COD_RUBR_STAT = CCC.COD_RUBR_STAT
    INNER JOIN bsc.S_TIT_RICCONS TRC
    ON CCC.COD_INTER = TRC.COD_INTER_TIT
    AND CCC.COD_SOC = TRC.COD_SOC
    AND TRC.COD_RAGGR_IAS = RTRIM('HFT ')
    AND TRC.COD_RAGGR_IAS NOT IN ('GPO')
    AND TRC.DES_TIP_SLD_TIT_RICCONS IN ('DISPONIBILI')
    AND TRC.DES_MOV_TIT = RTRIM('CONSEGNARE ')
    AND TRC.COD_CAT_TIT = RTRIM('OBBLIGAZIONE ')
    AND TRC.COD_INTER_TIT = RTRIM('334058')
    AND '28-feb-2011' = TRC.DAT_RIF
    LEFT JOIN bsc.S_TIT T
    ON T.COD_INTER_TIT = TRC.COD_INTER_TIT
    AND T.COD_SOC = TRC.COD_SOC
    AND '28-feb-2011' = T.DAT_RIF
    INNER JOIN bsc.S_ANAG_SOGG AG
    ON TRC.COD_NDG = AG.COD_NDG
    AND AG.COD_SOC = TRC.COD_SOC
    AND '28-feb-2011' = AG.DAT_RIF
    WHERE S.DAT_RIF = '28-feb-2011'
    AND (S.FLG_ANULL_BICO = 0
    OR S.FLG_ANULL_BICO IS NULL)
    AND S.COD_SOC = 'ME'
    AND LENGTH(RTRIM(S.COD_CONTO_CNTB)) = 10
    AND S.TIP_PIANO_CNTB = 'IS'
    AND TRC.IMP_PLUS_MINUS_VAL < 0
    AND SUBSTR(S.COD_CONTO_CNTB,1,7) IN (RTRIM('P044C11 '))
    Another time the strange result returns!!
    And I've created the table TITOLI_ORI2 as create table TITOLI_ORI2 (a number); to contain the number result of the query.

  • How to extract data from xml and insert into Oracle table

    Hi,
    I have a large xml file. which will have hundreds of the following transaction tags having column names and there values.
    There is a table one of the schema with coulums "actualCostRate","billRate"....etc.
    I need to extract the values of these columns and insert into the table
    <Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuUK" chargeCode="LCOCD1" externalID="L-RESCODE_UK1-PROJ_UK_CNT_GBP-37289-8" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-12" transactionType="L" units="11" taskID="5017601" inputTypeCode="SALES" groupId="123" voucherNumber="ABCVDD" transactionClass="ABCD"/>
    <Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuEU" chargeCode="LCOCD1" externalID="L-RESCODE_US1-PROJ_EU_STD2-37291-4" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-04" transactionType="L" units="4" taskID="5017601" inputTypeCode="SALES" groupId="124" voucherNumber="EEE222" transactionClass="DEFG"/>

    Re: Insert from XML to relational table
    http://www.google.ae/search?hl=ar&q=extract+data+from+xml+and+insert+into+Oracle+table+&btnG=%D8%A8%D8%AD%D8%AB+Google&meta=

  • How to Improve inserts into Template table for Query Processing

    Hi guys!
    I need your advice. How can i improve inserts into template table (/BI0/0P00000010 for exemple)? In my scenario i forced to load data from cube C_X to cubes C_1, C_2 and C_3.
    To get a goal i created a transformations and a DTP process with delta upload to each of cubes (C_1, C_2, C3). And that proccess takes about 3 hours! (it doesn't matter 1.000 or 100.000 records). But when i tried to load data with full update (with a filter) a proccess get data takes about 1 minutes.
    I traced process and saw that inserting into template table (which create each time when proccess started) take the longest time. How can i improve it?

    Hi Mahendar,
    It will require some efforts to investigate it so I propose to open a support ticket with Microsoft (through portal).
    Your first question interest me and I am not sure if you are doing proactive or reactive real time reporting. You can try with
    HBase for storing and retrieving data. HBase known for providing good read and write speed. If you are not comfortable writing HBase syntax then you can add an abstraction layer i.e. HIVE. It might take little more time when you
    query HBase from Hive.
    If you are doing real time analytic, then you can choose from Strom and Microsoft Azure Stream Analytic.
    Thanks and Regards,  
    Sudhir Rawat

  • Multiple BI Query Results into one Table

    Hi All
    Can I embed Multiple queries into one table using VC?
    I have data in different BI sources(Info Areas) like sales and distribution,Shipments etc. Can I write any universal query to retrive data from multiple sources?(If any???)

    Hi Jan Pasha,
    My model contains two BW queries which uses UNION and sent result to one table.
    I tried using UNION also but when I use it I am able to see no records to select in result table.
    I donot have any coloums in common. Is it pre-requisite for using UNION?

  • Insert into local table as select from remote tables

    Hi all,
    In Oracle DB version 11g i have the following issue:
    I want to insert into a table in the current schema as selecting data from two remote tables. I execute the insert in portions of data. Firstly, when the target table where i want to insert is empty the Select as Insert is being executed very fast. But after every insert i made , the performance became worse than the previous one. I have no FKs or indexes in the local table/target table where i'm inserting/... I tried using /*+ append*/ hint but no success...what should be the reason of that?
    Thanks in advance,
    Alexander.

    a.stoyanov wrote:
    Hi all,
    In Oracle DB version 11g i have the following issue:
    I want to insert into a table in the current schema as selecting data from two remote tables. I execute the insert in portions of data. Firstly, when the target table where i want to insert is empty the Select as Insert is being executed very fast. But after every insert i made , the performance became worse than the previous one. I have no FKs or indexes in the local table/target table where i'm inserting/... I tried using /*+ append*/ hint but no success...what should be the reason of that?
    Thanks in advance,
    Alexander.How should we know? You don't give enough information to be able to tell. Not even the SQL involved.
    Please read {message:id=9360002} and {message:id=9360003}
    and follow the advice given.

  • Inserting into multiple tables on one form using UIX

    We are developing an application using struts and UIX. We would like to be able to insert into three tables on one form(view). How can we accomplish this?

    This is more of an ADF question, you'll need to set up view object, than just drag it from the data control palette like normal.
    If it's not already set up as a view in the db (split into multiple tables), you'll need to create a view object that includes all the fields you want, based on multiple entity objects.

  • Insert into two tables with a single query (same ID)

    Hello,
    I want to insert two tables at the same time ( with a single query) provided that both records get inserted with the same id. How do I do this?
    Table Movies
    id
    name
    Table Category
    movie_id
    cat_typea) Insert into first table, retrieve the id (may be by using my_sequence.currval and then insert into another table.
    issue: Makes three query to the db, I am also guessing that when multiple people try to insert there will be an issue, I might be wrong.
    I don't have any other idea.
    Greatly appreciated!

    Why don't use multitable insert ? It's available from 9i.
    A sequence.nextval will return the same value within the whole instruction
    so all records can be inserted with the same id.
    Look at this example:
    DROP TABLE A;
    DROP TABLE B;
    drop sequence a_seq;
    CREATE TABLE A(
      ID NUMBER,
      FIRSTNAME VARCHAR2(50)
    CREATE TABLE B AS
    SELECT id, firstname lastname FROM a;
    CREATE SEQUENCE a_seq
    START WITH 1;
    INSERT ALL
    INTO A(ID, FIRSTNAME) VALUES(A_SEQ.NEXTVAL, FNAME)
    INTO B(ID, LASTNAME) VALUES(A_SEQ.NEXTVAL, LNAME)
    SELECT 'fname ' || LEVEL FNAME, 'lname ' || LEVEL LNAME
    FROM DUAL
    CONNECT BY LEVEL < 10
    COMMIT;
    SELECT * FROM A;
    SELECT * FROM b;
    DROP TABLE A succeeded.
    DROP TABLE B succeeded.
    drop sequence a_seq succeeded.
    CREATE TABLE succeeded.
    CREATE TABLE succeeded.
    CREATE SEQUENCE succeeded.
    18 rows inserted
    commited
    ID                     FIRSTNAME                                         
    3                      fname 1                                           
    4                      fname 2                                           
    5                      fname 3                                           
    6                      fname 4                                           
    7                      fname 5                                           
    8                      fname 6                                           
    9                      fname 7                                           
    10                     fname 8                                           
    11                     fname 9                                           
    9 rows selected
    ID                     LASTNAME                                          
    3                      lname 1                                           
    4                      lname 2                                           
    5                      lname 3                                           
    6                      lname 4                                           
    7                      lname 5                                           
    8                      lname 6                                           
    9                      lname 7                                           
    10                     lname 8                                           
    11                     lname 9                                           
    9 rows selected

Maybe you are looking for