Values are inserted into a SQL PL table to a database table

Hello

Here's my dilemma.

I have values inserted into a pl sql table which I have collected from a web page. Now, I need to add these values in a database table. I see the values as 1-'AA', 2 = 'BB' etc.

I use the following code to insert into a table outside in the database, and it seems to be crashing.

for me in app_table.first... loop app_table. Last
r_convention (i) .priority_country_code: = app_table (i);

insert into test_countries
values (test_seq, tion (i) .r_convention (i) .priority_country_code);

commit;

end loop;
When I run this code, I see the values. But he goes to the first value and then crashes and does not pass by the
the rest of the values. What I'm missing here?

Thank you!

and move the validation outside of the loop :-)

Tags: Database

Similar Questions

  • How the values to insert into the table with the command insertion

    Dear all
    can someone tell me how the values to insert into the table with the command insert, I want to say I always use command insert behind my forms on what shutter release button press the button of my save, but today I had a form of 6i, where controls (textbox, combo, etc.) are delineated with directly the table with I guess than the Properties Windows , I created 3 columns in tand 3 text on forms fields, now kindly tell me how to do this fields to fill and do not insert command, I mean directly defined with table column



    Please help me its urgent

    Hello

    If the block is based on your database table, just committed the shape, then changes will be applied to the database.

    François

  • Insert into MDQ_OLD select * from table (lt_monitorMdq);

    I'm trying to insert into a table that has only a single column, which is a column of a user defined type (UDT). The UDT is nested, that is one of the attributes of the UDT is an another UDT.

    I aim to insert into the table like this pseudo-code:

    INSERT INTO T1 SELECT * FROM THE UDT;

    CREATE TABLE MDQ_OLD (myMDQ UDT_T_MONITOR_MDQ)

    NESTED TABLE myMDQ

    (T1_NEW) ACE STORE

    THE NESTED TABLE MONITOR_MDQ_PRIM_RIGHTS

    STORE AS T2_NEW);

    The MONITOR_MDQ_CLI procedure. Read below returns the parameter lt_monitorMdq which is a UDT type as announced. The statement "insert into select MDQ_OLD * table (lt_monitorMdq);" fails, while the second insert statement works.

    Is it possible to get the first statement of work?

    I'm on Oracle 11 g 2.

    DECLARE

    lt_monitorMdq UDT_T_MONITOR_MDQ;

    BEGIN

    MONITOR_MDQ_CLI. Reading (TRUNC (SYSDATE),

    TRUNC (SYSDATE),

    NULL,

    NULL,

    "MILLION BTU.

    lt_monitorMdq); -Note lt_monitorMdq is an OUT parameter

    -This insert does not work

    Insert into MDQ_OLD select * from table (lt_monitorMdq);

    BECAUSE me in 1... lt_monitorMdq.count

    LOOP

    Dbms_output.put_line ('lt_monitorMdq: ' | .mdq_id lt_monitorMdq (i));

    -This integration works

    INSERT INTO MDQ_OLD (MYMDQ)

    VALUES (UDT_T_MONITOR_MDQ (UDT_R_MONITOR_MDQ)

    lt_monitorMdq (i) .gasday,

    1,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    () UDT_T_MONITOR_MDQ_PRIM_RIGHT

    () UDT_R_MONITOR_MDQ_PRIM_RIGHT

    1,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    NULL,

    (NULL)));

    END LOOP;

    END;

    have you tried:

    INSERT INTO MDQ_OLD (myMDQ) VALUES (lt_MonditorMDq);

    curiosity:

    Is there a particular reason, why you have created a table with a single column of type UDT instead of:

    CREATE TABLE... OF UDT_T_MONITOR_MDQ;

    I can tell you from experience that using a nested table, you can easily query the data in the nested table.

    MK

  • Divide the value and insert into the table

    create table mytab (a tank (25), b Varchar2 (50), Varchar2 (100)) C;

    I have a string like

    myStr:'A$bggoy#qwewewee@A$Qwe#zcxdf@A$po#xvcvxc@A$sdmy#sfdsdf @'

    I need to divide and insert into mytab

    That's what I tried

    declare p_str varchar2 (4000)

    Begin

    long l_str p_str default. '$';

    number of l_n;

    myTableType l_data: = myTabletype();

    Start

    loop

    l_n: = instr (l_str, ",");

    When the output (nvl(l_n,0) = 0);

    l_data.extend;

    l_data (l_data.count): =.

    LTRIM (rtrim (substr (l_str, 1, l_n - 1)));

    l_str: = substr (l_str, l_n + 1);

    -Connect mytab

    end loop;

    end;

    Shows below inf-s:

    describe the OBJ_SPLIT ;

    recreate

    CREATE OR REPLACE TYPE OBJ_SPLIT_table IS TABLE OF OBJ_SPLIT;

    to view the result of the compilation

    CREATE OR REPLACE Function Fn_get_split (P_str VARCHAR2)

    return OBJ_SPLIT_table

    PIPELINED is type t_ref_cursor IS REF CURSOR;

    rf_c t_ref_cursor;

    r_out_rec OBJ_SPLIT: = OBJ_SPLIT (null, null, null, null);

    Begin

    Open the rf_c for

    Select s,.

    REGEXP_SUBSTR (str, ' [^ $] +', 1, 1) s1,

    REGEXP_SUBSTR (str, ' [^ $#] +', 1, 2) s2,.

    REGEXP_SUBSTR (str, ' [^ $#] +' 1, 3) s3

    from (select s, REGEXP_SUBSTR (s, "[^ @] +', 1, rownum") str)

    (select s P_str of double)

    connect by instr (s, ' @', 1, level - 1) > 0)

    where str is not null;

    LOOP

    EXTRACTION rf_c

    IN

    r_out_rec. Str,

    r_out_rec. Delimter1,

    r_out_rec. Delimter2,

    r_out_rec. Delimter3;

    EXIT WHEN rf_c % NOTFOUND;

    PIPE ROW (r_out_rec);

    END LOOP;

    CLOSE Rf_c;

    end;

    and the result

    Select DELIMTER1, DELIMTER2, table DELIMTER3 (Fn_get_split('A$bggoy#qwewewee@A$qwe#zcxdf@A$po#xvcvxc@A$sdmy#sfdsdf@'));

    in SQLPLUS


    ----

    Ramin Hashimzade

  • insertion of a number by ascending as columns are inserted into the table

    I have a global temporary table that is populated using a procedure that has a column that must begin at 0 and add 1 every time a column is inserted. Is it possible to do without the creation of a sequence and a trigger for this column?
    example:
    iKey tran_post_code_rc receipt_date sequence_num_rc
    0 E289F 100 31 - dec - 2009
    1 E289F 98 31 - dec - 2009
    2 E289F 90 31-dec-2009
    3 E289F 31-dec-2009 103
    4 E289F 89 31-dec-2009
    5 E289F 97 31 - dec - 2009

    Hello

    If the table is populated using Insert Into... Select From, you can add ROWNUM to your selection.

    Concerning
    Peter

  • Using the default values in INSERT INTO... SELECT...

    Hello
    I want to do after insertion in Oracle 10 g

    INSERT
    IN tab1
    (
    x 1,
    x 2
    )
    SELECT
    NVL (Y1, default)
    Y2
    Of THE tab2

    but oracle throws missing expression error. I do not want to override the default values because it involves changing the code for any change of default. I guess Oracle transforms that SELECT tab2 while context, but is possible to carry out the INSET above?

    Published by: ponn_raj on January 14, 2009 04:52

    If you are going to need indeed a' by default-getter "function, I would probably go something like this."

    SQL>  create or replace function get_default(p_table varchar, p_column varchar2)
       return anydata
    is
       l_data_default_char    long;
       l_data_default_num     number;
       l_data_default_date    date;
       l_data_type            user_tab_columns.data_type%type;
       l_data_default         long;
       l_any                  anydata;
    begin
       select data_default, data_type
         into l_data_default, l_data_type
         from user_tab_columns
        where table_name = upper(p_table)
          and column_name = upper(p_column);
    
        if l_data_type in ('CHAR', 'VARCHAR2') then
          execute immediate 'begin :1 := ' || l_data_default || '; end;' using out l_data_default_char;
          l_any := anydata.convertvarchar2(l_data_default_char);
        elsif l_data_type in ('NUMBER') then
          execute immediate 'begin :1 := ' || l_data_default || '; end;' using out l_data_default_num;
          l_any := anydata.convertnumber(l_data_default_num);
        elsif l_data_type in ('DATE') then
          execute immediate 'begin :1 := ' || l_data_default || '; end;' using out l_data_default_date;
          l_any := anydata.convertdate(l_data_default_date);
        end if;
        return l_any;
    end get_default;
    /
    Function created.
    
    SQL>  create table t (
       a varchar2(5) default '',
       b varchar2(5) default 'null',
       c varchar2(5) default null,
       d varchar2(5) default '''',
       e date default sysdate,
       f integer default 1+1,
       g varchar2(3) default upper('a')
     )
    /
    Table created.
    
    SQL>  select column_name,
           get_default(table_name, column_name).accessvarchar2() c,
           get_default(table_name, column_name).accessnumber() n,
           get_default(table_name, column_name).accessdate() d
      from user_tab_cols
     where table_name = 'T'
    /
    COLUMN_NAME C              N D
    ----------- ---------- ----- -------------------------
    A
    B           null
    C
    D           '
    E                            15.01.2009 22:14:51
    F                          2
    G           A                                         
    
    7 rows selected.
    
  • How to insert into a GLOBAL TEMPORARY TABLE and get the data from it?

    The requrement is
    Split the string ENTRY point on the base and store it in a Collection. And the values of the collection will be stored in a global temporary table. Then, I'm updating some other table based on the data from the temporary table.

    There is in fact no error message. But there is no data in the temporary table and also no change in the update statement

    First of all, I'm creatiing a global temporary table only once outside the procedure.

    CREATE GLOBAL TEMPORARY table GLt (data_element number)


    create or replace procedure test_proc (p_in_string VARCHAR2) is
    i the number: = 0;
    number of POS: = 0;
    CLOB lv_str: = p_in_string;
    p_delim VARCHAR2 (1): = ', ';

    TYPE t_array IS TABLE OF VARCHAR2 (20) INDEX directory.
    t_array channels;

    BEGIN

    -cutting of string input and store in the strings (i) collection

    POS: = instr (lv_str, p_delim, 1, 1);
    WHILE (pos! = 0) LOOP
    i: = i + 1;
    Strings (i): = substr(lv_str,1,pos-1);
    lv_str: = substr (lv_str, pos + 1, length (lv_str));
    POS: = instr (lv_str, p_delim, 1, 1);
    IF pos = 0 THEN
    Strings (i + 1): = lv_str;
    END IF;
    END LOOP;

    run immediately "drop table TWG;
    run immediately ' CREATE GLOBAL TEMPORARY table (data_element number) TWG on commit preserve rows ";

    FORALL i in strings.first... Strings.Last
    INSERT INTO VALUES TWG (strings (i));
    commit;

    Update first_tbl set PIN is "XXX" where first_col in (select data_element from TWG);.
    commit;

    END test_proc;

    Published by: cedric b on January 25, 2013 12:59

    Remove the two execute immediate line. They are wrong.

    And then use the table in your code that you created at the beginning. The name is GLT.
    And delete the first commit. This validation would empty the temporary table of GLT.

    You get an error? Or it does not work as expected?

    Also, show how you call the procedure.

    Published by: Sven w. January 25, 2013 14:45

  • analysis of values are inserted XML

    SQL> create directory tmp_dir as 'c:\temp';
     
    Directory created
     
    SQL> create table zipcodes (
      2   state_abbreviation  varchar2(2),
      3   zipcode             varchar2(5),
      4   zip_code_extn       varchar2(10),
      5   city                varchar2(80),
      6   num            number(5)
      7  );
     
    Table created
     
    SQL> CREATE OR REPLACE PROCEDURE insertZipcodes (
      2    p_directory IN VARCHAR2
      3  , p_filename  IN VARCHAR2
      4  )
      5  IS       l_num number(5);
      6  BEGIN
      7  l_num := 55;
      8    INSERT INTO zipcodes (state_abbreviation, zipcode, zip_code_extn, city, num)
      9    SELECT state_abbreviation
     10         , zipcode
     11         , zip_code_extn
     12         , city  ,num            
     13    FROM XMLTable('/Zipcodes/mappings'
     14           passing xmltype(bfilename(p_directory, p_filename), nls_charset_id('AL32UTF8'))
     15           columns state_abbreviation varchar2(2)  path 'STATE_ABBREVIATION'
     16                 , zipcode            varchar2(5)  path 'ZIPCODE'
     17                 , zip_code_extn      varchar2(10) path 'ZIP_CODE_EXTN'
     18                 , city               varchar2(80) path 'CITY'
     19                   , num               number(5) 'l_num'
     20         )
     21    ;
     22  
     23  END;
     24  / 
     
    
    null value inserting if i execute the above program..
    how to insert dynamically l_num ??

    Firstly, the procedure does not compile because of the syntax error:

     , num               number(5) 'l_num'
    

    And you don't have to push the XMLTable variable, just use it directly in the SELECT clause:

    INSERT INTO zipcodes (state_abbreviation, zipcode, zip_code_extn, city, num)
    SELECT state_abbreviation
         , zipcode
         , zip_code_extn
         , city
         , l_num
    ...
    
  • SELECT the data inserted into a global temporary Table in a stored proc

    A stored procedure is run from Oracle SQL Developer to insert data into a global temporary table. A SQL (in Oracle SQL Developer) worksheet is open to run a SELECT query to retrieve the data from the temporary table overall which was populated in the stored procedure. No row is returned. I guess it's because the stored procedure and the SELECT statement executed in different sessions.

    Is it possible to run the stored procedure in Oracle SQL Developer and then execute a select statement on the temporary table overall which was filled in the stored procedure by using the same connection so that the data can be extracted?

    I use version 1.5.1 build HAND-5440 of Oracle SQL Developer.

    In a worksheet, do something like

    Start
    insert_proc;
    end;

    Select * from my_temp_table;

    Place the cursor on each statement in turn and Press f9 (where it all began... the end is a single statement.

  • 2 blocks from the database data insert into the same base table?

    Hello
    I have the C_NEW canvas. On this canvas, elements of 3 blocks are usable by the user.

    1 block NEW_HEAD: 3 Articles say X 1, X 2, X 3
    2 block NEW: record multi say Y1 thru Y10 text fields. Also a scroll bar.
    3 block NEW_ACTION: 6 buttons say B1 to B6 (one of them is N_OK which matches the element in question)

    two NEW, NEW_HEAD blocks are blocks of db and have the same basic so-called BT table when users click on the N_OK (after filling the data in the NEW_HEAD and then NEW block in that order), I need the data between the two the NEW, NEW_HEAD to enter the BT. currently only the NEW data goes to BT. in the BT table fields that correspond to the fields X 1, X 2, X 3 in the NEW_HEAD remains null after clicking on the N_OK button. I put commit_form in the N_OK code, since the blocks are blocks of db (as suggested by the people, it is easier to issue a commit_form that a lot more work in writing my own SQL).

    How can I achieve this?

    Thank you
    Chiru

    There is therefore no N_LC_DMG_ALLOW column in the table, that the block is the result. You must set the property "Section of the database" not for all the elements that are not of the columns in your database table.

    And when an error occurs, then the full treatment stops, so its clear that there is no inserted record.

  • Values are inserted in LOV

    Hi all

    I have a screen where the user can enter values of a lov lov, I have a field name and id for an individual of data (for example, employee name and id), on the front end, I have only one name (name of employee), but in the table, I used name and id, so if a name to select employee, I must fill id also in table How can I achieve this. One last thing, I have a Department of concept say more. If I select a particular Department of Department lov, employee lov should show only employees of this Department. Please help me achieve these.

    Thank you.

    Hello

    A question in emplOvvo you have empid empname passes... N?

    If you have then if not change the query... :))

    For empLov:

    Create a formvalue item, then go to the emp lovmappng create a lovmapping more...

    for lovmapping tht newly created the value of the prprtys
    Lovregionitem:emp_id
    Return: formvalueitemID

    Then go to the point of formvalue the value Prptys
    ViewInstance:

    ViewAttrbuite:

    even make for deptlov allso.

    THX
    Nani

    Published by: Nani652595 on July 5, 2009 21:55

  • The values are not displayed in the user interface

    Hello.

    I use jdev 11.1.1.5

    I need to refersh tha table

    I had created a TPTrialBal EO with corresponding VO. I had dragged and dropped it as an adf:table

    I had also created an adf:button named build., when I click on this button, some values are inserted into the TPTrialBal I need to show the value inserted in the user interface.,.
    How can I do this.,.

    could someone help me pls

    After update of data in the table add patialTrigger to the table component.
    You can do it by doing this. In the behavior section property table contains call partial property triggers here you
    adjustable from which component partial triggers this component, you can select your command button.

  • "missing the SELECT keyword" error during an insert into the temporary table using the blob value

    I'm trying to insert into an oracle temp table using select that retrieves data from a blob field but I get the error: "lack the SELECT keyword.

    How we store temporary in oracle result when we make this type of operation (extraction of data in fields and try to load them into a separate table on the fly.?)

    with cte as)

    Select user_id, utl_raw.cast_to_varchar2 (dbms_lob.substr (PREFERENCES)) as USER my_blob

    )

    create table new_table as

    SELECT user_id,EXTRACTvalue(xmltype(e.my_blob),'/preferences/locale') regional settings

    E ETC

    ----------------------------------------------------------------------------------

    BLOB data - value - which is

    <? XML version = "1.0" encoding = "ISO-8859-1" ?>

    - < Preferences >

    < time zone > America/New_York < / > zone

    < displayscheduleinusertimezone > Y < / displayscheduleinusertimezone >

    < local > Spanish < /locale >

    < DateFormat > JJ/mm/aaaa < / DateFormat >

    < timeFormat > hh: mm aaa < / timeFormat >

    < longformat > Long_01 < / longformat >

    < doubleformat > Double_01 < / doubleformat >

    < percentformat > Percentage_01 < / percentformat >

    < currencyformat > Currency_01 < / currencyformat >

    < / Preferences >

    A WITH clause that must immediately precede the SELECT keyword:

    SQL > create table t:

    2 with the o as (select double dummy)

    3 select * West longitude;

    Table created.

  • a loop data and insert into another table fail

    HI EVEYONE,
    I'm new in PL/SQL and apply to develop, which I intend to extract data from PDF directly to the oracle database by looking at its difficulty that I changed the approach of the first extraction of my data to flat file and then convert Excel CSV format that makes it easier for me to handle in my oracle database.
    The challenge I'm having here is that
    The column id_number is a mixture of 3 identifications
    One for the facility, which has the form (YEAR/0145)
    The second is for participant with the form (* 01934764 *)
    And the last identification is for dependants with the form (0, 1, 2, 3, 4, 5)
    As shown below
    ID_Number status name
    YEAR/0145
    * 01934764 * MUOKA
    MUOKA main 0
    1 joint MUOKA
    Child2 3 MUOKA
    * 01934769 * TSILIA
    JOEL main 0
    1 joint TSILIA
    2 Child1 TSILIA
    3 Child2 TSILIA
    4 Child3 TSILIA
    5 child4 TSILIA
    * 02216419 * OKOLO
    OKOLO main 0
    1 joint OKOLO
    2 Child1 OKOLO
    3 Child2 OKOLO
    4 Child3 OKOLO
    YEAR/0145
    EZEOKOLI main 0
    1 joint EZEOKOLI
    YEAR/0171
    * 01580118 * ABDOU
    Main 0 ABDOU
    1 joint ABDOU
    2 Child1 ABDOU
    3 Child2 ABDOU
    4 Child3 ABDOU
    5 child4 ABDOU
    BA/0003
    * 00992897 * BAKARI
    BAKARI main 0
    1 joint BAKARI
    BA/0004
    * 00992011 * MAINA
    MAINA main 0
    1 joint MAINA
    2 Child1 MAINA
    3 Child2 MAINA
    4 MARCO Child3
    5 child4 MAINA
    My goal is to separate facilities, participants and beneficiaries so that questioning, I can easily identify a participant and its beneficiaries is under a given installation, so I developed this code.
    create or replace procedure my_new
    is
    cursor c1 is
    Select *.
    the registry
    where id_number like "% / %" or id_number like ' * % *' or id_number in ('0', '1', '2', '3', '4',' 5');

    vNhis register.id_number%TYPE: = NULL;
    vNhis1 register.id_number%TYPE: = NULL;

    Start
    I'm in c1
    loop

    If i.id_number like "% / %".
    then
    vNhis: = i.id_number;

    on the other
    vNhis1: = i.id_number;
    dbms_output.put_line(vNhis||) e '|| vNhis1);


    -loop
    -insert into new_REGISTER (FACILITY_CODE, ID_NUMBER)
    -values (vNhis, vNhis1);
    -commit;
    -end loop;
    end if;

    end loop;
    end;
    It gives me a good quick result as shown below
    YEAR/0145 * 01934764 *.
    YEAR/0145 0
    1 YEAR/0145
    3 YEAR/0145
    YEAR/0145 * 01934769 *.
    YEAR/0145 0
    1 YEAR/0145
    2 YEAR/0145
    3 YEAR/0145
    4 YEAR/0145
    5 YEAR/0145
    YEAR/0145 * 02216419 *.
    YEAR/0145 0
    1 YEAR/0145
    2 YEAR/0145
    3 YEAR/0145
    4 YEAR/0145
    YEAR/0145 0
    1 YEAR/0145
    YEAR/0171 * 01580118 *.
    YEAR/0171 0
    1 YEAR/0171
    2 YEAR/0171
    3 YEAR/0171
    4 YEAR/0171
    5 YEAR/0171
    BA/0003 * 00992897 *.
    BA/0003 0
    BA/0003 1
    BA/0004 * 00992011 *.
    BA/0004 0
    BA/0004 1
    BA/0004 2
    BA/0004 3
    BA/0004 4
    BA/0004 5





    But uncommenting to insert into the newly created table new_register table it is to say this part of the code
    Loop
    Insert in the REGISTER (FACILITY_CODE, NHIS_NUMBER)
    values (vNhis, vNhis1);
    commit;
    end loop;
    end if;

    It took all day to run for the first time and subsequent tests fail to run with my hanging of database. any help on this is appreciated
    Thanks to you all.

    It is slow because you do a lot of change between the SQL and PL/SQL engine with inserts all looped and individual context etc.

    What you need to do is to treat the external table (CSV file) data in a single SQL statement example

    SQL> select id1, id2
      2  from (
      3        select case when id1 is not null then id1 else last_value(id1 ignore nulls) over (order by rn) end as id1
      4              ,id2
      5              ,rn
      6        from (
      7              select rownum as rn
      8                    ,case when id_number like '%/%' then id_number else null end as id1
      9                    ,case when id_number not like '%/%' then id_number else null end id2
     10              from ext_test
     11             )
     12       )
     13  where id2 is not null
     14  order by rn;
    
    ID1                  ID2
    -------------------- --------------------
    AN/0145              *01934764*
    AN/0145              0
    AN/0145              1
    AN/0145              3
    AN/0145              *01934769*
    AN/0145              0
    AN/0145              1
    AN/0145              2
    AN/0145              3
    AN/0145              4
    AN/0145              5
    AN/0145              *02216419*
    AN/0145              0
    AN/0145              1
    AN/0145              2
    AN/0145              3
    AN/0145              4
    AN/0145              0
    AN/0145              1
    AN/0171              *01580118*
    AN/0171              0
    AN/0171              1
    AN/0171              2
    AN/0171              3
    AN/0171              4
    AN/0171              5
    BA/0003              *00992897*
    BA/0003              0
    BA/0003              1
    BA/0004              *00992011*
    BA/0004              0
    BA/0004              1
    BA/0004              2
    BA/0004              3
    BA/0004              4
    BA/0004              5
    
    36 rows selected.
    
  • OSB: fn - bea: execute - sql () with the sql statement ' INSERT INTO...» »

    Dear Experts,

    I need a clarification. Is it possible to use the fn - bea: function execute sql (Oracle Service Bus) to perform an insert operation in a database with the data extracted from the message of the Organization (i.e. $body/Info/username)? If it is possible which is the right syntax?
    Any suggestion is appreciated.

    Kind regards
    Mike

    Published by: ITDeveloper on November 19, 2009 2.55

    Published by: ITDeveloper on November 19, 2009 3.01

    Hi Mike,.

    Please refer to my post for the same question to the fn - bea: sql performance with 'Insert INTO' the sql statement

    Thank you best regards &,.

    Vivek

Maybe you are looking for