Drop, create and insert data into few intermediate tables

Hi All,
I need to schedule a process to drop, create and insert data into few intermediate tables on a weekly basis. Here is what i need to do in the stored procedure, which can be scheduled weekly.
DROP TABLE TABLE_NAME1;
DROP TABLE TABLE_NAME2;
DROP TABLE TABLE_NAME3;
CREATE TABLE TABLE_NAME1
CREATE TABLE TABLE_NAME2
CREATE TABLE TABLE_NAME3
INSERT INTO TABLE_NAME1 SELECT ....;
INSERT INTO TABLE_NAME2 SELECT ....;
INSERT INTO TABLE_NAME3 SELECT ....;
Any suggestions, examples or code on how to accomplish this task would be very helpful. Any question pls let me know.
Thanks in advance.

I am using the intermediate tables in an extract process. The idea was that the table would be created prior to calling the extract procedure and once the data written to the intermediate table had been processed the table would be dropped. This would be repeated each time the extract process is run. From a DBA's point or view, would it be better to just leave the table on the database and truncate it after each run or is removing it entirely best?

Similar Messages

  • How to read a CSV file and Insert data into an Oracle Table

    Hi All,
    I have a Clob file as a in parameter in my PROC. . File is comma separated.need procedure that would parse this CLOB variable and populate in oracle table .
    Please let me some suggestions on this.
    Thanks,
    Chandra R

    jeneesh wrote:
    And, please don't "hijack" 5 year old thread..Better start a new one..I've just split it off to a thread of it's own. ;)
    @OP,
    I have a Clob file as a in parameter in my PROC. . File is comma separated.need procedure that would parse this CLOB variable and populate in oracle table .You don't have a "clob file" as there's no such thing. CLOB is a datatype for storing large character based objects. A file is something on the operating system's filesystem.
    So, why have you stored comma seperated data in a CLOB?
    Where did this data come from? If it came from a file, why didn't you use SQL*Loader or, even better, External Tables to read and parse the data into structured format when populating the database with it?
    If you really do have to parse a CLOB of data to pull out the comma seperated values, then you're going to have to write something yourself to do that, reading "lines" by looking for the newline character(s), and then breaking up the "lines" into the component data by looking for commas within it, using normal string functions such as INSTR and SUBSTR or, if necessary, REGEXP_INSTR and REGEXP_SUBSTR. If you have string data that contains commas but uses double quotes around the string, then you'll also have the added complexity of ignoring commas within such string data.
    Like I say... it's much easier with SQL*Loader of External Tables as these are designed to parse such CSV type data.

  • Please recommend if we have options to read xml file and insert data into table without a temporary table.

    Please recommend if we have options to read xml file and insert data into table without a temporary table. 

    DECLARE @data XML;
    SET @data =N'<Root>
    <List RecordID="946236" />
    <List RecordID="946237" />
    <List RecordID="946238" />
    <List RecordID="946239" />
    <List RecordID="946240" />
    </Root>'
    INSERT INTO t (id) SELECT T.customer.value('@RecordID', 'INT') AS id
    FROM @data.nodes('Root/List')
     AS T(customer);
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Insert data into msql thru table trigger

    Hi,
    I installed dg4msql 11.2 and I would like to insert some data into our msql thru one of our Oracle table after insert table,
    I used the syntax below
    insert into test@dg4msql ("PN") values (:new.PN)
    but the below error problem if I insert data into my Oracle table,
    ORA-02054: transaction 4.17.15898 in-doubt
    ORA-028500, connect from ORACLE to a non-Oracle system returned this message
    [Oracle][ODBC SQL Server Driver][SQL Server] Invalid object name "RECOVER.HS_TRANSACTION_LOG
    Do I have to create the HS_TRANSACTION_LOG table in my msql server to resolve this problem?
    Thanks
    Vincent

    Vincent,
    If the gateway insert is being done as part of a trigger then it will almost certainly be part of a distributed transaction so yes, you will have to create the transaction log table and the recovery user in the SQL*Server database.
    As well as the gateway documentation have a look at this note in My Oracle Support -
    Note.227011.1 How to Setup DG4MSQL to Use Distributed Transactions          (Doc ID 227011.1)
    Regards,
    Mike

  • How to insert data into the mysql table by giving as a text file

    Hi,
    Any one know's how to insert data into the mysql table by giving as a text file as the input in JSP.Please respond ASAP.
    Thanks:)

    At least you can try StringTokenizer to parse your text files. Or download a text JDBC driver to parse your files, for instance, HXTT Text(www.hxtt.net) or StelsCSV(www.csv-jdbc.com).

  • Header data and item data into same internal table

    Hi Experts,
    I WANT TO KNOW THE LOGIC TO POPULATE HEADER DATA AND ITEM DATA INTO SAME INTERNAL TABLE AND AGAIN DOWNLOAD THE SAME TO EXCEL FILE .Output file should be displayed like this format
    Header1  rectyp ,hdnum ,sbank ,bankl ,accnr , paytp , crda ,iso.
    Item1  : rectyp ,valut ,cknum ,amount,bankl,accnr,pdate,bnktc.
    Item2  : rectyp ,valut ,cknum ,amount,bankl,accnr,pdate,bnktc.
    Header2: rectyp ,hdnum ,sbank ,bankl ,accnr , paytp , crda ,iso.
    Item1  : rectyp ,valut ,cknum ,amount,bankl,accnr,pdate,bnktc.
    Thanks
    Moderator message: Please do not use all upper case in the future.
    Edited by: Thomas Zloch on May 12, 2010 3:10 PM

    Hi,
    for example we have 3 internal tables 
    1> it_header  2>it_items   3>it_final (which contains all the header and item fields)
    once  it_header   it_items  are filled
    loop at it_items.
    read table it_header with key xyz = it_item-xyz.
    if sy-subrc = 0.
      here move all the header fields to it_final like below.
    it_final -xfield  = it_header-xfield.
    endif.
      here move all the item fields to it_final like below.
    it_final -yfield  = it_item-yfield.
    append it_final.
    clear it_final.
    endloop.
    now header and item fileds will be fillled in it_item

  • Insert data into a database table from a string

    Hi,
    I am need to insert data into a table from  the text file. I pull the data into an internal table using GUI_UPLoad. I read the data into an internal table and concatenate data into a string. I need to do this because the structure of the table is dynamic. it is used to upload a series of tables each with different structure, But the data is stored in the string v_tabledata.  How to do that.
    after uploading the data  from the textt file into a table
    oop at i_final.
       v_tabname = i_final-table_name.
      concatenate i_final-table_rec1 i_final-table_rec2 i_final-table_rec3
                  i_final-table_rec4 i_final-table_rec5 into v_tabledata.
    from  'v_table data'  i need to upload the data into a table and the structue of the table is known dynamically. Any thoughts using field symbols?
    Thanks,
    VG

    Let me see if I've understood your issue
    You have a file to be uploaded into an internal table but this file has many different layouts and then you don't know how to link these fields with the internal table...is it your issue?
    Then you've read the internal table, you've sent it to a string divided by space or something else and then are you trying to read this string to send it to a table?
    We could read the standard tables which maintain the program names, table names etc... (DD* tables, as the DD03L table) and then create some rules...
    We could create a parameter table to read your file/table dynamically...
    Please, try to rewrite in other words your problem...because there are a lot of ways to achieve your issue...
    Alexandre Mendes

  • How  to  insert data into custom database table from an hcsf

    i want to insert data into database table that i have created from an hcsf.
    example :
    say i have created a table in oracle database and i hav created a hcsf file.now i want that when somebody fills in that hcsf and click submit ,i want that entries should be updated in my database table.
    plzzz reply ASAP(it's urgent)

    you'll need a bit of Java code... extract the data during a check-in filter, and insert it into the database.
    check out the "DataAccess" component in the HowToComponents for query-running examples, and the "DynamicPrefix" component for a check-in filter example.
    I have older copies here:
    http://bezzotech.com/library

  • Urgent help needed in inserting data into a custom table in oracle WorkFlow

    Hi
    I am trying to get data from the WF and insert into a custom table..
    I read that workflow procedures WONT allow commits...
    Oracle Workflow will not support autonomous commits in any procedure it calls directly. If you need to perform commits, then embed your SQL in a subprocedure and declare it as an autonomous block. This subprocedure must be capable of being rerun. Additionally, note that Oracle Workflow handles errors by rolling back the entire procedure and setting its status to ERROR. Database updates performed by autonomous commits cannot be rolled back, so you will need to write your own compensatory logic for error handling
    Have anyone did this..
    Please give me some idea ...It is urgent
    I am getting data using getitemattribute..and try to insert it into a custom table
    thanks
    kp

    Pl do not post duplicate threads - insert dont work in Workflow
    Srini

  • Insert data into two related tables in one transaction

    Hi all,
    I’ve got problem with developing functionality.
    Background:
    I’ve got two tables: OFFER_HEADER and OFFER_CONTENT
    For now, user has to insert and commit the OFFER_HEADER(single-row view), then content becomes reachable and OFFER_CONTENT(multi-row view) can be filled. It is being done by choosing record from PRODUCTS form and inserting values into OFFER_CONTENT. Product data can be modified on the CONTENT form canvas.
    My goal:
    I know that is not convenient way to implement the functionality. I want to insert all the data(header and content) in one transaction. What is the best way to do it?
    Thanks in advance,
    Best Regards,
    Bartek

    1. User is on the OFFER_CONTENT canvasOk
    2. User presses ‘+’ buttonOk
    3. On the screen is displayer PRODUCT list
    4. User set focus on desired product
    5. Using popup menu user choose ‘Add’ option
    6. PRODUCT list is being closedSo, the functionlatity is like a LoV?
    7. OFFER_CONTENT is being shown with set of information from the productOk, you would either take the values directly from the fields of the PRODUCT-list and copy them into the OFFER_CONTENT-fields, or you just get something like the PRODUCT-ID from your PRODUCT-list and use a SELECT to read the product-details into the OFFER_CONTENT-block
    8. User can then manually change desired elements of the recordOk.
    So, where do you have the need to do an INSERT in your scenario?

  • DB Adapters inserting data into 2 diff tables of same database giving issue

    Hello,
    I am using Oracle soa suite 11g BPEL.
    I need to insert data in 4 different tables of same Oracle database with the requirement of rollback all data if error occurs anywhere.
    I have configured the DB adapater as XA enabled on console .
    In code:-
    I am using 2 DBAdapters to insert data one by one in 2 diff tables of same DB (using INSERT ONLY operations). Before each invoke activity i am using a transformation activity to prepare the input variable of the DBAdapter.
    When i run this code i get below error:-
    Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'insert' failed due to: DBWriteInteractionSpec Execute Failed Exception. insert failed. Descriptor name: [DBINS_DIANA.XxontPoiHdrsIface]. Caused by java.sql.BatchUpdateException: ORA-02049: timeout: distributed transaction waiting for lock . ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution. </summary>
    If i use a wait activity between the 2 invokes i get the data inserted fine , but that means the transactions between inserts would be committed which i want to be rollback fully in case of any errors.
    Can anyone have a clue what is wrong here?
    Thanks
    Shivani

    Hi Anagha,
    Have a look at these links:
    /people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30
    http://help.sap.com/saphelp_nw04/helpdata/en/b0/676b3c255b1475e10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/2b/d5653fd1d3b81ae10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/95/bb623c6369f454e10000000a114084/frameset.htm
    Regards,
    Chandra

  • DB Adaptor and inserting dates into Oracle DB

    Hi,
    I'm using the Oracle DB Adaptor to poll a table in one instance (using logical delete) and to invoke a DB adaptor to insert/merge a row into a separate instance.
    NOTE :both tables have different definitions.
    I am using a BPEL transform to tfrm the data received from the poll/receive step.
    I need to transform some date variables and the target date column CreatedTs is expecting to receive the date in the Oracle DD-MON-YYYY format (can't change the NLS_DATE_FORMAT value for the target).
    I'm trying to use the provided xsl:formatDateTime function with various formats but can't get anything useful to work.
    Any ideas ?

    Hi there,
    Please see the Bpel developer's guide at otn.oracle.com/bpel. There are two troubleshooting entries of interest:
    dateTime Conversion Exceptions
    and
    Issues with Oracle DATE
    Just search on these strings.
    The xsl:formatDateTime function is for converting xs:dateTimes to strings. If you already have a value in proper ISO dateTime format do not try to convert it. The database adapter likes that format only.
    If you are starting with a string like DD-MON-YYYY and have to convert it into a legal dateTime, then that is hard as functions like xsl:formatDateTime go the opposite way only, i.e. dateTime to string, not string to dateTime.
    A few days we had a customer who needed to convert MM/DD/YYYY to a dateTime. I am copying the solution here.
    Used the expression builder in the assign to build:
    orcl:format-string('{0}-{1}-{2}T00:00:00', substring(bpws:getVariableData('Receive_1_receive_InputVariable','ReceiverDeptCollection','/ns2:ReceiverDeptCollection/ReceiverDept/receiverEmpCollection/ReceiverEmp/someDate'), 7, 4), substring(bpws:getVariableData('Receive_1_receive_InputVariable','ReceiverDeptCollection','/ns2:ReceiverDeptCollection/ReceiverDept/receiverEmpCollection/ReceiverEmp/someDate'), 4, 2), substring(bpws:getVariableData('Receive_1_receive_InputVariable','ReceiverDeptCollection','/ns2:ReceiverDeptCollection/ReceiverDept/receiverEmpCollection/ReceiverEmp/someDate'), 1, 2))
    That worked in converting i.e. 01/05/2005 to 2005-01-05T00:00:00.
    To convert DD-MON-YYYY that is tricky because you need to first convert DEC to 12, SEP to 09, and so on. I couldn't figure out how to do that but another on this forum may be able to help you out. If you are really stuck and you know the database accepts i.e DD-MON-YYYY, you could tell the adapter that the date field is a string, then it will simply pass the value as is which should work.
    To do that please see chapter 20 of the bpel dev guide, and search for
    Configuring Offline Database Tables
    Use that to change the type to basic varchar2 in the BPEL designer so the dbadapter will think the column is a string and not convert it.
    Thanks
    Steve

  • Dequeue XML from Oracle AQ and insert data into table

    Using PL/SQL in a stored procedure, I need to dequeue a message from an Oracle AQ queue, parse the XML content and insert the data in an Oracle table. This is being done in Oracle 9.2.x.
    The payload for the message consists of 2 attributes, APPLICATION_DATA (VARCHAR2(32) and MESSAGE_BODY (CLOB). The MESSAGE_BODY is an XML document. A sample of the message is shown below:
    (M_NAME=MSG_LAW_WR_CRE_UPD, <?xml version = "1.0"?>
    <MSG_LAW_WR_CRE_UPD ID = "WMIS-4744" SRC_SYSTEM_CODE = "WMIS" SRC_SYSTEM_INSTANCE = "WMIS">
    <WR:CMP_LAW_WR_CRE_UPD xmlns:WR = "WR" >
    <WR:DATETIME>12/19/2005</WR:DATETIME>
    <WR:RUSCODE>100</WR:RUSCODE>
    <WR:WRNO>38213</WR:WRNO>
    </WR:CMP_LAW_WR_CRE_UPD>
    </MSG_LAW_WR_CRE_UPD>)
    This message needs to be dequeued from a queue named INBOUND, parsed and inserted into a table named INFO_TO_ACCT (CREATEDATE date, RUSCODE varchar2(10), WRNO number).
    Any help would be appreciated.

    SELECT EXTRACTVALUE(xmltype('<?xml version = "1.0"?>
    <MSG_LAW_WR_CRE_UPD ID = "WMIS-4744" SRC_SYSTEM_CODE = "WMIS" SRC_SYSTEM_INSTANCE = "WMIS">
    <CMP_LAW_WR_CRE_UPD>
    <DATETIME>12/19/2005</DATETIME>
    <RUSCODE>100</RUSCODE>
    <WRNO>38213</WRNO>
    </CMP_LAW_WR_CRE_UPD>
    </MSG_LAW_WR_CRE_UPD>'),'//DATETIME/text()') FROM DUAL;
    hope this helps.

  • Error in reading XML message and inserting data into another DB using DB link

    Hi Experts,
    I am getting error parsed XML message data while  inserting into another DB table using DB link.
    ORA-22804: remote operations not permitted on object tables or user-defined type columns.
    Please help me.
    Thanks.

    ORA-22804: remote operations not permitted on object tables or user-defined type columns.
    Looking at the error message assuming you might be doing the alter table statement on remote table unit_labels which is throwing the ORA-22804 error which is not permitted on remote tables.

  • Insert data into an OR Table

    Can I please have some help to insert some data into a table.
    I have created an Peripheral_objtyp object and then created a table from this object:
    create type Peripheral_objtyp as Object (
    PeriphNo NUMBER,
    Comp_ref REF Computer_objtyp,
    PeriphName varchar2(20),
    PeriphType varchar2(20)
    create table Peripheral_objtab of Peripheral_objtyp (PeriphNo Primary Key) Object ID Primary Key
    Here is the Computer_objtyp:
    create type Computer_objtyp as object (
    CompNo Number,
    CompName      Varchar2(20),
    CompOS          Varchar2(20),
    CompProcessor     Varchar2(20),
    CompRAM          Varchar2(20),
    CurrentUser_obj CurrentUser_objtyp,
    HardDriveList_var HardDriveList_Vartyp )
    I am wanting to insert some data into the Peripheral_objtab. This is the code I have tried:
    INSERT INTO Peripheral_objtab
    SELECT 1, REF(C), 'Test', 'Test'
    FROM Computer_objtab C
    Where C.CompNo = 1;
    I am getting this error:
    SQL Error: ORA-22979: cannot INSERT object view REF or user-defined REF
    22979. 00000 - "cannot INSERT object view REF or user-defined REF"
    *Cause:    Attempt to insert an object view REF or user-defined REF in a
    REF column created to store system generated REF values"
    *Action: Make sure the REF to be inserted is not from an object view
    or from a user-defined REF column

    Difficult to know what is causing the issue without a complete test case (with sample data).
    Is Computer_objtab's object identifier the primary key as well ?
    Maybe the Comp_ref column has to be scoped, but that's just a guess at this point.
    BTW, you should have posted your question in the {forum:id=68} forum.

Maybe you are looking for

  • AnyConnect SSL VPN Vista split-tunneling

    I recently setup an ASA5510 with 8.0fw with the AnyConnect SSL VPN Client. Connecting to the SSL VPN works perfectly from all the XP computers that I have tested from. No problems there. However when on Vista, split-tunneling does not seem to functio

  • Not able to edit assets in Illustrator/Photoshop and save over existing assets in Edge animation

    Not able to edit assets in Illustrator/Photoshop and save over existing assets in Edge animation to update image changes. Has Adobe changed this capability with new releases? Does this mean to update an asset on the Edge animation timeline, you have

  • Dust marks on the 'inside' of display

    I have had my 24" iMac for just under a year. 3 months ago, I noticed strange dust-like marks on the inside of my display. They are definitely on the inside because i tried cleaning the display and they did not go away. This suggests that the iMac is

  • Uninstalling iTunes. iPod 4 'ClickWheel' wont show up. Please HELP!

    Hi everyone. Ok here's my situation. Im using a MacBook Pro (Mac OS X Lion 10.7.5) iTunes 11.4 (64Bit) iPod 4th Gen. (White 20GB 'Click-Wheel') After doing a system restore on my ancient dinosaur ipod 4th gen. (the white 20GB 'Click Wheel') and 'upgr

  • Ghost files in windows exports

    When I export files from iWork, OmniGraffle etc "ghost" files appear with the exported files. How can I stop this?