How to use insert into...select * from...if source table is huge in size

The source tables are having crores of data (growing tables). Tables with 4crores, 17cr. We want these tables to be copied frequently to our local database. Previously it was done by export-import through windows scheduled task. but now we are planning to do it as database jobs. We are fetching the datas with query
insert into dest_tablee( select * from source_table@dblink) when we tried with this it was throwing exception like enough table space is not there. And also it was found that frequent commits has to be used while populating datas from big tables. So tried with cursor But it was very slow and again we got the exception like 'the table space unable to extend segment by 16 in undo tablespace 'UNDOTBS1'.
After that we tried with the group by. In this case we got the exception like unable to extend table and also index in the table space. For this the solution is to add datafile. Again we have increase the table space. Now the procedure is running very slow(taking much time. It might be because of the conditions used in the query).
Is there any other option to copy the datas from such a big tables? can we use the same sort of query?
Friends please help me to sort it out.
Thanks in Advance

Hi,
you have lot of data DONT use cursor, did you try using the COPY command.
How frequently you will be doing the COPYING of the data ?
If you have any constraints you can disable and enable after all the records have been copied.
Please look at this link this should help.
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:5280714813869
Thanks
Message was edited by:
hkandpal
Link added

Similar Messages

  • How to use "insert into & select" in format search

    Hello,
    I am just wonderring whether you can help me solve this issue.
    I want to change the value of a field in the title area for a sales quotation. however, this field is not shown up on the interface.
    For example, there is a field in the title area, "OQUT.Ref1". You actually cannot see this field from the quotation interface or any other doc. Now I want to update the value of this field.
    What I am now trying to do is to create an field named "update" in the title area, use format search to update. the code for the command will be something like
    Insert into $[OQUT.Ref1.0]
    select $[OQUT.U_MFG#]
    here, U_MFG# is UDF. as you may understand, I want to copy the value in the U_MFG# to the field of "Ref1".
    However, when I run "Execute", it gives me error. I believe there is something wrong with the code of "Insert into $[OQUT.Ref1.0]
    Does anyone know how to write the code?
    many thanks
    Stanley

    Thanks both Suda and sagar. The reason I wanted to do this is because I wanted to have UDF info be shown on the  MS word-templated quotation document.
    As you know, when you click the word symbol, a word-templated doc will be generated. The client needs two completely different format of quotation printout. thus I plan to print one type from PLD and other type by clicking the Word symbol. but later, I found out that the UDF field cannot be selected on the MS word template, or only system fields.
    Thus, the only way I can do is to copy the value from udf to some unused sytem fields and then show that system fields on the MS word template.
    any idea do you have?
    I wanted to tell SAP that It is not useful if the udf fields cannot be inserted into word template.
    thanks
    Stanley

  • How to use INSERT INTO ALL statement in jdbc prepared statement with beans

    Kindly give me some example that how we can use "INSERT INTO ALL STATEMENT" in jdbc prepared statement inside a jsf bean?
    Actually i want to take employee id's of present employees using single jsf page and using one textbox for each employee id.
    How can i use INSERT INTO ALL statement to achieve this?
    Following is my code snippet.
    AttendanceBean.java:
    public class AttendanceBean {
    private int atteid;
    private String attdname;
    private int attday;
    private int attmonth;
    private int attyear;
    public static Connection getAttConnection() throws Exception {
    String driver = "oracle.jdbc.driver.OracleDriver";
    String url = "jdbc:oracle:thin:@localhost:1521:globldb3";
    String username = "scott";
    String password = "tiger";
    Class.forName(driver);
    Connection conn = DriverManager.getConnection(url, username, password);
    return conn;
    public String addAttendance(){
    Connection conn = null;
    PreparedStatement pstmt = null;
    boolean committed = false;
    try {
    conn = getAttConnection();
    conn.setAutoCommit(false);
    String query = "INSERT ALL INTO attendance VALUES (?,?,?,?,?)";
    pstmt = conn.prepareStatement(query);
    pstmt.setInt(1,this.atteid);
    pstmt.setString(2,this.attdname);
    pstmt.setInt(3,this.attday);
    pstmt.setInt(4,this.attmonth);
    pstmt.setInt(5,this.attyear);
    pstmt.executeUpdate();
    conn.commit();
    conn.setAutoCommit(true);
    committed = true;
    return "home.xhtml";
    } catch (Exception e) {
    e.printStackTrace();
    return "CRM.xhtml";
    } finally {
    try{
    if (!committed) conn.rollback();
    if (pstmt != null) pstmt.close();
    if (conn != null) conn.close();
    }catch(Exception e){
    e.printStackTrace();
    }

    Check this program for some info on Push buttons:
    1-DEMO_DYNPRO_PUSH_BUTTON
    2-DEMO_DYNPRO_MODULE
    3-DEMO_DYNPRO_ON_CONDITION
    Suppose Your screen is 101
    Then in that screen create one push button and assign it a function code.
    Now in the PAI of the 101 screen
    Create Module for user command
    Inside that module checc the sy-ucomm if sy-ucomm eq <Function code of your push button>
    Insert the values in database.
    *& Module USER_COMMAND_0101 INPUT
    process after input for screen 0101 *
    MODULE USER_COMMAND_0101 INPUT.
    CASE OK_CODE.
    WHEN 'SAVE'.
    *Insert the values here
    WHEN 'DISP'.
    ENDCASE.
    CLEAR OK_CODE.
    ENDMODULE. " USER_COMMAND_0101 INPUT
    Regards
    Neha
    Edited by: Neha Shukla on Dec 3, 2008 1:02 AM
    Edited by: Neha Shukla on Dec 3, 2008 1:02 AM
    Edited by: Neha Shukla on Dec 3, 2008 1:06 AM

  • How to run insert/update/delete from CDC Change table to target using OWB

    I am planning to set up CDC and publish CDC change table as source data into to OWB. I have come across where I am confused how to apply changes from CDC change table to target database using OWB. For i.e. change tables is containing information like
    operation$, cscn$,commit_timestamp$,xidusn$,....,list of column name
    D,12323223,8/28/2008 1:44:32PM,24,.....,list of column value that have to be deleted from target
    UO,12323224,8/28/2008 1:45:23PM,24,.....,list of column value that have to be updated in target.
    Please advice or give me some hint. Thank you.

    Hi,
    you can wait for 11gR2 with CDC integration or build most of the code outside the owb. To use CDC you must do this things (http://www.oracle.com/technology/oramag/oracle/03-nov/o63tech_bi.html):
    1. Identify the source tables.
    2. Set up a publisher.
    3. Create change tables.
    4. Set up a subscriber.
    5. Subscribe to the source tables, and activate the subscription.
    6. Set up the CDC window.
    7. Prepare a subscriber view.
    8. Access data from the change tables.
    9. Drop the subscriber view, and purge the CDC window.
    10. Repeat steps 6 through 9 to see new data.
    You can do only a few of this inside owb, most of it must be done outside.
    Regards,
    Detlef

  • How to use INSERT query ?

    Frenz,
    I have created one internal table and i am doing loop on it like...
    Loop at it_data into wa_data.
    Endloop.
    I want to insert some data into table zdata.
    How to use INSERT records on this data base table?
    Give me one example.
    Regards,
    RH

    Hi,
    explain better what you want....
    Do you want to change data in an existing raw?
    Loop at tb_data into wa_data.
    wa_data-field1 = 'jsahdu'.
    modify tb_data from wa_data.
    endloop.
    If you want to add raws you use APPEND statement.
    In the end you'll modify your table zdata from the internal table tb_data:
    MODIFY zdata FROM TABLE tb_data.
    Using modify you change raws basing on primary keys. If a raw doesn't exist it will be inserted.
    Regards

  • SELECT * cannot be used in an INSERT INTO query when the source or destination table contains a multivalued field

    Hi,
    I am using Access 2013 and I have the following VBA code, 
    strSQL = "INSERT INTO Master SELECT * from Master WHERE ID = 1"
     DoCmd.RunSQL (strSQL)
    when the SQL statement is run, I got this error.
    SELECT * cannot be used in an INSERT INTO query when the source or destination table contains a multivalued field
    Any suggestion on how to get around this?
    Please advice and your help would be greatly appreciated!

    Rather than modelling the many-to-many relationship type by means of a multi-valued field, do so by the conventional means of modelling the relationship type by a table which resolves it into two one-to-many relationship types.  You give no indication
    of what is being modelled here, so let's assume a generic model where there is a many-to-many relationship type between Masters and Slaves, for which you'd have the following tables:
    Masters
    ....MasterID  (PK)
    ....Master
    Slaves
    ....SlaveID  (PK)
    ....Slave
    and to model the relationship type:
    SlaveMastership
    ....SlaveID  (FK)
    ....MasterID  (FK)
    The primary key of the last is a composite one of the two foreign keys SlaveID and MasterID.
    You appear to be trying to insert duplicates of a subset of rows from the same table.  With the above structure, to do this you would firstly have to insert rows into the referenced table Masters for all columns bar the key, which, presuming this to be
    an autonumber column, would be assigned new values automatically.  To map these new rows to the same rows in Slaves as the original subset you would then need to insert rows into SlaveMastership with the same SlaveID values as those in Slaves referenced
    by those rows in Slavemastership which referenced the keys of the original subset of rows from Masters, and the MasterID values of the rows inserted in the first insert operation.  This would require joins to be made between the original and the new subsets
    of rows in two instances of Masters on other columns which constitute a candidate key of Masters, so that the rows from SlaveMastership can be identified.
    You'll find examples of these sort of insert operations in DecomposerDemo.zip in my public databases folder at:
    https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169
    If you have difficulty opening the link copy its text (NB, not the link location) and paste it into your browser's address bar.
    In this little demo file non-normalized data from Excel is decomposed into a set of normalized tables.  Unlike your situation this does not involve duplication of rows into the same table, but the methodology for the insertion of rows into a table which
    models a many-to-many relationship type is broadly the same.
    The fact that you have this requirement to duplicate a subset of rows into the same table, however, does make me wonder about the validity of the underlying logical model.  I think it would help us if you could describe in detail just what in real world
    terms is being modelled by this table, and the purpose of the insert operation which you are attempting.
    Ken Sheridan, Stafford, England

  • How do I insert cells using INSERT INTO & SET? (Excel oledb)

    Updating a cell works:
        oledbConnect = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\__\\test.xls;Extended Properties='Excel 12.0 Xml;HDR=NO;'");
        oledbConnect.Open();
        oledbCmd.Connection = oledbConnect;
        string stSheetName = "Sheet2";
        string sql;
        sql = "UPDATE [" + stSheetName + "$A1:B1] SET F1=1";
        oledbCmd.CommandText = sql;
        oledbCmd.ExecuteNonQuery();
    Inserting a cell does not:
        sql = "INSERT INTO [" + stSheetName + "$A2:B2] SET F1=2'";
        oledbCmd.CommandText = sql;
        oledbCmd.ExecuteNonQuery();
    I understand that inserting will add a new row ... but this doesn't work either.
        sql = "INSERT INTO [" + stSheetName + "$] SET F1=3";
        oledbCmd.CommandText = sql;
        oledbCmd.ExecuteNonQuery();
    bhs67

    Hi hbs67,
    No, we can't use Insert into with Set, it's the basic syntax in SQL statement. Give the worksheet a header row, then use Insert into or Update syntax with the field name.
    Check more information in this kb article:
    https://support.microsoft.com/en-us/kb/316934?wa=wsignin1.0
    If you have Office application installed on your machine, you could also automate the Excel files with Excel PIA:
    How to automate Microsoft Excel from Microsoft Visual C#.NET
    It's easy to insert or update cell values with the cell address.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Using INSERT INTO for FDM Memory Issue

    All -
    We configured FDM to run an integration script into our EBS instance upon the import step. It worked fine for a time, then we began running out of memory on the FDM server. Upon Oracle's suggestion, we stopped running through a record set to append and update the values to strWorkTableName and instead began using INSERT INTO. I admit, I have never needed to use the INSERT INTO way of doing things so I may be missing something bery basic.
    Our integration script:
    Function SQLIntegration2(strLoc, lngCatKey, dblPerKey, strWorkTableName)
    'Oracle Hyperion FDM IMPORT Integration Script:
    'Created By:       karks
    'Date Created:       2011-10-26 13:05:18
    'Purpose:
    Dim strSQL     'SQL string
    Dim lngPartitionKey
    Dim strConn 'Connection string to the source data
    Set cnSS = CreateObject("ADODB.Connection")
    lngPartitionKey = RES.PlngLocKey
    strConn= "File Name=C:\Users\karksadm\Desktop\NewConnection.udl;"
    cnSS.open strConn
    strSQL = "Insert Into " & strWorkTableName & " (PartitionKey, CatKey, PeriodKey, DataView, Amount , Account, Entity, ICP, UD1, UD2, UD3, UD4) "
    strSQL = strSQL & "SELECT " & lngPartitionKey & ", " & lngCatKey & ", TO_DATE (TO_DATE ('30/12/1899','dd/mm/yyyy')+" & dblPerKey & "), 'YTD', EBS.YTD_BALANCE, EBS.ACCOUNT, EBS.SEGMENT1, EBS.SEGMENT5, EBS.SEGMENT4, EBS.SEGMENT5, '[None]', EBS.CURRENCY_CODE FROM "
    strSQL = strSQL & "(Select D.NAME, A.CODE_COMBINATION_ID, D.NAME LEDGER_NAME, A.ACTUAL_FLAG, C.PERIOD_YEAR, TO_CHAR (C.START_DATE, 'MON-YY') AS PERIOD, B.SEGMENT1, (B.SEGMENT2 || B.SEGMENT3) As ACCOUNT, B.SEGMENT4, B.SEGMENT5, A.CURRENCY_CODE, "
    strSQL = strSQL & "(SUM (A.BEGIN_BALANCE_DR) + SUM (A.PERIOD_NET_DR) - SUM (A.BEGIN_BALANCE_CR) - SUM (A.PERIOD_NET_CR)) As YTD_BALANCE "
    strSQL = strSQL & "FROM GL.GL_BALANCES A, GL.GL_CODE_COMBINATIONS B, GL.GL_PERIODS C, GL.GL_LEDGERS D "
    strSQL = strSQL & "WHERE 1 = 1 And A.LEDGER_ID = D.LEDGER_ID And A.PERIOD_NUM = C.PERIOD_NUM And C.PERIOD_YEAR = A.PERIOD_YEAR "
    strSQL = strSQL & "And A.CODE_COMBINATION_ID = B.CODE_COMBINATION_ID And B.SUMMARY_FLAG = 'N' AND C.PERIOD_SET_NAME = D.PERIOD_SET_NAME "
    strSQL = strSQL & "And (B.SEGMENT1 = 001 And A.CURRENCY_CODE = 'USD' And D.LEDGER_ID = 2022) "
    strSQL = strSQL & "And C.END_DATE = TO_DATE (TO_DATE ('30/12/1899','dd/mm/yyyy')+" & dblPerKey & ") "
    strSQL = strSQL & "And B.CHART_OF_ACCOUNTS_ID = D.CHART_OF_ACCOUNTS_ID And A.ACTUAL_FLAG = 'A' "
    strSQL = strSQL & "And ((A.BEGIN_BALANCE_DR) + (A.PERIOD_NET_DR) - ((A.BEGIN_BALANCE_CR) + (A.PERIOD_NET_CR))) <> 0 "
    strSQL = strSQL & "GROUP BY A.CODE_COMBINATION_ID, D.NAME, A.CURRENCY_CODE, TO_CHAR (C.START_DATE,'MON-YY'), C.PERIOD_YEAR, A.ACTUAL_FLAG, B.SEGMENT1, (B.SEGMENT2 || B.SEGMENT3), B.SEGMENT4, B.SEGMENT5 "
    strSQL = strSQL & "ORDER BY B.SEGMENT4) EBS"
    DW.DataManipulation.fExecuteDML(strSQL)
    'Give success message
    RES.PlngActionType = 2
    RES.PstrActionValue = "SQL Import successful!"
    'Assign Return value
    SQLIntegration2 = True
    cnSS.close
    Set cnSS = Nothing
    End FunctionI can run the SQL minus the Insert line in my SQL Developer and it works fine. When I run the script in its entirety in FDM, we receive the following:
    ** Begin FDM Runtime Error Log Entry [2012-01-23 11:37:30] **
    ERROR:
    Code............................................. -2147217865
    Description...................................... ORA-00942: table or view does not exist
    Insert Into tWibison72564424799 (PartitionKey, CatKey, PeriodKey, DataView, Amount , Account, Entity, ICP, UD1, UD2, UD3, UD4) SELECT 772, 28, TO_DATE (TO_DATE (N'30/12/1899',N'dd/mm/yyyy')+40724), N'YTD', EBS.YTD_BALANCE, EBS.ACCOUNT, EBS.SEGMENT1, EBS.SEGMENT5, EBS.SEGMENT4, EBS.SEGMENT5, N'[None]', EBS.CURRENCY_CODE FROM (Select D.NAME, A.CODE_COMBINATION_ID, D.NAME LEDGER_NAME, A.ACTUAL_FLAG, C.PERIOD_YEAR, TO_CHAR (C.START_DATE, N'MON-YY') AS PERIOD, B.SEGMENT1, (B.SEGMENT2 || B.SEGMENT3) As ACCOUNT, B.SEGMENT4, B.SEGMENT5, A.CURRENCY_CODE, (SUM (A.BEGIN_BALANCE_DR) + SUM (A.PERIOD_NET_DR) - SUM (A.BEGIN_BALANCE_CR) - SUM (A.PERIOD_NET_CR)) As YTD_BALANCE FROM GL.GL_BALANCES A, GL.GL_CODE_COMBINATIONS B, GL.GL_PERIODS C, GL.GL_LEDGERS D WHERE 1 = 1 And A.LEDGER_ID = D.LEDGER_ID And A.PERIOD_NUM = C.PERIOD_NUM And C.PERIOD_YEAR = A.PERIOD_YEAR And A.CODE_COMBINATION_ID = B.CODE_COMBINATION_ID And B.SUMMARY_FLAG = N'N' AND C.PERIOD_SET_NAME = D.PERIOD_SET_NAME And (B.SEGMENT1 = 001 And A.CURRENCY_CODE = N'USD' And D.LEDGER_ID = 2022) And C.END_DATE = TO_DATE (TO_DATE (N'30/12/1899',N'dd/mm/yyyy')+40724) And B.CHART_OF_ACCOUNTS_ID = D.CHART_OF_ACCOUNTS_ID And A.ACTUAL_FLAG = N'A' And ((A.BEGIN_BALANCE_DR) + (A.PERIOD_NET_DR) - ((A.BEGIN_BALANCE_CR) + (A.PERIOD_NET_CR))) <> 0 GROUP BY A.CODE_COMBINATION_ID, D.NAME, A.CURRENCY_CODE, TO_CHAR (C.START_DATE,N'MON-YY'), C.PERIOD_YEAR, A.ACTUAL_FLAG, B.SEGMENT1, (B.SEGMENT2 || B.SEGMENT3), B.SEGMENT4, B.SEGMENT5 ORDER BY B.SEGMENT4) EBS
    Procedure........................................ clsDataManipulation.fExecuteDML
    Component........................................ upsWDataWindowDM
    Version.......................................... 1112
    Thread........................................... 4424
    IDENTIFICATION:
    User............................................. ibisons
    Computer Name.................................... HOU-HYSDEV02
    App Name......................................... SWNFDMRC
    Client App....................................... WebClient
    CONNECTION:
    Provider......................................... ORAOLEDB.ORACLE
    Data Server......................................
    Database Name.................................... FDMDEV
    Trusted Connect.................................. False
    Connect Status.. Connection Open
    GLOBALS:
    Location......................................... EBSINTEGRATION
    Location ID...................................... 772
    Location Seg..................................... 25
    Category......................................... EBS2
    Category ID...................................... 28
    Period........................................... Jun - 2011
    Period ID........................................ 6/30/2011
    POV Local........................................ False
    Language......................................... 1033
    User Level....................................... 1
    All Partitions................................... True
    Is Auditor....................................... False
    ** Begin FDM Runtime Error Log Entry [2012-01-23 11:37:31] **
    ERROR:
    Code............................................. -2147217865
    Description...................................... Data access error.
    At line: 33
    Procedure........................................ clsImpProcessMgr.fExecuteImpScript
    Component........................................ upsWObjectsDM
    Version.......................................... 1112
    Thread........................................... 4424
    IDENTIFICATION:
    User............................................. ibisons
    Computer Name.................................... HOU-HYSDEV02
    App Name......................................... SWNFDMRC
    Client App....................................... WebClient
    CONNECTION:
    Provider......................................... ORAOLEDB.ORACLE
    Data Server......................................
    Database Name.................................... FDMDEV
    Trusted Connect.................................. False
    Connect Status.. Connection Open
    GLOBALS:
    Location......................................... EBSINTEGRATION
    Location ID...................................... 772
    Location Seg..................................... 25
    Category......................................... EBS2
    Category ID...................................... 28
    Period........................................... Jun - 2011
    Period ID........................................ 6/30/2011
    POV Local........................................ False
    Language......................................... 1033
    User Level....................................... 1
    All Partitions................................... True
    Is Auditor....................................... False
    ** Begin FDM Runtime Error Log Entry [2012-01-23 11:37:31] **
    ERROR:
    Code............................................. -2147217865
    Description...................................... Data access error.
    At line: 33
    Procedure........................................ clsImpProcessMgr.fLoadAndProcessFile
    Component........................................ upsWObjectsDM
    Version.......................................... 1112
    Thread........................................... 4424
    IDENTIFICATION:
    User............................................. ibisons
    Computer Name.................................... HOU-HYSDEV02
    App Name......................................... SWNFDMRC
    Client App....................................... WebClient
    CONNECTION:
    Provider......................................... ORAOLEDB.ORACLE
    Data Server......................................
    Database Name.................................... FDMDEV
    Trusted Connect.................................. False
    Connect Status.. Connection Open
    GLOBALS:
    Location......................................... EBSINTEGRATION
    Location ID...................................... 772
    Location Seg..................................... 25
    Category......................................... EBS2
    Category ID...................................... 28
    Period........................................... Jun - 2011
    Period ID........................................ 6/30/2011
    POV Local........................................ False
    Language......................................... 1033
    User Level....................................... 1
    All Partitions................................... True
    Is Auditor....................................... False
    I really think the issue is that I am not telling the script where to find the Oracle tables at. I left the code in where we were using the UDL to call in the opening of the record set, but since we are doing away with the record set how do I let FDM know where to find the Oracle tables?
    Thanks in advance - I've been wrestling with this for several days.
    Thanks you,
    Sarah

    Here's a script with INSERT INTO that works fine if FDM back-end is SQL DB and it's pulling from FDMHarris data warehouse which is on SQL Server.
    Problem is when FDM back-end is Oracle DB and it's pulling from FDMHarris data warehouse which is on SQL Server.
    I'm assuming the INSERT INTO statement needs to be written differently, syntax wise?
    Here's the error message displayed.
    ** Begin FDM Runtime Error Log Entry [2012-06-03 21:18:15] **
    ERROR:
    Code............................................. -2147217900
    Description...................................... ORA-00933: SQL command not properly ended
    INSERT INTO tWadmin476032843931 (PartitionKey, CatKey, PeriodKey, DataView, CalcAcctType, Entity, Account, UD1, UD2, UD4, Amount) SELECT 752, 12, N'30-Apr-2012', N'YTD', 9, Entity, Account, UD1, UD2, UD4, Amount FROM FDMHarris.dbo.tdataseg4;
    Procedure........................................ clsDataManipulation.fExecuteDML
    Component........................................ upsWDataWindowDM
    Version.......................................... 1112
    Thread........................................... 3284
    Function INSERTINTO(strLoc, lngCatKey, dblPerKey, strWorkTableName)
    'Oracle Hyperion FDM IMPORT Integration Script:
    'Created By:      admin
    'Date Created:      2012-06-03 11:31:39
    'Purpose:
    Dim objSS 'ADODB.Connection
    Dim strSQL 'SQL String
    Dim rs 'Recordset
    Dim rsAppend 'tTB table append rs Object
    Dim strPeriod
    Dim strYear
    'Period
    'strPeriod=MonthName(Month(RES.PdtePerKey))
    a=CStr(FormatDateTime(RES.PdtePerKey,1))
    'Tuesday,January 30, 2012
    b=Right(a,(Len(a)-Len(DW.Utilities.fParseString(a,1,1,",")))) '7
    c=DW.Utilities.fParseString(b,2,2,",")
    strPeriod=Left(c,3)
    'Year
    'strYear=Year(RES.PdtePerKey)
    strYear=Right(b,4)
    DW.DBTools.mLogError 1, CStr(strPeriod), CStr(strYear), Nothing
    'Initialize objects
    Set cnSS = CreateObject("ADODB.Connection")
    'Connect To SQL Server database
    cnss.open "Provider=SQLOLEDB.1;Password=datafusion;Persist Security Info=True;User ID=sa;Initial Catalog=FDMHarris;Data Source=dfv11122"
    'DW.DBTools.mLogError 1, CStr(strSQL), CStr(strSQL), Nothing
    'Initialize common SQL statement
    strSQL = "INSERT INTO " & _
    strWorkTableName & " " & _
    "(PartitionKey, CatKey, PeriodKey, DataView, CalcAcctType, Entity, Account, UD1, UD2, UD4, Amount) " & _
    "SELECT " & RES.PlngLocKey & ", " & RES.PlngCatKey & ", " & _
    "'" & Day(RES.PdtePerKey) & "-" & MonthName(Month(RES.PdtePerKey), True) & "-" & Year(RES.PdtePerKey) & "', " & _
    "'YTD', 9, Entity, Account, UD1, UD2, UD4, Amount " & _
    "FROM FDMHarris.dbo.tdataseg4;" '& _
    ' "WHERE Month = '" & strPeriod & "' And CalYear = '" & strYear & "'"
    DW.DBTools.mLogError 1, CStr(strSQL), CStr(strWorkTableName), Nothing
    DW.DataManipulation.fExecuteDML(strSQL)
    'cnss.Execute strSQL
    'Records loaded
    RES.PlngActionType = 6
    RES.PstrActionValue = "SQL Import successful!"
    'Assign Return value
    INSERTINTO = True
    cnss.Close
    Set cnss = Nothing
    End Function
    Edited by: user12152138 on Jun 3, 2012 6:43 PM

  • How do I insert multiple rows from a single form ...

    How do I insert multiple rows from a single form?
    This form is organised by a table. (just as in an excel format)
    I have 20 items on a form each row item has five field
    +++++++++++ FORM AREA+++++++++++++++++++++++++++++++++++++++++++++++++++++
    +Product| qty In | Qty Out | Balance | Date +
    +------------------------------------------------------------------------+
    +Item1 | textbox1 | textbox2 | textbox3 | date +
    + |value = $qty_in1|value= &qty_out1|value=$balance1|value=$date1 +
    +------------------------------------------------------------------------+
    +Item 2 | textbox1 | textbox2 | textbox4 | date +
    + |value = $qty_in2|value= $qty_out1|value=$balance2|value=$date2 +
    +------------------------------------------------------------------------+
    + Item3 | textbox1 | textbox2 | textbox3 | date +
    +------------------------------------------------------------------------+
    + contd | | | +
    +------------------------------------------------------------------------+
    + item20| | | | +
    +------------------------------------------------------------------------+
    + + + SUBMIT + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Database Structure
    +++++++++++++++++
    + Stock_tabe +
    +---------------+
    + refid +
    +---------------+
    + item +
    +---------------+
    + Qty In +
    +---------------+
    + Qty Out +
    +---------------+
    + Balance +
    +---------------+
    + Date +
    +++++++++++++++++
    Let's say for example user have to the use the form to enter all 10 items or few like 5 on their stock form into 4 different textbox field each lines of your form, however these items go into a "Stock_table" under Single insert transaction query when submit button is pressed.
    Please anyone help me out, on how to get this concept started.

    Hello,
    I have a way to do this, but it would take some hand coding on your part. If you feel comfortable hand writing php code and doing manual database calls, specificaly database INSERT calls you should be fine.
    Create a custom form using the ADDT Custom Form Wizard that has all the rows and fields you need. This may take a bit if you are adding the ability for up to 20 rows, as per your diagram of the form area. The nice thing about using ADDT to create the form is that you can setup the form validation at the same time. Leave the last step in the Custom Form Wizard blank. You can add a custom database call here, but I would leave it blank.
    Next, under ADDT's Forms Server Behaviors, select Custom Trigger. At the Basic tab, you enter your custom php code that will be executed. Here you are going to want to put your code that will check if a value has been entered in the form and then do a database INSERT operation on the Stock_table with that row. The advanced tab lets you set the order of operations and the name of the Custom Trigger. By default, it is set to AFTER. This means that the Custom Trigger will get executed AFTER the form data is processed by the Custom Form Transaction.
    I usually just enter TEST into the "Basic" tab of the Custom Trigger. Then set my order of operations in the "Advanced" tab and close the Custom Trigger. Then I go to the code view for that page in Dreamweaver and find the Custom Trigger function and edit the code manually. It's much easier this way because the Custom Trigger wizard does not show you formatting on the code, and you don't have to keep opening the Wizard to edit and test your code.
    Your going to have to have the Custom Trigger fuction do a test on the submitted form data. If data is present, then INSERT into database. Here's a basic example of what you need to do:
    In your code view, the Custom Trigger will look something like this:
    function Trigger_Custom(&$tNG) {
    if($tNG->getColumnValue("Item_1")) {
    $item1 = $tNG->getColumnValue("Item_1");
    $textbox1_1 = $tNG->getColumnValue("Textbox_1");
    $textbox1_2 = $tNG->getColumnValue("Textbox_2");
    $textbox1_3 = $tNG->getColumnValue("Textbox_3");
    $date1 = $tNG->getColumnValue("Textbox_3");
    $queryAdd = "INSERT INTO Stock_table
    (item, Qty_In, Qty_Out, Balance, Date) VALUES($item1, $textbox1_1, $textbox1_2, $textbox1_3, $date1)"
    $result = mysql_query($queryAdd) or die(mysql_error());
    This code checks to see if the form input field named Item_1 is set. If so, then get the rest of the values for the first item and insert them into the database. You would need to do this for each row in your form. So the if you let the customer add 20 rows, you would need to check 20 times to see if the data is there or write the code so that it stops once it encounters an empty Item field. To exit a Custom Trigger, you can return NULL; and it will jump out of the function. You can also throw custom error message out of triggers, but this post is already way to long to get into that.
    $tNG->getColumnValue("Item_1") is used to retrieve the value that was set by the form input field named Item_1. This field is named by the Custom Form Wizard when you create your form. You can see what all the input filed names are by looking in the code view for something like:
    // Add columns
    $customTransaction->addColumn("Item_1", "STRING_TYPE", "POST", "Item_1");
    There will be one for each field you created with the Custom Form Wizard.
    Unfortunately, I don't have an easy way to do what you need. Maybe there is a way, but since none of the experts have responded, I thought I would point you in a direction. You should read all you can about Custom Triggers in the ADDT documentation/help pdf to give you more detailed information about how Custom Triggers work.
    Hope this helps.
    Shane

  • Commit for every 1000 records in  Insert into select statment

    Hi I've the following INSERT into SELECT statement .
    The SELECT statement (which has joins ) has around 6 crores fo data . I need to insert that data into another table.
    Please suggest me the best way to do that .
    I'm using the INSERT into SELECT statement , but i want to use commit statement for every 1000 records .
    How can i achieve this ..
    insert into emp_dept_master
    select e.ename ,d.dname ,e.empno ,e.empno ,e.sal
       from emp e , dept d
      where e.deptno = d.deptno       ------ how to use commit for every 1000 records .Thanks

    Smile wrote:
    Hi I've the following INSERT into SELECT statement .
    The SELECT statement (which has joins ) has around 6 crores fo data . I need to insert that data into another table.Does the another table already have records or its empty?
    If its empty then you can drop it and create it as
    create your_another_table
    as
    <your select statement that return 60000000 records>
    Please suggest me the best way to do that .
    I'm using the INSERT into SELECT statement , but i want to use commit statement for every 1000 records .That is not the best way. Frequent commit may lead to ORA-1555 error
    [url http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:275215756923]A nice artical from ASKTOM on this one
    How can i achieve this ..
    insert into emp_dept_master
    select e.ename ,d.dname ,e.empno ,e.empno ,e.sal
    from emp e , dept d
    where e.deptno = d.deptno       ------ how to use commit for every 1000 records .
    It depends on the reason behind you wanting to split your transaction into small chunks. Most of the time there is no good reason for that.
    If you are tying to imporve performance by doing so then you are wrong it will only degrade the performance.
    To improve the performance you can use APPEND hint in insert, you can try PARALLEL DML and If you are in 11g and above you can use [url http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_parallel_ex.htm#CHDIJACH]DBMS_PARALLEL_EXECUTE to break your insert into chunks and run it in parallel.
    So if you can tell the actual objective we could offer some help.

  • Urgent : Performance Issue DELETE , INSERT INTO SELECT, UPDATE

    Hi,
    NEED ASSISTANCE TO OPTIMIZE THE INSERT STATEMENT (insert into select):
    =================================================
    We have a report.
    As per current design following steps are used to populate the custom table whcih is used for reporting purpose:
    1) DELETE all the recods from the custom table XXX_TEMP_REP.
    2) INSERT records in custom table XXX_TEMP_REP (Assume all the records related to type A)
    using
    INSERT..... INTO..... SELECT.....
    statement.
    3) Update records in XXX_TEMP_REP
    using some custom logic for the records populated .
    4) INSERT records in custom table XXX_TEMP_REP (Records related to type B)
    using
    INSERT..... INTO..... SELECT.....
    statement.
    Stats gathered related to Insert statement are:
    Event Wait Information
    SID 460 is waiting on event : db file sequential read
    P1 Text : file#
    P1 Value : 20
    P2 Text : block#
    P2 Value : 435039
    P3 Text : blocks
    P3 Value : 1
    Session Statistics
    redo size : 293.84 M
    parse count (hard) : 34
    parse count (total) : 1217
    user commits : 3
    Transaction and Rollback Information
    Rollback Used : 35.1796875 M
    Rollback Records : 355886
    Rollback Segment Number : 12
    Rollback Segment Name : _SYSSMU12$
    Logical IOs : 1627182
    Physical IOs : 136409
    RBS Startng Extent ID : 14
    Transaction Start Time : 09/29/10 04:22:11
    Transaction_Status : ACTIVE
    Please suggest how this can be optimized.
    Regards,
    Narender

    Hello,
    Is there any relation with the Oracle Forms tool ?
    Francois

  • Mechanism of a insert into select

    Hi
    I am using a insert with select in a batch program which is supposed to run just a little before midnight.
    My question is, when a insert into a table occurs, does oracle select all the rows before the insert starts, OR, does the insert occur simultaneously with the select.
    eg. table B has 4 rows
    data is being inserted into A from B
    does oracle select row1 from B and insert row1 into table A and then move to row2 in B and insert row2 into A
    OR
    does oracle select rows1 thro 4 in B before the first insert into A starts?
    If anybody could point me to a document/reference about that would be aweosme.
    --vj                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    There is no need to know this kind of internals. A statement is atomic, so it either completes in total or not at all. Other sessions cannot see intermediate results, even your own session is not able to. If you would try, for example by using database triggers, you'll get a mutating table error to prevent that.
    Regards,
    Rob.

  • How to use offset for select-option parameter ?

    Hi experts
    could anybody please let me know how to use offset for select-option parameter. i can able to use offset for table fields, variabiles and all , but don't know how to use for parameters.
    following is my code
    SELECT-OPTIONS: s_prctr  FOR vbsegs-prctr OBLIGATORY.
    here "prctr"  length is 10.
    i'm using two tables  1. vbsegd-bupla
                                    2. vbsegs-prctr
    here prctr+6(4) = bupla.
    "Bupla" length is 4
    SELECT belnr gjahr bukrs bupla sgtxt buzei FROM vbsegd INTO CORRESPONDING FIELDS OF TABLE it_vbsegd FOR ALL ENTRIES IN it_vbkpf
                                                                 WHERE belnr = it_vbkpf-belnr
                                                                   AND gjahr = it_vbkpf-gjahr
                                                                   AND bukrs = it_vbkpf-bukrs
                                                                   AND bupla IN s_prctr.  
    the above statement is not working as prctr and bupla lenths are different. here i want to use offset.
    SELECT belnr gjahr bukrs prctr sgtxt buzei FROM vbsegs INTO CORRESPONDING FIELDS OF TABLE it_vbsegs FOR ALL ENTRIES IN it_vbkpf
                                                                WHERE belnr = it_vbkpf-belnr
                                                                  AND gjahr = it_vbkpf-gjahr
                                                                  AND bukrs = it_vbkpf-bukrs
                                                                  AND prctr IN s_prctr.
    this is working as prctr and s_prctr lengths are equal.
    could anybody please help me out in this.
    Thanks in advance.
    regards
    satish

    Below code will work for you.
    SELECT-OPTIONS: s_prctr  FOR vbsegs-prctr OBLIGATORY.
    RANGES: s_bupla FOR vbsegd-bupla.
    s_bupla[] = s_prctr[].
    DELETE ADJACENT DUPLICATES FROM s_bupla.
    SELECT belnr gjahr bukrs bupla sgtxt buzei FROM vbsegd INTO CORRESPONDING FIELDS OF TABLE it_vbsegd FOR ALL ENTRIES IN it_vbkpf
                                                                  WHERE belnr = it_vbkpf-belnr
                                                                    AND gjahr = it_vbkpf-gjahr
                                                                    AND bukrs = it_vbkpf-bukrs
                                                                    AND bupla IN s_bupla.

  • Inserting multiple selection from checkbox in to one column of the database

    Hi,
    how to insert multiple selection from checkbox into one column of the database.(I select array of values from checkbox ,then how to insert tat array of values iinto single column name).
    Anyone can u reply me
    Thanx

    hhhmmm.... is this what you mean?
    lets say you hava a checkbox1 with values value1, value2, value3 and you selected all there of them? then you want then to be stored in the database in one column?
    now the question is:
    Is it going to be one column one row?
    datafield
    value1,value2,value3
    Or one column multiple row?
    datafield
    value1
    value2
    value3
    Which is it?

  • How do I import into Imovie from a cd.

    How do I import into IMovie from a cd?  
    I am trying to upload a movie from a cd but when I go into import movies no file shows up but yet I can view the movie in IDVD.  

    Remove the checkmarks for the songs you do not want.
    To prevent songs from importing, click "no" after you insert the CD.
    When the list of songs appears in the iTunes window, click to remove the checkmark next to any songs you don’t want to import.
    To add the selected songs to your library, click Import CD near the top right of the iTunes window.

Maybe you are looking for

  • Problems with photo merge

    Everytime I click "done" after i have created a photomerge, elements "unexpectadly has closed."  I have to re-open elements and the photo i had just created is gone. It has now happened atleast 10 times. Basically every time i use photomerge. any sug

  • Creating a changing level to load to

    Hey everyone, I am creating a navigation system that is comprised of multiple swf's, and I am trying to create a transition. My goal is to have the currently loaded swf play an outro while the new swf plays it's intro. My idea was to do this by rotat

  • Cannot activate my viber after i update to 6.1.3 iphone 3gs..can u please help me...the the code is ok but if i activate...its being error.

    cannot activate my viber after i update to 6.1.3 iphone 3gs..can u please help me...the the code is ok but if i activate...its being error.

  • Missing Image Dreamweaver CS5

    Why does one of the logo images, in the top left corner, disapear when view in Live view and on the internet, but is present in design view and other pages. The page in  question is www.susanpidcock/Geology Collection/formations.html   This pages use

  • Z BDC Field in the script

    Hello Gurus, We are working on Interactive script in the SAP CRM 7.0 and we are having a problem when a variable that comes from a non-standard BOL object is include in the script. This BOL is not used in any view and it is just used to show addition