Inserting rows into a data block

Hi, how do i insert 'n' rows into a data block and after that commit the changes into the data base.
Thanks for any help.

You can use something like this:
Go_Block('my_block');
first_record;
LOOP
.... insert values to the items
next_record;
END LOOP;
- for commiting changes
Do_Key('Commit_Form');
I hope this will help you.
Helena

Similar Messages

  • Need to insert rows into 100 tables at a time

    hi there,
    below is our script for creation of 100 tables...
    we need a plsql script, to insert rows into 100 tables at a single time...
    please help us...vey urgent...
    DECLARE
    counter NUMBER;
    sql_string VARCHAR2(2000);
    BEGIN FOR counter IN 1..100 LOOP sql_string := 'CREATE TABLE emp_table'||counter||'
    (id integer primary key, col_a VARCHAR2(42),col_b date,col_c number,col_d varchar2(20),col_e varchar2(20),
    col_f varchar2(20),col_g varchar2(20),col_h date,col_i varchar2(20),col_j varchar2(20),col_k date)';
    EXECUTE IMMEDIATE sql_string;
    END LOOP;
    END;
    /

    hi,
    below is our procedure and the error we are getting...
    Name Null? Type
    ID VARCHAR2(10)
    COL_A VARCHAR2(10)
    COL_B VARCHAR2(10)
    COL_C VARCHAR2(10)
    COL_D VARCHAR2(10)
    COL_E VARCHAR2(10)
    COL_F VARCHAR2(10)
    COL_G VARCHAR2(10)
    COL_H VARCHAR2(10)
    COL_J DATE
    DECLARE
    counter NUMBER;
    sql_string VARCHAR2(4000);
    BEGIN FOR counter IN 1..100 LOOP sql_string := 'CREATE TABLE emp_a'||counter||'
    (id varchar2(10), col_a varchar2(10), col_b varchar2(10), col_c varchar2(10), col_d varchar2(10), col_e varchar2(10),
    col_f varchar2(10), col_g varchar2(10), col_h varchar2(10), col_j date)';
    EXECUTE IMMEDIATE sql_string;
    END LOOP;
    END;
    DECLARE
    counter NUMBER;
    sql_string VARCHAR2 (2000);
    BEGIN
    FOR OuterCounter IN 1 .. 100 LOOP --- table prefix in which it is to be inserted
    FOR InnerCounter IN 1 .. 100 LOOP --- records to be inserted
    sql_string := 'INSERT INTO emp_a' || Outercounter || ' (id, col_a, col_b, col_c, col_d, col_e, col_f, col_g, col_h, col_j)
    VALUES ('
    || InnerCounter || ', to_char( ''col_a''' || innercounter || '),'
    || InnerCounter || ', to_char( ''col_d''' || innercounter || '),'
    || ', to_char( ''col_e''' || innercounter || '),'
    || ', to_char( ''col_f''' || innercounter || '),'
    || ', to_char( ''col_g''' || innercounter || '),'
    || ', to_char( ''col_h''' || innercounter || '),'
    || ', to_char( ''col_j''' || innercounter || '), SYSDATE)';
    EXECUTE IMMEDIATE sql_string;
    END LOOP;
    END LOOP;
    END;
    DECLARE
    ERROR at line 1:
    ORA-00907: missing right parenthesis
    ORA-06512: at line 17
    please check the procedure and write the correct one...

  • Help in inserting rows into a table

    I have a table called acct_fact,
    I need to insert rows in the table using a script but the problem is there's a column called seq_nbr which has random seq nbr of 14character length like 'ZWX98MGD9MVAD6J','ZWX98MG67RVAD6J' etc.,
    While inserting rows I need to generate such seq_nbr for those columns and insert rows into the table, can I use any such mechanism in my insert query to insert such random nbr's while inserting rows into a table.
    If so please suggest me

    Hi Peter,
    Thankyou for the quick reply:)
    can you suggest me how to implement it here in my script snippet:
    while read var_acct_nbr
    do
    echo "update acct_attr set acct_attr_exp_dt ='$ExpDate' where Acct_Attr_Value_Text='15' and acct_attr_exp_dt is null and person_id='LDCarrBillAgrm' and acct_nbr='$var_acct_nbr' ;" >> ./$DirectoryName/SQLQuery_$TimeStamp.sql
    echo "insert into acct_fact values ('$var_acct_nbr','$ExpDate','$ExpTime','*seq_nbr*','N','ProjTereza','Remoção de acordo d; data de expiração: $ExpDate',null,'1','LDE',null);" >> ./$DirectoryName/SQLQuery_$TimeStamp.sql
    done < ./$DirectoryName/ExpireAccts_$TimeStamp.LOG
    the script takes each acct_nbr nbr form a input file and fires an insert statement.
    The one in bold is the column where such sequence need to be inserted.can you help me in implementing the way you suggested in my script i.e., insert statement
    Thanks in Advance:)
    Edited by: rkrish on Jun 27, 2012 3:04 AM

  • Inserting rows into table Based on Column Values.

    Hi,
    I am trying to inserting rows into a table based on Column.
    Id      Name        
    Data
    N 105.1.1
    http://www.example.com/New/105.1.1
    U 105.1.2               http://www.example.com/Used/105.1.2
    S 105.1.3               http://www.example.com/Sold/105.1.3
    I want a table like this. 
    I want to insert Data column value based on Id and Name Columns
    If Id = N and Name = 105.1.1 then Data value should be insert as   http://www.example.com/New/105.1.1
    If Id = U and Name = 105.1.2 then Data value should be  insert as  http://www.example.com/Used/105.1.2
    If Id = S and Name = 105.1.3 then Data value should be insert as   http://www.example.com/Sold/105.1.3
    Can you please help us to write query to insert above Data Column values based on Id and Name Columns.

    INSERT INTO tbl (col) SELECT
    CASE WHEN id='N' and Name='105.1.1 ' THEN 'http://www.example.com/New/105.1.1'
              WHEN id='U' and Name='105.1.2 ' THEN 'http://www.example.com/New/105.1.2'
    END col
    FROM anothertbl
    Sorry , cannot test it right now.
    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

  • How to find a value into a data block

    There is a way to find a value into a data block, like finding
    one into a record group
    null

    Rafael Moreno (guest) wrote:
    : There is a way to find a value into a data block, like finding
    : one into a record group
    Try something like this:
    -- has to be in a when-button-pressed or key trigger
    go_block('x_block');
    first_record;
    r_found:=false;
    loop
    if :x_block.search_field:=search_value then
    r_found:=true;
    exit;
    end if;
    down;
    end loop;
    if r_found=false then
    first_record;
    message('Value '

  • Insert and update a data block which is based on view--urgent help required

    Hi experts,
    I created a view(A_VIEW) which is based on a union select. I have created a data block A_VIW_BLOCK which is based on this view. I need to insert/update one of the base tablesfor A_VIEW through this data block. I also need to be able to make a query through all the fields in the view.
    The questions are:
    1.Can it be done at all?
    2. What properties need to be set?
    3. If can't be done, what the best approach to achieve this?
    Thanks in advance!!
    Michael

    hi
    try something like this.
    CREATE TABLE demo_tab (
    person_id NUMBER(3),
    first_name VARCHAR2(20),
    last_name VARCHAR2(20));
    CREATE OR REPLACE VIEW upd_view AS
    SELECT * FROM demo_tab;
    INSERT INTO demo_tab
    (person_id, first_name, last_name)
    VALUES
    (1, 'Daniel', 'Morgan');
    INSERT INTO demo_tab
    (person_id, first_name, last_name)
    VALUES
    (2, 'Helen', 'Lofstrom');
    COMMIT;
    SELECT * FROM upd_view;
    UPDATE upd_view
    SET person_id = person_id * 10;
    SELECT * FROM upd_view;
    desc user_updatable_columns
    SELECT table_name, column_name, updatable, insertable, deletable
    FROM user_updatable_columns
    WHERE table_name IN (
       SELECT view_name
       FROM user_views);
    SQL> create table dummy (f1 number);
    Table created.
    SQL> create view dummy_v 
    2  as 
    3  select f1 from dummy 
    4  union all  
    5  select f1 from dummy;
    View created.
    SQL> create trigger dummy_v_it 
    2  instead of insert 
    3  on dummy_v 
    4  for each row 
    5  begin 
    6    insert into dummy values (:NEW.f1); 
    7  end; 
    8  /
    Trigger created.
    SQL> insert into dummy_v values (1);
    1 row created.
    SQL> select * from dummy_v;       
    F1
    1        
    1
    SQL> select *
      2  from user_updatable_columns
      3  where table_name = 'DUMMY_V';
    OWNER    TABLE_NAME   COLUMN_NAME  UPD INS DEL
    FORBESC  DUMMY_V      F1            NO  NO  NOforms settings.
    Enforce Primary Key - No
    Query Allowed - Yes
    Query datasource Name - V_TSFDETAIL
    Insert Allowed - Yes
    Update Allowed - Yes
    Delete Allowed - Yes
    Locking Mode - Automatic
    Key Mode - Automatic
    do not forget to create synonyms.
    hope this helps.
    sarah

  • Space utilization and optimal row size in Data Blocks in Oracle 11g

    Hi,
    My main concern till now is to find the Optimal no. of rows/tuples per one oracle data block of size 8192. For that purpose i'm doing different kind of testing.
    I created one table:
    SQL> create table t5
    2 (x char(2000));
    Table created.
    Inserted 4 rows in it.
    Queried to check in which block no's these 4 rows exist.
    SQL> SELECT x,DBMS_ROWID.ROWID_BLOCK_NUMBER(rowid) "Block No."
    2 from t5;
    x Block No.
    A 422
    B 422
    C 422
    D 423
    SQL> analyze table t5 compute statistics;
    Table analyzed.
    SQL> select LOGGING,BACKED_UP,NUM_ROWS,BLOCKS,EMPTY_BLOCKS, AVG_SPACE,CHAIN_CNT, AVG_ROW_LEN
    2 from user_tables
    3 where table_name = 'T5';
    LOG B NUM_ROWS BLOCKS EMPTY_BLOCKS AVG_SPACE CHAIN_CNT AVG_ROW_LEN . YES N 4 5 3 6466 0 2006 .
    8 data blocks are initially allocated. but my question is that while creating table of even small sizes, every time i'm seeing that it shows BLOCKS (used) are 5.
    why 3 block are EMPTY_BLOCKS allocated all the time?
    AVG_SPACE is the FREE space in every BLOCK that is used if i'm not wrong?
    In this scenerio 3 rows (each of around 2006 bytes) are inserted into into one BLOCK of 8192 i.e. 8192-6006=2186. 2186 is the PCTFREE or what?
    How can I see this CHAIN_CNT column value other than 0?
    How can actually I find the optimal no. of rows/tuples in 1 data block that will not increase OVERHEAD on the system.
    I'll highly appreciate the genuine help and solid suggestions.
    Thanks in Advance.
    Best Regards,
    Kam

    kamy555 wrote:
    If you want to suggest something it'll be nice of yo.I can't disclose my main concern :)If you can't disclose what you mean by "optimal" and you can't disclose what "overhead" you are concerned about, I'm not sure that anyone could answer your question.
    In this scenerio 3 rows (each of around 2006 bytes) are inserted into into one BLOCK of 8192 i.e. 8192-6006=2186. 2186 is the PCTFREE or
    what?PCTFREE is a percentage. You haven't specified what you set it to, but that decreases the space in a block available for inserts to 8192 * (1 - PCTFREE/100).
    How can I see this CHAIN_CNT column value other than 0?Why do you believe there would be chained rows? You would need to use the ANALYZE command to populate the CHAIN_CNT column.
    How can actually I find the optimal no. of rows/tuples in 1 data block that will not increase OVERHEAD on the system.Since you can't disclose what "optimal" means or what "overhead" you're concerned with, I don't see how this question could be answered.
    Justin

  • Inserting rows into a table

    Hi,
    I want to insert values into a table 'Reasons'.
    The table 'Reason' has 5 columns
    out of 5 two columns has static data say
    column A value 'A'
    column E value sysdate
    But in the other three columns the vlues are repeating and as follows.
    Column B all rows of column x from table B
    Column C all rows of column y from table C
    Column D list of values as (ONE,TWO,THREE,FOUR)
    Please Help
    Thanks
    Rohit Taneja

    create table tableb(id number,x varchar2(20));
    insert into tableb values(1,'APPLE');
    insert into tableb values(2,'BANANA');
    insert into tableb values(3,'MANGO');
    create table tablec(id number,y varchar2(20));
    insert into tablec values(1,'ROHIT1');
    insert into tablec values(2,'ROHIT2');
    insert into tablec values(3,'ROHIT3');
    insert into tablec values(4,'ROHIT4');
    select 'A' AS COL_A, d.X AS COL_B,d.Y AS COL_C,
    to_char(to_date(ROW_NUMBER() OVER(PARTITION BY X,y ORDER BY X,Y),'YYYY'),'YYYYSP') AS COL_D,SYSDATE
    FROM ( select a.id , a.x X, b.y Y  from tableb a,tablec b , tablec e order by a.x) d
    ORDER BY d.X,d.Y
    C COL_B                COL_C                COL_D                                      SYSDATE
    A APPLE                ROHIT1               ONE                                        30-SEP-02
    A APPLE                ROHIT1               TWO                                        30-SEP-02
    A APPLE                ROHIT1               THREE                                      30-SEP-02
    A APPLE                ROHIT1               FOUR                                       30-SEP-02
    A APPLE                ROHIT2               ONE                                        30-SEP-02
    A APPLE                ROHIT2               TWO                                        30-SEP-02
    A APPLE                ROHIT2               THREE                                      30-SEP-02
    A APPLE                ROHIT2               FOUR                                       30-SEP-02
    A APPLE                ROHIT3               ONE                                        30-SEP-02
    A APPLE                ROHIT3               TWO                                        30-SEP-02
    A APPLE                ROHIT3               THREE                                      30-SEP-02
    A APPLE                ROHIT3               FOUR                                       30-SEP-02
    A APPLE                ROHIT4               ONE                                        30-SEP-02
    A APPLE                ROHIT4               TWO                                        30-SEP-02
    A APPLE                ROHIT4               THREE                                      30-SEP-02
    A APPLE                ROHIT4               FOUR                                       30-SEP-02
    A BANANA               ROHIT1               ONE                                        30-SEP-02
    A BANANA               ROHIT1               TWO                                        30-SEP-02
    A BANANA               ROHIT1               THREE                                      30-SEP-02
    A BANANA               ROHIT1               FOUR                                       30-SEP-02
    A BANANA               ROHIT2               ONE                                        30-SEP-02
    A BANANA               ROHIT2               TWO                                        30-SEP-02
    A BANANA               ROHIT2               THREE                                      30-SEP-02
    A BANANA               ROHIT2               FOUR                                       30-SEP-02
    A BANANA               ROHIT3               ONE                                        30-SEP-02
    A BANANA               ROHIT3               TWO                                        30-SEP-02
    A BANANA               ROHIT3               THREE                                      30-SEP-02
    A BANANA               ROHIT3               FOUR                                       30-SEP-02
    A BANANA               ROHIT4               ONE                                        30-SEP-02
    A BANANA               ROHIT4               TWO                                        30-SEP-02
    A BANANA               ROHIT4               THREE                                      30-SEP-02
    A BANANA               ROHIT4               FOUR                                       30-SEP-02
    A MANGO                ROHIT1               ONE                                        30-SEP-02
    A MANGO                ROHIT1               TWO                                        30-SEP-02
    A MANGO                ROHIT1               THREE                                      30-SEP-02
    A MANGO                ROHIT1               FOUR                                       30-SEP-02
    A MANGO                ROHIT2               ONE                                        30-SEP-02
    A MANGO                ROHIT2               TWO                                        30-SEP-02
    A MANGO                ROHIT2               THREE                                      30-SEP-02
    A MANGO                ROHIT2               FOUR                                       30-SEP-02
    A MANGO                ROHIT3               ONE                                        30-SEP-02
    A MANGO                ROHIT3               TWO                                        30-SEP-02
    A MANGO                ROHIT3               THREE                                      30-SEP-02
    A MANGO                ROHIT3               FOUR                                       30-SEP-02
    A MANGO                ROHIT4               ONE                                        30-SEP-02
    A MANGO                ROHIT4               TWO                                        30-SEP-02
    A MANGO                ROHIT4               THREE                                      30-SEP-02
    A MANGO                ROHIT4               FOUR                                       30-SEP-02
    48 rows selected.hope this is helpfull
    cheers
    prakash

  • Object Browser - Insert row into table

    Hi,
    I'm attempting to simply INSERT a row into a table using the "Create Row" in the Object Browser. I enter in all the data for the row, and click the Create button. There is no process success message, just another entry form for the Create Row is displayed. When I query the table, the data I just entered for the row is not there. What is going on?
    Thank you,
    Laura

    What version are you using? 2.2.0.00.32
    What are the column datatypes? I have several VARCHAR2, NUMBER, DATE, and CHAR columns.
    Are you using (do you see) the Create or "Create and Create Another" button?
    Yes, I tried both the "Create" and "Create and Create Another" button.
    Does it work correctly on apex.oracle.com?
    Hmm...looks like I will have to request a new Workspace. I haven't logged into there for quite some time (forgot my Workspace name, etc.)...and the email address you have on file for me is no longer a valid email address.

  • Insert row into database table via dynamic form -

    I have developed a portlet via Portal. I used a dynamic page. I replaced the default "<ORACLE>select * from scott.emp</ORACLE>" text to call a package procedure that uses HTP.P to render the web page. My goal is to show all rows in a table and allow edits to any row, and also add a checkbox on each row to allow the user to mark for delete. I am successfully using a FOR loop and showing all of the data in a grid. My problem - How do I update and delete the data? I have a submit button with nothing behind it currently. I would ideally like to use pl/sql code to do the updates and/or deletes as marked on the page by the user, but I'm not sure how to hook the submit button to calling a procedure to execute the updates/deletes.
    Any help would be appreciated -
    Thanks -
    Kent

    Hi Patrick - Thanks for your response! I have browsed your page quickly - very informative and I will look in more detail. My form design looks as below (using a simple example with emp id and emp name columns) - perhaps this will have to change, but I wanted the user to be able to insert using html fields id_add and name_add, then update (or mark for deletion) any of the existing rows (they are rendered with for loop in pl/sql - eg, id_1/name_1, id_2/name_2, etc for each row in the table). I was hoping the submit action would call a pl/sql that would look at all rows, and then act if an update or delete were required. This makes it difficult to use parms, I believe - I may be able to change the design to show an "update row" below the current "insert row" so that, as in your example, when the user highlights a row, it populates in the update area where changes can be made, and an update button used to effect the changes to a single row at a time.
    Thanks again, I appreciate your input!
    Kent
    ______________ _________________ <insert_button>
    Emp Id (textbox) Emp Name (textbox) Del_Checkbox
    ______________ _________________ ___ <SUBMIT_BUTTON>
    ------------------------- ----------------------------- ------

  • Flex application works locally, fails when online (connecting to PHP script to insert row into DB)

    Hi everyone,
    I've got a Flex application that works wonderfully when I test it on my machine locally. It uploads files and send variables to a PHP script (that inserts them into a DB) with no errors when I run it locally. As soon as I put it online, the upload continues to work but something between my Flex application and the PHP script fails because no data is committed to the DB. I know the PHP script works fine - not only does it work when I run the Flex application locally but when I go directly to the PHP file online, a new empty line is added to the DB.
    I initially thought that this was a cross domain issue so I added the following to the root of my hosted account:
    <cross-domain-policy>
    <site-control permitted-cross-domain-policies="all"/>
    <allow-access-from domain="*.MYURL"/>
    <allow-http-request-headers-from domain="*.MYURL" headers="*" secure="false"/>
    </cross-domain-policy>
    I based this off of what I found online which seems to have done nothing for me. I'd also be happy to provide an error message but I don't get one when I debug.
    Any thoughts would be greatly appreciated.

    Use a network monitor to see if the Flex app is truly requesting the right URL.
    -Alex

  • Read a file and insert rows into table

    Hi,
    i would like to know how read a file (expl.txt) with the utl_file package and after insert each row into the table (dataID).
    ie :
    file /tmp/expl.txt is containing :
    id1 id2 describe
    2 3 test1
    6 5 test2
    4 7 test3
    and
    table dataID (
    id1 number,
    id2 number,
    describe varchar2(100));
    Thanks you very much.

    Hello,
    You can use the TEXT_IO package.
    Perform an over-all search (right upper corner) on TEXT_IO, and in the results you will find a manual on how to use the package.
    Hope this will help you.
    Regards,
    Cindy

  • Insert timestamp into a Date field.

    Hi anyone knows if I insert a timestamp into a date field, will it sort according to the date field if I use an sql statement to sort the data?

    Your question is quite unclear, it sounds like you have two questions:
    1. Can I insert a timestamp into a date field (in the database?)?
    2. Can I sort my sql statement using the date field?
    Is this what you are asking? If not, please clarify.

  • How to convert multiple rows into colmun data?

    Hi all
    ODI has fuction that covert multiple rows form a file into colmun data?
    Source:customer.txt
    001,Scott
    001,Man
    001,23
    002,Lincon
    002,Man
    002,21
    objective Target:customer
    ID Name Sex Age
    001 Scott Man 23
    002 Lincon Man 21
    If there is no this fuction,how can I do this in ODI?
    Thanks in advance.
    Agui

    Hi, Sanjeev,
    What you requested is called String Aggregation.
    Like most other things, the best way to do it depends on your version of Oracle.
    The following site shows several different ways to do string aggregation:
    http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php'
    The user-defined function (often called STRAGG) that Charles mentioned is my favorite, in versions between 9.1 and 11.1.

  • Searching into a data block

    I wanna know how to search for a specific record, if i have made a data block. with up and down arrows, i move to the next/last record. but how can i search? i don't know how to make at a specific time, all the fields blank, and i type a part of name in the name field, then i wanna search all records matching that part of name
    Regards,

    You could do it programatically by prompting the user for search criteria, then have them press a search button. The search button could build a where clause based on the criteria entered, then call
    set_block_property('blockname',DEFAULT_WHERE, your_where_clause);
    go_block('blockname');
    execute_query;This way you can control what the user searches on, limit choices to dropdowns, add soundex capability if a checkbox is selected, etc.
    Gary

Maybe you are looking for