Inserting Rows in SQL

Hello All,
I'll try to insert 100 rows at through SQL command at a time, is it possible ?
Data should be in following manner :
Emp_ID, Emp_Name, Emp_Address, EMP_Info
How should I do this?
Thanx in advance.
San

To provide an example for the bulk bind approach.
The arrays below obviously have to be of the same size. More can be added to cater for additional values.
SQL> create or replace type TStrings is table of varchar2(4000);
2 /
Type created.
SQL>
SQL> create or replace type TNumbers is table of number;
2 /
Type created.
SQL>
SQL> create table tab1
2 (
3 id number,
4 name varchar2(20)
5 );
Table created.
SQL>
SQL>
SQL> declare
2 name_list TStrings :=
3 new TStrings( 'Jack', 'John', 'Joe' );
4
5 id_list TNumbers :=
6 new TNumbers( 76123, 19273, 4823 );
7
8 begin
9 forall i in 1..name_list.Count
10 insert into tab1 values ( id_list(i), name_list(i) );
11 end;
12 /
PL/SQL procedure successfully completed.
SQL>
SQL> commit;
Commit complete.

Similar Messages

  • Database got halted while inserting rows

    I have a 9i database running on solaris not restarted for 15 days.It just got halted or hanged while inserting rows in a table.When restarted everything is just fine and those rows have been inserted in no time!!What might be the reason?Dont tell me 'lock' because I have already checked for ora:60 error in alertlog.Would you please give some direction to drill it down .

    Did you met the problem , only when you inserting the rows ? Or is there something else which leads this situation ? most of the occasion when
    you found your database halt is because of your archivelogs . I would
    still like to know if you running your db in archivelog mode ? It also be the
    case that you set archive_log_start = true in the pfile and diden't fire
    alter database archivelog at the sql prompt .
    Hare Krishna
    Alok

  • Error when insert data in Sql Server table(DateTime data type)

    Hello all,
    I have created a database link in oracle 11g to SQL Server 2008 using Sqlserver gateway for oracle,Oracle run on Linux and SQL Server run on Windows platform.
    I have queried a table and it fetches rows from the target table.
    I am using this syntax for insert a row in Sql Server table.
    Insert into Prod@sqlserver (NUMITEMCODE, NUMPREOPENSTOCK, NUMQNTY, NUMNEWOPENSTOCK, DATPRODDATE , TXTCOMPANYCODE, "bolstatus", NUMRESQNTY )
    Values (1118 , 1390.0 , 100.0 ,1490 , '2012-06-23 12:37:58.000','SFP' ,0 , 0 );
    but it give me error on DATPRODDATE,The data type of DATPRODDATE column in Sql Server is DATETIME.
    My Question is how can i pass the date values in INSERT statement for Sql Server DateTime data type.
    Regards

    Just as with Oracle, you have to specify the date using the to_date() function or use the native date format for the target database (if you can figure out what that is). This is good practice anyway and a good habit to get into.

  • Inserting rows in table while logging errors...Urgent

    Hi all,
    i want to insert rows from temp table to main table.
    if temp table contains 100 rows.then all rows must be inserted
    in main table.if their is any exception while insertion,
    insertion must nt stop and erroring rows along with error no must be inserted in
    error log table.
    How to do this ?
    i used forall save exceptions to achieve this .
    but ws able to save only error no. but not errroing rows in error log table.
    is there any efficient way to achieve this?
    can forall be modified in way that it inserts erroring rows also?????

    Hi,
    1.) does dbms_errorlog works fine in this case?If all of your 807 tables having same columns then i think it will work (NOT TESTED).
    By the way are you also trying to insert rows for all tese 807 tables in a single PL/SQL block?
    Please post how you are trying to insert then we can think about it,
    Oracle ERROR_LOG table allows us to have any number of columns.
    From the Oracle Docs:
    The number of columns in this part of the error logging table can be zero, one, or more, up to the number of columns in the DML table. If a column exists in the error logging table that has the same name as a column in the DML table, the corresponding data from the offending row being inserted is written to this error logging table column. If a DML table column does not have a corresponding column in the error logging table, the column is not logged. If the error logging table contains a column with a name that does not match a DML table column, the column is ignored.
    Regards

  • 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

  • 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>
    ------------------------- ----------------------------- ------

  • ORA-01840 error on inserting row trough object browser

    Dear Oracle Community,
    I'm getting the ORA-01840: Input value not long enough for date format error when I try to insert a row with the date value 24-MAY-10 with my object browser.
    This is the problem column:
    Column Name | Data Type| Nullable| Default | Primary Key
    SIGNUPDATE |DATE |No | - | -
    Now this will look like I'm using the wrong date format so I have googled and found that I should use the following query to check for the correct date format my database uses.
    select * from nls_session_parameters where parameter = 'NLS_DATE_FORMAT';
    This returns the DD-MON-RR format so I think I'm inserting the correct date format here.
    What am I doing wrong?
    I have already tried inserting with the following formats and tried replacing the - sign with the / sign.
    DD-MON-RR
    DD-MON-YY
    DD-MON-YYYY
    I have also tried using the SYSDATE is in the DD-MON-RR format trough the SQL commandline.
    I'm feeling like an idiot this should be simple right?
    Please help me out here this is frustrating, many thanks in advance.
    J Nijman

    using the SYSDATE is in the DD-MON-RR format trough the SQL commandlineIn sqlplus try:
    insert into <tablename> ( <date columnname> [, ... ] ) values ( sysdate [, ...] );
    To get a sysdate date value added. Or specify the format string with a to_date expression:
    insert into <tablename> ( <date columnname> [, ... ] ) values ( to_date( '24-may-10', 'dd-mon-yy') [, ... ] );
    The engine isn't picky about separators agreeing with the format string, most any character in place of the '-' dash is acceptable.
    Now to get an ora-1840 out of the object browser (Table/Data/Insert Row), I'm not having any luck trying to duplicate that. With the default nls_date_format 'DD-MON-YY' even trying bad dates (i.e. 30-feb-10 or 30-feb-2010, or even 31-apr-10) it either does an ora-1839: date not valid for month specified, or with a four digit year it gives an ora-1830: date format picture ends before converting entire input string.
    Any RDBMS presents programmers with date and datetime challenges, its not just an oracle-frustration thing ;)

  • Last Inserted Row in a Table

    Hi,
    I want to select only the last inserted row in a table. Can anybody help me how can i get it.
    Eg
    select * from emp;
    empno ename sal
    12 abc 100
    13 xyz 200
    Now i have inserted a row as
    Insert into emp values (14,'Rohit',500);
    So i only want to select the last inserted row i.e.. empno 14 (in this case).
    Thanks
    Bye
    Rohit Taneja

    Thanks to all for replying.
    But the result is not which i desire.
    I have deleted the existing row in the same table as
    SQL> Delete from emp where empno = 13;
    1 row deleted.
    Then i inserted a new row as
    SQL> insert into emp values(10,'SRI',200);
    1 row created.
    Then i committed the work
    SQL> commit;
    Commit complete.
    But still am getting the last row as
    SQL> select * from emp
    where rowid=(select max(rowid)
    from emp);
    EMPNO ENAME SAL
    14 ROHIT 500
    as the solution.
    But here i am supposed to get the row with empno 10.
    I have tried both the queries and still geting the same result.
    Please look aat it again,
    Thanks in advance
    Bye
    Rohit Taneja
    Hi,
    I want to select only the last inserted row in a
    table. Can anybody help me how can i get it.
    Eg
    select * from emp;
    empno ename sal
    12 abc 100
    13 xyz 200
    Now i have inserted a row as
    Insert into emp values (14,'Rohit',500);
    So i only want to select the last inserted row i.e..
    empno 14 (in this case).
    Thanks
    Bye
    Rohit Taneja

  • Compare 2 tables and insert rows missing in each table.

    I have a tough situation. I have two exact tables- one online and one offline database. I know that there are missing rows of data from each table, so I need to make a comparison of one table and insert rows that do not exist. I was thinking to try this, but it took over 3 hours to run and did not return anything:
    insert into t
    select * from t a
    where not exists (select * from [email protected] b
    where a.col1 != b.col1
    and a.col2 != b.col2
    and a.col3 != b.col3);
    and it goes on for another 7columns.
    The trouble I have is to include a date clause so that the query can be broken down into running only a few months of data comparisions at a time- the records go back 4 years to compare. Also is there a way to write this so that it will query both tables at the same time in order to speed things up- or is one table at a time the best advice? Each table has over 100 million records to compare, that's why I was hoping to use a date criteria since one column is date.
    Let me know what you advise to make this work, I hope I was on the right track.

    Not sure if the MINUS operator will perform better with your data set but;
    SQL> create table t1 (some_id number, some_date date)
    Table created.
    SQL> create table t2 (some_id number, some_date date)
    Table created.
    SQL> insert into t1 values (1, trunc(sysdate))
    1 row created.
    SQL> insert into t1 values (2, trunc(sysdate-5))
    1 row created.
    SQL> insert into t1 values (4, trunc(sysdate-90))
    1 row created.
    SQL> insert into t2 values (1, trunc(sysdate))
    1 row created.
    SQL> insert into t2 values (3, trunc(sysdate-10))
    1 row created.
    SQL> insert into t2 values (5, trunc(sysdate-100))
    1 row created.
    SQL> select * from t1
       SOME_ID SOME_DAT
             1 07-07-30
             2 07-07-25
             4 07-05-01
    3 rows selected.
    SQL> select * from t2
       SOME_ID SOME_DAT
             1 07-07-30
             3 07-07-20
             5 07-04-21
    3 rows selected.
    SQL> insert into t1 (
       select some_id, some_date from t2 where some_date between sysdate-50 and sysdate
       minus
       select some_id, some_date from t1 where some_date between sysdate-50 and sysdate)
    1 row created.
    SQL> insert into t2 (
       select some_id, some_date from t1 where some_date between sysdate-50 and sysdate
       minus
       select some_id, some_date from t2 where some_date between sysdate-50 and sysdate)
    1 row created.
    SQL> select * from t1
       SOME_ID SOME_DAT
             1 07-07-30
             2 07-07-25
             4 07-05-01
             3 07-07-20
    4 rows selected.
    SQL> select * from t2
       SOME_ID SOME_DAT
             1 07-07-30
             3 07-07-20
             5 07-04-21
             2 07-07-25
    4 rows selected.

  • Update random rows in sql table

    Do not ask me why but I have to do it and I would greatly appreciate any help.
    Let us say that I want to update column foo_column of a table foo. The selection criteria is foo_selection_criteria. So my sql to update would be something like:
    update foo set foo_column='some value' where <foo_selection_criteria>
    Foo_selection_criteria can be any logical expression based on the value of columns in table foo. For example foo_selection_criteria could be foo.columna != '1';
    There are m rows in the table that meet the foo_selection_criteria. I want to update only randomly selected 1/n (eg., 0.5 , 083 etc) of these m rows.
    I tried using dbms_random.value procedure to update my sql above so that it reads something like
    update foo set foo_column='some value' where <foo_selection_criteria> and dbms_random.value <= 1/n;
    However it seems that dbms_random is evaluated only once in the update sql above. Is there any way I can avoid that dbms_value is calculated once and stick in the sql above ? Or is someone aware of another way to randomly update a random fraction of m rows that meed an update selection criteria ?
    I would be grateful for any help/

    Tubby wrote:
    Why not just
    ROWNUM = 1
    that's random....I disagree. Rownum = 1 will in general return the first inserted row into a table.
    There is no guarantee that it is the first inserted row, but in 99% of all cases it will be so ( i just made this statistic up, but prove me to be wrong ;)) .
    And an 99% chance is not very random for me.

  • Unexpected PX_TXN insert row Error?

    The following error prints, at random, on my uix page. Has anyone experienced it or know how to redirect it from the Browser:
    oracle.jbo.PCollException: JBO-28030: Could not insert row into table PS_TXN, collection id 19,028, persistent id -1
         void oracle.jbo.PCollException.throwException(java.lang.Class, java.lang.String, java.lang.Object[], java.lang.Exception)
              PCollException.java:39
         void oracle.jbo.pcoll.OraclePersistManager.insert(long, long, int, oracle.jbo.pcoll.PCollKeyInfo[], byte[])
              OraclePersistManager.java:1609
         boolean oracle.jbo.pcoll.PCollNode.passivateElem(oracle.jbo.pcoll.PCollPersistable, oracle.jbo.pcoll.PCollNode, oracle.jbo.pcoll.PCollection, long)
              PCollNode.java:543
         boolean oracle.jbo.pcoll.PCollNode.passivate()
              PCollNode.java:674
         boolean oracle.jbo.pcoll.PCollNode.passivateBranch()
              PCollNode.java:617
         long oracle.jbo.pcoll.PCollection.passivate()
              PCollection.java:429
         int oracle.jbo.server.DBSerializer.passivateRootAM(int, byte[])
              DBSerializer.java:256
         int oracle.jbo.server.DBSerializer.passivateRootAM(byte[])
              DBSerializer.java:239
         int oracle.jbo.server.ApplicationModuleImpl.passivateState(byte[])
              ApplicationModuleImpl.java:3848
         void oracle.jbo.common.ampool.ApplicationPoolImpl.doFailover(oracle.jbo.ApplicationModule, oracle.jbo.common.ampool.SessionCookie, boolean)
              ApplicationPoolImpl.java:2423
         void oracle.jbo.common.ampool.ApplicationPoolImpl.doFailover(oracle.jbo.ApplicationModule, oracle.jbo.common.ampool.SessionCookie)
              ApplicationPoolImpl.java:2375
         void oracle.jbo.common.ampool.ApplicationPoolImpl.doManagedCheckin(oracle.jbo.common.ampool.SessionCookie, boolean)
              ApplicationPoolImpl.java:1657
         void oracle.jbo.common.ampool.ApplicationPoolImpl.releaseApplicationModule(oracle.jbo.common.ampool.SessionCookie, int)
              ApplicationPoolImpl.java:1031
         void oracle.jbo.common.ampool.SessionCookieImpl.releaseApplicationModule(int, long)
              SessionCookieImpl.java:576
         void oracle.jbo.http.HttpSessionCookieImpl.releaseApplicationModule(int, long)
              HttpSessionCookieImpl.java:216
         void oracle.jbo.common.ampool.SessionCookieImpl.releaseApplicationModule(boolean, boolean, long)
              SessionCookieImpl.java:524
         void oracle.jbo.common.ampool.SessionCookieImpl.releaseApplicationModule(boolean, boolean)
              SessionCookieImpl.java:506
         void oracle.cabo.data.jbo.servlet.RootAppModuleRegistryImpl$ReleaseRootAppModule.unbindValue()
         void oracle.cabo.share.util.BindableNamespaceMap.unbindAll()
         void oracle.cabo.servlet.BaseBajaContext.dispose()
         oracle.cabo.servlet.Page oracle.cabo.servlet.PageBrokerHandler.handleRequest(oracle.cabo.servlet.BajaContext)
         void oracle.cabo.servlet.UIXServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void oracle.cabo.servlet.UIXServlet.doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
              HttpServlet.java:760
         void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
              HttpServlet.java:853
         void com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.invoke(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
              ServletRequestDispatcher.java:721
         void com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.forwardInternal(javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse)
              ServletRequestDispatcher.java:306
         boolean com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.processRequest(com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.ApplicationServerThread, com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.EvermindHttpServletRequest, com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
              HttpRequestHandler.java:767
         void com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.run(java.lang.Thread)
              HttpRequestHandler.java:259
         void com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.run()
              HttpRequestHandler.java:106
         void EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run()
              PooledExecutor.java:803
         void java.lang.Thread.run()
              Thread.java:484
    ## Detail 0 ##
    java.sql.SQLException: ORA-00001: unique constraint (EPIC.PS_TXN_PK) violatedORA-06512: at line 1
         void oracle.jdbc.dbaccess.DBError.throwSqlException(java.lang.String, java.lang.String, int)
              DBError.java:187
         void oracle.jdbc.ttc7.TTIoer.processError()
              TTIoer.java:241
         void oracle.jdbc.ttc7.Oall7.receive()
              Oall7.java:543
         void oracle.jdbc.ttc7.TTC7Protocol.doOall7(byte, byte, int, byte[], oracle.jdbc.dbaccess.DBType[], oracle.jdbc.dbaccess.DBData[], int, oracle.jdbc.dbaccess.DBType[], oracle.jdbc.dbaccess.DBData[], int)
              TTC7Protocol.java:1477
         int oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(oracle.jdbc.dbaccess.DBStatement, byte, byte[], oracle.jdbc.dbaccess.DBDataSet, int, oracle.jdbc.dbaccess.DBDataSet, int)
              TTC7Protocol.java:888
         void oracle.jdbc.driver.OracleStatement.executeNonQuery(boolean)
              OracleStatement.java:2004
         void oracle.jdbc.driver.OracleStatement.doExecuteOther(boolean)
              OracleStatement.java:1924
         void oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout()
              OracleStatement.java:2562
         int oracle.jdbc.driver.OraclePreparedStatement.executeUpdate()
              OraclePreparedStatement.java:452
         boolean oracle.jdbc.driver.OraclePreparedStatement.execute()
              OraclePreparedStatement.java:526
         void oracle.jbo.pcoll.OraclePersistManager.insert(long, long, int, oracle.jbo.pcoll.PCollKeyInfo[], byte[])
              OraclePersistManager.java:1593
         boolean oracle.jbo.pcoll.PCollNode.passivateElem(oracle.jbo.pcoll.PCollPersistable, oracle.jbo.pcoll.PCollNode, oracle.jbo.pcoll.PCollection, long)
              PCollNode.java:543
         boolean oracle.jbo.pcoll.PCollNode.passivate()
              PCollNode.java:674
         boolean oracle.jbo.pcoll.PCollNode.passivateBranch()
              PCollNode.java:617
         long oracle.jbo.pcoll.PCollection.passivate()
              PCollection.java:429
         int oracle.jbo.server.DBSerializer.passivateRootAM(int, byte[])
              DBSerializer.java:256
         int oracle.jbo.server.DBSerializer.passivateRootAM(byte[])
              DBSerializer.java:239
         int oracle.jbo.server.ApplicationModuleImpl.passivateState(byte[])
              ApplicationModuleImpl.java:3848
         void oracle.jbo.common.ampool.ApplicationPoolImpl.doFailover(oracle.jbo.ApplicationModule, oracle.jbo.common.ampool.SessionCookie, boolean)
              ApplicationPoolImpl.java:2423
         void oracle.jbo.common.ampool.ApplicationPoolImpl.doFailover(oracle.jbo.ApplicationModule, oracle.jbo.common.ampool.SessionCookie)
              ApplicationPoolImpl.java:2375
         void oracle.jbo.common.ampool.ApplicationPoolImpl.doManagedCheckin(oracle.jbo.common.ampool.SessionCookie, boolean)
              ApplicationPoolImpl.java:1657
         void oracle.jbo.common.ampool.ApplicationPoolImpl.releaseApplicationModule(oracle.jbo.common.ampool.SessionCookie, int)
              ApplicationPoolImpl.java:1031
         void oracle.jbo.common.ampool.SessionCookieImpl.releaseApplicationModule(int, long)
              SessionCookieImpl.java:576
         void oracle.jbo.http.HttpSessionCookieImpl.releaseApplicationModule(int, long)
              HttpSessionCookieImpl.java:216
         void oracle.jbo.common.ampool.SessionCookieImpl.releaseApplicationModule(boolean, boolean, long)
              SessionCookieImpl.java:524
         void oracle.jbo.common.ampool.SessionCookieImpl.releaseApplicationModule(boolean, boolean)
              SessionCookieImpl.java:506
         void oracle.cabo.data.jbo.servlet.RootAppModuleRegistryImpl$ReleaseRootAppModule.unbindValue()
         void oracle.cabo.share.util.BindableNamespaceMap.unbindAll()
         void oracle.cabo.servlet.BaseBajaContext.dispose()
         oracle.cabo.servlet.Page oracle.cabo.servlet.PageBrokerHandler.handleRequest(oracle.cabo.servlet.BajaContext)
         void oracle.cabo.servlet.UIXServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void oracle.cabo.servlet.UIXServlet.doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
              HttpServlet.java:760
         void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
              HttpServlet.java:853
         void com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.invoke(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
              ServletRequestDispatcher.java:721
         void com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.forwardInternal(javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse)
              ServletRequestDispatcher.java:306
         boolean com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.processRequest(com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.ApplicationServerThread, com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.EvermindHttpServletRequest, com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
              HttpRequestHandler.java:767
         void com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.run(java.lang.Thread)
              HttpRequestHandler.java:259
         void com.evermind[Oracle9iAS (9.0.3.0.0) Containers for J2EE].server.http.HttpRequestHandler.run()
              HttpRequestHandler.java:106
         void EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run()
              PooledExecutor.java:803
         void java.lang.Thread.run()
              Thread.java:484

    The error itself is a BC4J question you should post on the jdev forum. If you want to shield users from seeing these you can use the try and displayException beans.

  • How to get the Interface inserted rows fom ODI Reporsitory

    hi,
    I need select query that will select the Interface inserted rows
    (Count) from ODI repository tables. because I want to maintain these records into another Oracle tables?????

    import datetime
    import sys
    import optparse
    document = []
    def docprint(string):
    document.append('%s' % string)n
    def docprintnocr(string):
    document.append('%s' % string)
    p = optparse.OptionParser()
    p.add_option('-a','--server',dest='server',default='XXX',help='The server with the ODI_W catalog')
    p.add_option('-b','--beginningday',dest='beginningday',type=int,default=1,help='The day to begin retrieval')
    p.add_option('-e','--endingday',dest='endingday',type=int,default=0,help='The day to end retrieval')
    p.add_option('-n','--session',dest='session',default='',help='Session to retrieve')
    p.add_option('-s','--step',dest='step',action='store_true',help='Print the step data')
    p.add_option('-t','--task',dest='task',action='store_true',help='Print the task data')
    p.add_option('-x','--recipientlist',dest='recipientlist',default='XXX',help='report recipient(s)')
    p.add_option('-y','--mailserver',dest='mailserver',default='XXX',help='mail server')
    p.add_option('-z','--mailuser',dest='mailuser',default='XXX',help='mail user')
    p.add_option('-p','--printonly',dest='printonly',action='store_true',help='Print, no e-mail')
    options,args = p.parse_args()
    docprint( '%s %s' \
    '\n\tserver=%s' \
    '\n\tbeginningday=%s' \
    '\n\tendingday=%s' \
    '\n\tsession=%s' \
    '\n\tstep=%s' \
    '\n\ttask=%s' \
    '\n\tprintonly=%s'
    sys.argv[0]
    ,datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
    ,options.server
    ,options.beginningday
    ,options.endingday
    ,options.session
    ,options.step
    ,options.task
    ,options.printonly
    if options.server.upper() in ('XXX','YYY'):
    catalog = 'ODI_W'
    elif options.server in ('WWW','ZZZ'):
    catalog = 'SNP_W'
    else:
    print 'Unknown server %s' % options.server
    sys.exit(1)
    TimeEnd = datetime.datetime.now() - datetime.timedelta(options.endingday)
    TimeBegin = datetime.datetime.now() - datetime.timedelta(options.beginningday)
    TimeFormat = '%Y-%m-%d %H:%M:%S'
    if options.task:
    options.step = True
    docprint( '\n%s between %s and %s' %(
    options.server
    ,TimeBegin.strftime(TimeFormat)
    ,TimeEnd.strftime(TimeFormat)
    OptionString = ''
    if options.session:
    OptionString = '\nPrinting session %s' % options.session
    else:
    OptionString = '\nPrinting all sessions'
    if options.step:
    OptionString = '%s %s' % (OptionString,'with step detail')
    if options.task:
    OptionString = '%s %s' % (OptionString, 'and task detail')
    docprint(OptionString)
    import pyodbc
    ConnectString = 'DRIVER={SQL SERVER};SERVER=%s;DATABASE=%s;Trusted_Connection=yes' % (options.server.upper(),catalog)
    try:
    Connection = pyodbc.connect(ConnectString,autocommit=False)
    Cursor = Connection.cursor()
    except Exception, e:
    raise RuntimeError, '%s %s connect failed\n%s' % (options.server,catalog,e)
    SelectSession = """
    select
    S.SESS_NO
    ,S.SESS_NAME
    ,S.SESS_BEG
    ,S.SESS_END
    ,coalesce(S.SESS_DUR,0)
    ,S.SESS_STATUS
    ,S.CONTEXT_CODE
    from SNP_SESSION as S
    where S.SESS_BEG between ? and ?
    and S.SESS_BEG = (
    select max(SESS_BEG)
    from SNP_SESSION
    where SESS_NAME = S.SESS_NAME)
    order by S.SESS_BEG ASC
    SelectSessionHistory = """
    select Top 3
    SESS_NO
    ,SESS_NAME
    ,SESS_BEG
    ,SESS_END
    ,coalesce(SESS_DUR,0)
    ,SESS_STATUS
    ,CONTEXT_CODE
    from SNP_SESSION
    where SESS_NAME = ?
    and SESS_NO <> ?
    order by SESS_BEG DESC
    SESS_NO = 0
    SESS_NAME = 1
    SESS_BEG = 2
    SESS_END = 3
    SESS_DUR = 4
    SESS_STATUS = 5
    CONTEXT_CODE = 6
    SelectStep = """
    select
    LOG.STEP_BEG
    ,LOG.STEP_END
    ,coalesce(LOG.STEP_DUR,0)
    ,LOG.STEP_STATUS
    ,coalesce(LOG.NB_ROW,0)
    ,coalesce(LOG.NB_INS,0)
    ,coalesce(LOG.NB_UPD,0)
    ,coalesce(LOG.NB_DEL,0)
    ,coalesce(LOG.NB_ERR,0)
    ,STEP.STEP_NAME
    ,STEP.NNO
    from SNP_STEP_LOG LOG
    inner join SNP_SESS_STEP STEP
    on STEP.SESS_NO = LOG.SESS_NO
    and STEP.NNO = LOG.NNO
    WHERE LOG.SESS_NO = ?
    ORDER BY STEP.NNO
    STEP_BEG = 0
    STEP_END = 1
    STEP_DUR = 2
    STEP_STATUS = 3
    NB_ROW = 4
    NB_INS = 5
    NB_UPD = 6
    NB_DEL = 7
    NB_ERR = 8
    STEP_NAME = 9
    STEP_NO = 10
    SelectTask = """
    select
    LOG.TASK_BEG
    ,LOG.TASK_END
    ,coalesce(LOG.TASK_DUR,0)
    ,LOG.TASK_STATUS
    ,coalesce(LOG.NB_ROW,0)
    ,coalesce(LOG.NB_INS,0)
    ,coalesce(LOG.NB_UPD,0)
    ,coalesce(LOG.NB_DEL,0)
    ,coalesce(LOG.NB_ERR,0)
    ,TASK.TASK_NAME3
    from SNP_SESS_TASK_LOG LOG
    inner join SNP_SESS_TASK TASK
    on TASK.SESS_NO = LOG.SESS_NO
    and TASK.NNO = LOG.NNO
    and TASK.SCEN_TASK_NO = LOG.SCEN_TASK_NO
    WHERE LOG.SESS_NO = ?
    AND LOG.NNO = ?
    ORDER BY LOG.SCEN_TASK_NO
    TASK_BEG = 0
    TASK_END = 1
    TASK_DUR = 2
    TASK_STATUS = 3
    TASK_ROW = 4
    TASK_INS = 5
    TASK_UPD = 6
    TASK_DEL = 7
    TASK_ERR = 8
    TASK_NAME = 9
    SessionStatuses = {'M':'Warning','E':'Err','D':'Done','R':'Run'}
    StepStatuses = {'M':'Warn','E':'Err','D':'Done','W':'Wait','R':'Run'}
    SessionRows =Cursor.execute(SelectSession,(TimeBegin,TimeEnd)).fetchall()
    for SessionRow in SessionRows:
    if options.session and options.session.upper() != SessionRow[SESS_NAME].upper():
    # Not requested
    continue
    if SessionRow[SESS_NAME] in ('SOCKETSERVER','PROCESSHUB'):
    # Skip these utilities
    continue
    if SessionRow[SESS_STATUS] == 'R':
    # Still running, nothing to print(
    docprint( '\n%s, status %s' % (
    SessionRow[SESS_NAME]
    ,SessionStatuses[SessionRow[SESS_STATUS]]
    continue
    if SessionRow[SESS_END]:
    SessionEnd = SessionRow[SESS_END].strftime(TimeFormat)
    else:
    SessionEnd = ' '
    SessionHistories = Cursor.execute(SelectSessionHistory,(SessionRow[SESS_NAME],SessionRow[SESS_NO])).fetchall()
    docprintnocr( '\n%-20s\n\t%s / %s %6i secs %s' % (
    SessionRow[SESS_NAME][:20]
    ,SessionRow[SESS_BEG].strftime(TimeFormat)
    ,SessionEnd
    ,SessionRow[SESS_DUR]
    ,SessionStatuses[SessionRow[SESS_STATUS]]
    for SessionHistory in SessionHistories:
    if SessionHistory[SESS_END]:
    SessionHistoryEnd = SessionHistory[SESS_END].strftime(TimeFormat)
    else:
    SessionHistoryEnd = ' '
    docprintnocr( '\t%s / %s %6i secs %s' % (
    SessionHistory[SESS_BEG].strftime(TimeFormat)
    ,SessionHistoryEnd
    ,SessionHistory[SESS_DUR]
    ,SessionStatuses[SessionHistory[SESS_STATUS]]
    if not options.step:
    # Step detail not requested
    continue
    docprint( '\n %-22s %5s %4s %8s %8s %8s %8s %8s' % (
    ,'Secs'
    ,'Stat'
    ,'Rows'
    ,'Inserts'
    ,'Updates'
    ,'Deletes'
    ,'Errors'
    for StepRow in Cursor.execute(SelectStep,SessionRow[SESS_NO]).fetchall():
    try:
    docprint( ' %-22s %5i %-4s %8i %8i %8i %8i %8i' % (
    StepRow[STEP_NAME][:22]
    ,StepRow[STEP_DUR]
    ,StepStatuses[StepRow[STEP_STATUS]]
    ,StepRow[NB_ROW]
    ,StepRow[NB_INS]
    ,StepRow[NB_UPD]
    ,StepRow[NB_DEL]
    ,StepRow[NB_ERR]))
    except Exception, e:
    docprint(e)
    continue
    if not options.task:
    # Task detail not requested
    continue
    try:
    for TaskRow in Cursor.execute(SelectTask,(SessionRow[SESS_NO],StepRow[STEP_NO])).fetchall():
    docprint( ' %-21s %5i %-4s %8i %8i %8i %8i %8i' % (
    TaskRow[TASK_NAME][:21]
    ,TaskRow[TASK_DUR]
    ,TaskRow[TASK_STATUS]
    ,TaskRow[TASK_ROW]
    ,TaskRow[TASK_INS]
    ,TaskRow[TASK_UPD]
    ,TaskRow[TASK_DEL]
    ,TaskRow[TASK_ERR]
    except Exception, e:
    docprint( e )
    docprint( '\nEnd of report')
    Connection.close()
    if options.printonly:
    for line in document:
    print line
    sys.exit(0)
    import smtplib
    Message = """From: %s
    To: %s
    MIME-Version: 1.0
    Content-type: text/html
    Subject: %s
    <font face="courier" size="4"><b>%s</b></font>
    options.mailuser
    ,options.recipientlist
    ,'Session Report'
    ,'<br>'.join(document).replace('\n','<br>').replace('\t',' ').replace(' ',' ')
    server = smtplib.SMTP(options.mailserver)
    server.sendmail(options.mailuser,options.recipientlist,Message)
    server.quit()

  • Limit Inserted rows

    Hello,
    i need/want a SQL in my ETL-Process (building a DWH) that find data sets in the fact table which have no reference to the dimension table. These incorrect data sets should be inserted in an error table.
    insert into ERROR_TABLE
    SELECT distinct(f.JA) FROM STAGE.FAKT f WHERE NOT Exists (SELECT d.JA FROM TD_YEARS d WHERE  d.JA = f.JA);To improve the performance of the ETL-Job i want to limit the rows that are inserted in the ERROR_TABLE!!!
    With ROWNUM i can only limit the rows in the select-statement - can´t i?
    I want something like that:
    insert *100 ROWS* into ERROR_TABLE
    SELECT distinct(f.JA) FROM STAGE.FAKT f WHERE NOT Exists (SELECT d.JA FROM TD_YEARS d WHERE  d.JA = f.JA);The fact-table has 100.000.000 rows!
    The target should be, that if the database find in the first 250 rows of the fact-table 100 incorrect rows the SQL should be stopped!
    Otherwise all 100.000.000 rows are read - although i only need 100 rows.
    Is this possible? I don´t think so - or?
    Best regards and a happy new year:)
    Heidi

    >
    I think in all your examples ALL rows in the fact table are read and after that the result is limited.
    Or am i wrong?
    >
    Yes and No.
    For simple queries all of the rows do not need to be read.
    You can test this easily yourself by getting an execution plan for a simple query on a large table.
    SELECT * FROM myLargeTable WHERE ROWNUM < 10;That is pretty similar to asking someone in a library to go back to the stacks and bring me the first 10 books you find. Clearly they won't have to look at every book.
    On the hand consider a query like one of those suggested (based on the query you provide)
    .i.e. select * from (
    SELECT distinct(f.JA) FROM STAGE.FAKT f WHERE NOT Exists (SELECT d.JA FROM TD_YEARS d WHERE d.JA = f.JA);
    where rownum<=100;You are asking Oracle for 100 of the DISTINCT rows. Oracle cannot know that a row is DISTINCT (that is, does not have a duplicate) unless it examines ALL of the rows. The very last row might be a duplicate.
    That is like asking that same someone in a library to go back to the stacks and bring you just 100 books by authors that have only written ONE book. They find the first book by author 'BERNARD' and now the problem is to know whether there are any other books in the entire library written by 'BERNARD'.
    There are only two ways to determine that: 1) examine every book or 2) use an index (card catalog).
    If there is an appropriate index available it can be used to identify DISTINCT authors and find 100 books. If not, then yes, every book (row) has to be examined.
    For your use case if there is no appropriate index available then Oracle has to read every row and then either sort the data in order or use a hash in order to identify distinct rows. Only then can it return the first 100 distinct rows.
    In spite of that using ROWNUM or the FIRST_ROWS hint is still the best way to limit the results.
    If you set the timing on

  • Insert Rows Above in Form

    Hello all,
    I'm trying to allow users to insert rows on a form in such away that the added row renders in the middle of the form. Probably having a check box on each row saying 'insert row above'.
    The purpose is to emulate editing a table in a word processor basically. I understand I'd have to manage re-sequencing the data as the user changes records that appear in the 'middle' of the table.
    I've seen D Kubicek's 'row mover' page and it's a good fallback, however I'd be interested as to whether what I want is really simple or will involve a lot of js and / or Ajax.
    Cheers,
    Toby
    ================================================
    Eg
    Before
    Sequence Data Chkbox ("insert above")
    ======================
    ID1 Value1 []
    ID2 Value2 []
    ID3 Value3 [x]
    After
    Sequence Data Chkbox
    ======================
    ID1 Value1 []
    ID2 Value2 []
    (null) (null) []
    ID3 Value3 []

    See this example on that issue if your tabular form is standard:
    http://apex.oracle.com/pls/otn/f?p=31517:209
    This example again, if it is a manual one:
    http://apex.oracle.com/pls/otn/f?p=31517:170
    As Andy suggested, the order in the SQL, nulls first would do the job. However, if sorting is enabled, there is a problem.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Insert rows-failed

    Hi,
    Im using Oracle database 10g. Im in chap04 p.107. Im trying to insert a new row to the parts table. Here are the following statements and the result.
    DECLARE
    l_newId INTEGER := 6;
    l_newDesc VARCHAR2(250) := 'Mouse';
    BEGIN
    INSERT INTO parts
    (id, description, unitprice, onhand, reorder)
    VALUES ( l_newId, l_newDesc, 49, 1200, 500);
    END;
    Results      Explain      Describe      Saved SQL      History      
    1 row(s) inserted.
    0.32 seconds
    It says there that I was able to insert one row but when I tried to check it, its not there in the parts table. Here is my query and the result.
    select * from parts;
    ID     DESCRIPTION     UNITPRICE     ONHAND     REORDER
    1     Fax Machine     299     277     50
    2     Copy Machine     4895     143     25
    3     Laptop PC     2100     7631     1000
    4     Desktop PC     1200     5903     1000
    5     Scanner     99     490     200
    5 rows returned in 0.07 seconds     
    The new inserted row is still not in the table.
    What do I do to really insert this newId in the parts table? I need some help pls. I will be patiently waiting for some answers. Thank you very much.
    lyn

    Hi,
    Thank you so much for your reply. Its working right now.
    Happy New year. Thank you once again.
    Godbless,
    lyn

Maybe you are looking for

  • How to register new macbook air

    please help me how to do register.i call many time singapore apple support communities is no answer.i don't know how to do.

  • IPod classic is locked and wants a combination. Never set one. How do I unlock?

    iPod classic is locked and wants a combination. Never set one. How do I unlock?

  • Checking when a database was last modified

    Hi everyone, I've got an sql database with a few tables in it which are tied to a web service I have running. Thing is, when I invoke my web service (through a browser window), which is fine, the web service updates the database every time, even if t

  • Remove password for development mode

    Is there a way to be in development mode and not have password set up? Z10 is my primary phone, and it annoys me that I MUST have password on whenever I am in development mode. Can I be in dev mode without a password? It would make my life a bit easi

  • Batch Determination during delivery

    Hi All While doing delivery for STO, system is giving a message  "Batch determination is not possible because there is no search procedure" But Batch determination is happening fine for all movements  except STO Delivery. is there any other settings