Procedure for inserting data

With the following insert script, data is inserted into the flight_instance table:
insert into flight_instance
select flight_no, 1, 1, 'AAL','06:25','CPH','07:10','DH4', 70, 0,'0:45', 148,
TO_DATE('20060101', 'YYYYMMDD')+ day - 1
from days, flight_frequency
where weekday = TO_CHAR(TO_DATE('20060101', 'YYYYMMDD') + day - 1, 'D')
and flight_no = 'LH6001'
and day <= 365;
This must be done for each flight and there are about 800 flights that have to be inserted or updated.
I need a procedure that will insert or update each record. Any ideas?
Thank you!

Hi,
Is it a one time job / frequent job? Its good to use
Anonymous block if it is one time job.
Using cursor FOR LOOP as specified below
FOR loopindex in (select flight 800 flights) LOOP
Do update / Insert using each flight loopindex.flight
END LOOP
If inserted / updated rows are more than 10000, commit for every 10000 rows
I guess it may help you!
Thanks,
Sankar

Similar Messages

  • PL/SQL procedure to insert data doesn't work and unable to find reason.

    Sorry that I couldn't find the best place to post this question. It seems that the forum does not deal with this kind of question. I post here for help.
    I have a stored procedure to insert data into one table. SP was compiled without error and executed without error (from log table to get information). But the data was not inserted into
    the target table. I have tried different way to figure out the reason. But I failed to get any idea. Please help me to find possible reasons. The smple SP looks like this:
    CREATE OR REPLACE PROCEDURE my.sp_insert( P_DATE IN VARCHAR2)
    IS
    declare section
    begin
    insert into target_table (column1, column2, column3, column4)
    select record1, record2, record3, record4 from table1, table2, table3, table4
    where clause;
    commit;
    exception section
    UPDATE PROCESS_LOG_TABLE CLAUSE;
    html_email section;
    rollback;
    end my.sp_insert
    I have tested that "select record1, record2, record3, record4 from table1, table2, table3, table4" really fetch the 7,000 records. and if I only run part of SQL from SQLPLUS as
    insert into target_table (column1, column2, column3, column4)
    select record1, record2, record3, record4 from table1, table2, table3, table4
    where clause;
    It will work and insert 7,000 records into target table. Why did it not insert into target_table when execiting as stored procedure? Please help with your input. Thanks.
    Edited by: citicbj on Feb 12, 2013 4:15 PM

    Dear Friend,
    Is the user from which you created database procedure and sqlplus that you tested the code successfully is same?
    Regards
    Ahamed Rafeeque Cherkala

  • How do I run a database procedure that inserts data into a table from withi

    How do I run a database procedure that inserts data into a table from within a Crystal report?
    I'm using CR 2008 with an Oracle 10i database containing a number of database tables, procedures and packages that provide the data for the reports I'm developing for my department.  However, I'd like to know when a particular report is run and by whom.  To do this I have created a database table called Report_Log and an associated procedure called prc_Insert_Entry that inserts a new line in the table each time it's called.  The procedure has 2 imput parameters (Report_Name & Username), the report name is just text and I'd like the username to be the account name of the person logged onto the PC.  How can I call this procedure from within a report when it's run and provide it with the 2 parameters?  I know the procedure works, I just can't figure out how to call it from with a report.
    I'd be grateful for any help.
    Colin

    Hi Colin, 
    Just so I'm clear about what you want: 
    You have a Stored procedure in your report.  When the report runs, you want that same procedure to write to a table called Report_Log. 
    If this is what you want the simple answer is cannot be done.  Crystal's fundamental prupose is to read only, not write.  That being said, there are ways around this. 
    One way is to have a trigger in your database that updates the Report_Log table when the Stored Procedure is executed.  This would be the most efficient.
    The other way would be to have an application run the report and manage the entry. 
    Good luck,
    Brian

  • Need to create procedure for insert tax line into ra_interface_lines_all

    Dear
    I need to create a procedure for insert a tax line into ra_interface_lines_all against the line type "LINE".
    after inserting the record i will run the auto invoice program to see the changes. kindly share how i can achieve through procedure.
    scenario:-
    after order dispatch workflow back ground run and data populated in ra_interface_lines_all where interface line id is null there i need to insert tax line against multiple orders.
    I know the join. when line type = 'LINE'  then tax line must have link_to_line_id of the line type line. my question is this when order number change how i can insert tax line against the line type line.
    regards,
    Fs
    Message was edited by: 832296

    Dear
    I need to create a procedure for insert a tax line into ra_interface_lines_all against the line type "LINE".
    after inserting the record i will run the auto invoice program to see the changes. kindly share how i can achieve through procedure.
    scenario:-
    after order dispatch workflow back ground run and data populated in ra_interface_lines_all where interface line id is null there i need to insert tax line against multiple orders.
    I know the join. when line type = 'LINE'  then tax line must have link_to_line_id of the line type line. my question is this when order number change how i can insert tax line against the line type line.
    regards,
    Fs
    Message was edited by: 832296

  • Procedure to insert data in multiple rows

    Hi,
    I need a stored procedure which inserts data into multiple rows..
    Ex: I need to have 3 columns in Procedure, where col3 has limit in size let's say 500.
    If user insert about 1500 in col3, i has to insert first 500 in row1 and 501 - 1000 in row 2 and 1001 - 1500 in row 3.
    Can any one help in creating procedure for above scenario.
    Thanks in Advance...
    Sree

    create table #t (id int, id1 int)
    WITH [1-20]
    AS
    SELECT row_number() over (order by number) rn,number
            FROM master..spt_values
             WHERE type = 'P'
             AND number BETWEEN 1 AND 20
     [21-30]
    AS
    SELECT row_number() over (order by number) rn,number
            FROM master..spt_values
             WHERE type = 'P'
             AND number BETWEEN 21 AND 30
    ) INSERT INTO #t 
      SELECT A.number,B.number FROM
         [1-20] A JOIN [21-30] B ON A.rn=B.rn
    SELECT * FROM #t
    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

  • Calling webservice in udf for inserting data into webservice

    Dear Experts,
          Please give me the drawbacks of using lookup function for inserting data. we are calling a webservice from the udf for inserting the data using a webservice.
    It is a file to jdbc usnig a soap lookup . we use this approach because we need to pass the response from webservice along with the error data to the jdbc.   is there any other way to do it without using bpm ?
        In the udf we are creating the xml structure for webservice and passing the parameters through arguments.
    is there a better approach for this ?
    Thanks,
    Aju

    Hi Aju,
    You can do it without BPM.
    Write UDF for Soap Lookup. Parse the response message from Webservice.  and map the required values to respective fields.
    See the weblog
    Webservice Calls From a User Defined Function.
    Negative point of this solution is that it will take some time to call Webservice and get response back from it.
    Kulwinder

  • Procedure for Insert to BULK COLLECT

    hi,
    I have 2 questions-
    1) Say I have below code. I want to call an insert procedure insead of INSERT INTO. If I do would it give any performance issue?
    CREATE OR REPLACE PROCEDURE test_proc (p_array_size IN PLS_INTEGER DEFAULT 100)
    IS
    TYPE ARRAY IS TABLE OF all_objects%ROWTYPE;
    l_data ARRAY;
    CURSOR c IS SELECT * FROM all_objects;
    BEGIN
    OPEN c;
    LOOP
    FETCH c BULK COLLECT INTO l_data LIMIT p_array_size;
    FORALL i IN 1..l_data.COUNT
    INSERT INTO t1 VALUES l_data(i);
    EXIT WHEN c%NOTFOUND;
    END LOOP;
    CLOSE c;
    END test_proc;
    CREATE OR REPLACE PROCEDURE insert_proc ( col1 table.col1%Type,
    col2 table.col2%Type,
    col20 table.col20%Type)
    BEGIN
    INSERT INTO HistoryTable (col1, col2, ...col20)
    VALUES(val1, val2, ...val 20);
    END;
    END;
    2) Is there any clean method to create insert procedure which has 20 columns which I can call in other proc to do bulk insert?

    It is good that you explained your requirements, but you did not give us some data to see with and work with.
    If you could, help us with below details, it might be possible to help you:
    1. Create table statements for your Tables (eg. Checking, Savings and history)
    2. Insert Into statements for Sample data for your Tables.
    3. validations that you need to perform
    4. Expected output based on the Sample data provided in step 2.
    Please do not forget to post your version number
    select * from v$version;Also, use {noformat}{noformat} tags, before and after SQL Statements, Expected Output to preserve spaces and make the post more readable.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to create stored procedure for insert update and delete operations with input output paramters?

    I  have the follwing table is called master table contain the follwing fields,
    So here i need to create  three Stored procedures 
    1.Insert operations(1 o/p paramter,and  14 input paramters)              - uspInsert
    2.Update operations(1 o/p paramter,and  14 input paramters)          - uspUpdate
    3.Delete Operations(1 o/p paramter,and  14 input paramters)          
     - uspdelte
    The following is the table ,so using this to make the three sp's ,Here we will use Exception machanism also.
    Location 
    Client Name
    Owner 
    ConfigItemID
    ConfigItemName
    DeploymentID
    IncidentID
    Package Name
    Scope 
    Stage
    Type 
    Start Date
    End Date
    Accountable 
    Comments
    So can u pls help me out for this ,bcz i knew to stored procedure's creation.

    I  have the follwing table is called master table contain the follwing fields,
    So here i need to create  three Stored procedures 
    1.Insert operations(1 o/p paramter,and  14 input paramters)              - uspInsert
    2.Update operations(1 o/p paramter,and  14 input paramters)          - uspUpdate
    3.Delete Operations(1 o/p paramter,and  14 input paramters)            - uspdelte
    The following is the table ,so using this to make the three sp's ,Here we will use Exception machanism also.
    Location 
    Client Name
    Owner 
    ConfigItemID
    ConfigItemName
    DeploymentID
    IncidentID
    Package Name
    Scope 
    Stage
    Type 
    Start Date
    End Date
    Accountable 
    Comments
    So can u pls help me out for this ,bcz i knew to stored procedure's creation.
    Why you have to pass 14 parameters for DELETE and UPDATE? Do you have any Primary Key?  If you do NOT have primary key in your table then in case you have duplicate information, SQL will update both or delete them together. You need to provide DDL of
    you table. What are the data types of fields?
    Best Wishes, Arbi; Please vote if you find this posting was helpful or Mark it as answered.

  • Procedure for inserting a record in HANA

    Hi All
    I have created a table using .hdbtable definition. I have also created an .xsodata service to fetch the details of the table. The problem is when trying to insert data into the table.
    For this, I created a procedure. But when I tried to activate I am getting an error which says "Invalid column name".
    But the Column name which is provided is correct.
    I am stuck and not able to proceed. Please help.
    Thanks in advance
    Meenakshi

    Hi All
    Instead of using a procedure, I tried to achieve the same using server side js. I created a .xsjs file and tried to connect to DB to insert values. But here also no luck. There is an error popping in the insert statement.
    Here is the screenshot of the problem. Any suggestions ?

  • RFC scenario for inserting data in SAP, help me experts

    hi...
    i have to insert data in SAP database using BAPI_PR_CREATE.
    which adapter i hv to use for RFC(sender/receiver)(syn/Asyn).
    this sceanrio is File1-RFC-File2.
    file1 sends the data to RFC to insert data and file2 should hv to send the autogeneration keyID for PR
    Its very urgent...
    please help me..
    thx in advance
    john

    hi ...
    i did that..
    but..iam gting only 1 msg in monitering...
    evrythn is fine,,,,my scenario shows in MONI black flag...but gting only one msg and the data which i sent to SAP is not storing in SAP..and when i search in SM58 in XI server...i cnt see any messages...
    can u explain me Y..?
    thx for response..
    john

  • Which trigger to use for insert data into db table in Forms

    Hi,
    My form is current having a database block with table reference. When enter data into form field and click on save button. Automatically the record is inserted into database table.
    I want to make this as manual insert. I changed the data block to a non-database. Where should i write the insert statement in order to insert data into table.
    Is it Key-commit trigger at form level?
    Please advise.
    Thanks,
    Yuvaraaj.

    Hi Yuvaraaj.
    Insert should happen when we click on the save which is inbuilt in the form. In this case where should i write the insert statement.Forms in built save commit's the form data where block is based on database not non database.
    @2nd reply
    Ypu are right. The reason i chnaged the database block to non-database is Currently i have a database block with form field canvas which insert only 1 record in to >table when we click on standard save button. The requirement was to add a field called CHANNEL which should have multiple values displayed. (i created this channel >field in a seperate datablock (non database) and used the same canvas.) When we insert data in all fields (single record) and channel we should be able to selected >multiple channel (say A,B and C) when we click on save then 3 records should be inserted in to the table which looping values for each channel. This was the actual >requirement and this is the reason why iam changing the block to non-database block.You are talking about two blocks.. 1. Master block and 2. Details block name channel
    You are inserting one record in master block then insert 3 record name A,B,C for that master record.
    Now you want master record should insert to each A,B,C record. Means
    'how are you' --master record
    and you want
    'A'- 'how are you'
    'B'- 'how are you'
    'C'- 'how are you'OR
    ?Ok. If you want master record save in database and then want to save non-database(channel) data into database USE Post-Insert trigger at block level and do the rest.
    Hope this helps...
    Hamid
    Mark correct/helpful to help others to get right answer(s).*
    Edited by: HamidHelal on Jan 26, 2013 1:20 AM

  • Does Camileo X100 hold setttings for inserting date whilst recording

    Guys first of all keep up the good work on this forum.
    I would like to ask a simple but very important question for me. Does the camera hold setttings for inserting the date whilst filming.
    If not what do you suggets, are there any remedies or updating of firmware.
    Another point are the thm files what are these, ax said in previous post one presumed that they are only thumbnails, is this it.
    Thanks and good day

    Thanks mr X - there
    "Firstly its not a issue but this function is simply not supported" lol just hoping it would solve the issue since for me the date option was very important.... would probably say that I wouldn't buy it again if only I knew about it. thanks for your replies

  • Query for inserting data into table and incrementing the PK.. pls help

    I have one table dd_prohibited_country. prohibit_country_key is the primary key column.
    I have to insert data into dd_prohibited_country based on records already present.
    The scenario I should follow is:
    For Level_id 'EA' and prohibited_level_id 'EA' I should retreive the
    max(prohibit_country_key) and starting from the maximum number again I have to insert them
    into dd_prohibited_country. While inserting I have to increment the prohibit_country_key and
    shall replace the values of level_id and prohibited_level_id.
    (If 'EA' occurs, I have to replace with 'EUR')
    For Instance,
    If there are 15 records in dd_prohibited_country with Level_id 'EA' and prohibited_level_id 'EA', then
    I have to insert these 15 records starting with prohibit_country_key 16 (Afetr 15 I should start inserting with number 16)
    I have written the following query for this:
    insert into dd_prohibited_country
    select     
         a.pkey,
         b.levelid,
         b.ieflag,
         b.plevelid
    from
         (select
              max(prohibit_country_key) pkey
         from
              dd_prohibited_country) a,
         (select
    prohibit_country_key pkey,
              replace(level_id,'EA','EUR') levelid,
              level_id_flg as ieflag,
              replace(prohibited_level_id,'EA','EUR') plevelid
         from
              dd_prohibited_country
         where
              level_id = 'EA' or prohibited_level_id = 'EA') b
    My problem here is, I am always getting a.pkey as 15, because I am not incrementing it.
    I tried incrementing it also, but I am unable to acheive it.
    Can anyone please hepl me in writing this query.
    Thanks in advance
    Regards
    Raghu

    Because you are not incrementing your pkey. Try like this.
    insert
       into dd_prohibited_country
    select a.pkey+b.pkey,
         b.levelid,
         b.ieflag,
         b.plevelid
       from (select     max(prohibit_country_key) pkey
            from dd_prohibited_country) a,
         (select     row_number() over (order by prohibit_country_key)  pkey,
              replace(level_id,'EA','EUR') levelid,
              level_id_flg as ieflag,
              replace(prohibited_level_id,'EA','EUR') plevelid
            from     dd_prohibited_country
           where level_id = 'EA' or prohibited_level_id = 'EA') bNote: If you are in multiple user environment you can get into trouble for incrementing your PKey like this.

  • Stored Procedure for displaying data in Crystal Reports

    Hi I am new to Oracle & Crystal Reports,so can any one please give me sample stored procedure to display data in Crystal report from Oracle by passing rwo input values.

    from site:-
    Crystal Reports will only support the return of a single refcursor from Oracle. Even the latest and greatest version 10 doesn't allow you to return more than one recordset at a time. You could add one more step to your procedure that would join up the output of the multiple refcursors into a PL/SQL table and then fetch the result set out through a single refcursor. That way you are using temporary space that will be cleaned up as soon as the connection is terminated and will only be returning a single refcursor

  • Procedure for loading data through 0CO_OM_CCA_9 without taking downtime .

    Dear Friends ,
    We have already maintained the flow from 0CO_OM_CCA_9 to Infocube 0COOM_C02 . Now i enhanced two fields in the datasource which i want to load into the cube . The infocube already contains data from 2008 onwards . Now i know that for controlling datasources SAP ECC/R3 downtime is not needed . Requirement is to load the historical data again for the two enhanced fields also from 2008 onwards .
    Kindly let me know the steps for doing as the delta mechanism is already activated for this flow ?
    Thanks & Regards ,
    Ashutosh Singh

    Hi All,
    I am able to create this in client 100 but not in 120. I created this program by copying the source code from sap note and run in test mode in client 100 of development server. I am getting the message that "there is no inconsistency in table BWMO2_TIMEST".
    1. I am using client for loading data 120 not 100.
    Please let me know the further steps.
    Thanks,
    Harry

Maybe you are looking for

  • Cannot send email off my imac account.

    Anyone, For some reason all of a sudden last night my imac email account has decided to stop working and will not send out email. It tries to send but then a drop down box appears and says the Outgoing Mail Server smtp account is not reading port 25.

  • Switching off at night

    New user.(BT VISION) Have read the alarming posts about the powerline adapters. They do get rather warm. I alreadyalways turn off my BT Hub at night and this automatically turns off the powerline adapter in the computer room. Decided last night I wou

  • Oracle 10g and companion CD and runInstaller

    Hi, Solaris 9 oracle 9i (currently running). I have donloaded the 10GR2 and unzipped and I do not see runInstaller. I have also downLoaded 10GR2 companion CD and what is this for? If I have to Install 10GR2 and upgrade my 9i to 10gR2 which one of the

  • Syncing from iCal to Computer

    When I sync my iPhone to my Mac computer the items that I have put in my phone iCal don't sync to the computer.  How do I fix this? I don't have Mobile Me.

  • Video card/games

    I have a powerbook g4 with a nVIDIA GeForce FX Go5200 32mb card (about 1-1/4 years old). I'm baffled by the requirements for playing games and hoping someone can tell me whether ones with GeForce2 MX or better will play properly on my machine - e.g.