SQL API. Database corrupted when inserting data?

Hi, I have a working sqlite application I was going to migrate to BerkeleyDB to try and solve some locking issues. However I am having some trouble creating the database.
I downloaded the windows pre-built binaries and created my schema with dbsql.exe. The DDL worked fine and running db_verify reported no errors. However after I inserted about twenty rows of data using a SQL script of INSERT commands db_verify reported about ten "out-of-order key" messages. There are no INSERT triggers in the DDL. I tried running the INSERTs as single commands, and the out-of-order key messages appeared after about ten rows of data. A bit of googling only revealed that these errors often occur when using tools linked to different BerkelyDB versions. I have never had any version of BerkeleyDB installed before.
I then downloaded the BerkeleyDB source and built the binaries myself. I again created the schema - no problems, inserted about twenty rows - errors the same as before. When running db_recover the error messages are as below:
C:\Program Files (x86)\Oracle\Berkeley DB 11gR2 5.1.25\bin\SFTPVT.BDB-journal>..\db_recover.exe
db_recover.exe: Ignoring log file: log.0000000001: magic number 1563f1a3, not 40988
db_recover.exe: Invalid log file: log.0000000001: Invalid argument
db_recover.exe: PANIC: Invalid argument
db_recover.exe: process-private: unable to find environment
db_recover.exe: DB_ENV->open: DB_RUNRECOVERY: Fatal error, run database recovery
I thought the issues might be because I use encrypted database but the same things happen whether I use PRAGMA key="****************" in my scripts or not. I haven't played with DB_CONFIG - should I be creating a DB_CONFIG yet?
I'm using Win 7 pro (x64), i5 processor with 8GB RAM, disks are a RAID10 array formatted as NTFS. Same errors occur if I try to create the database on a FAT32 USB key so it's probably not a filesystem problem. I used Visual Studio 10 and MSVCRT version 10 when building binaries myself. I notice the downloaded binaries were built against MVCRT version 8, so the problem doesn't look tied to the version of the VC runtime as it occurs on multiple versions.
Can anybody help please? I would like to try BerkeleyDB but can't get past the first hurdle.
Edited by: 856299 on 03-May-2011 10:46

Hello,
If you can provide a small stand-alone program to reproduce the problem along with the steps to reproduce it, I will give it a try.
Thank you,
Sandra

Similar Messages

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

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

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

  • SAP query error - 1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting date and/or time from character string.  'Received Alerts' (OAIB)

    SAP query error - 1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting date and/or time from character string.  'Received Alerts' (OAIB)
    SELECT    
    CASE WHEN T0.DocStatus = 'O' THEN 'OPEN'
    WHEN T0.DocStatus = 'C' THEN 'CLOSED'  END  AS 'Document Status',
    T0.DocDate AS 'Posting Date',
    T0.DocNum AS 'Doc.No',
    T0.NumAtCard,
    T0.TransId AS 'Trans. No.',
    T0.Comments AS 'Remarks',
    T0.CardCode AS 'Offset Acct',
    T0.CardName AS 'Offset Acct Name',
    sum(T0.DocTotal) + (T0.WTSum) as 'DocTotal',
    T3.DueDate AS 'Cheque Date',
    T3.CheckSum AS 'Amount'
    FROM         ODPO AS T0 LEFT OUTER JOIN
                          VPM2 AS T1 ON T0.ObjType = T1.InvType AND T0.DocEntry = T1.DocEntry LEFT OUTER JOIN
         OVPM AS T2 ON T2.DocEntry = T1.DocNum LEFT OUTER JOIN
                          VPM1 AS T3 ON T2.DocEntry = T3.DocNum
    where T0.DocDate>='[%0]' and T0.DocDate<='[%1]'

    Hi,
    Try this:
    SELECT   
    CASE WHEN T0.DocStatus = 'O' THEN 'OPEN'
    WHEN T0.DocStatus = 'C' THEN 'CLOSED'  END  AS 'Document Status',
    T0.DocDate AS 'Posting Date',
    T0.DocNum AS 'Doc.No',
    T0.NumAtCard,
    T0.TransId AS 'Trans. No.',
    T0.Comments AS 'Remarks',
    T0.CardCode AS 'Offset Acct',
    T0.CardName AS 'Offset Acct Name',
    sum(T0.DocTotal) + (T0.WTSum) as 'DocTotal',
    T3.DueDate AS 'Cheque Date',
    T3.CheckSum AS 'Amount'
    FROM         ODPO  T0 LEFT OUTER JOIN
                          VPM2  T1 ON T0.ObjType = T1.InvType AND T0.DocEntry = T1.DocEntry
    LEFT OUTER JOIN
         OVPM  T2 ON T2.DocEntry = T1.DocNum LEFT OUTER JOIN
                          VPM1  T3 ON T2.DocEntry = T3.DocNum
    where T0.DocDate >= '[%0]' and T0.DocDate <='[%1]'
    group by T0.DocStatus,T0.DocDate ,
    T0.DocNum ,
    T0.NumAtCard,
    T0.TransId ,
    T0.Comments ,
    T0.CardCode,
    T0.CardName ,
    T0.WTSum ,
    T3.DueDate ,
    T3.CheckSum
    Thanks & Regards,
    Nagarajan

  • Data corruption when inserting xml to database

    Hi,
    I have discovered that some data get changed when I try to insert them into the database.
    It seems that at a certain point, there is a buffer somewhere that runs full, and then some data get missing, and get replaced by other (so that some data are duplicate, while some are missing).
    I get no error messages from the script indicating that anything is wrong.
    Anyone who have an idea of where changes need to be made to the script??
    thanks in advance,
    Reidun
    I use the following script:
    import oracle.xml.sql.dml.*;
    import java.sql.*;
    import oracle.jdbc.driver.*;
    import oracle.jdbc.*;
    import java.net.*;
    public class test_java
    public static void main(String args[])
    if (args.length != 5)
    System.out.println("Usage: test_java <xml_directory> <table_name> <username> <passwd> <database>");
    System.exit(-1);
    String dirName = args[0];          // path to xml file
    String tabName = args[1];          // table into which to insert
    String fileName = dirName + "/" + tabName + ".xml";     // file name containing the xml doc
    System.out.println("Read from " + fileName);
    System.out.println("Insert into table " + tabName);
    String s_username = args[2];
    String s_passwd = args[3];
    String s_db = args[4];
    String s_connect = "jdbc:oracle:oci8:" + s_username + "/" + s_passwd + "@" + s_db;
    System.out.println("Connect: " + s_connect);
    try {
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn =
    DriverManager.getConnection(s_connect);
    OracleXMLSave sav = new OracleXMLSave(conn, tabName);
    sav.setDateFormat("yyyy-MM-dd HH:mm:ss");
    sav.setIgnoreCase(true);
    sav.setRowTag(tabName);
    System.out.println("createURL...");
    URL url = sav.createURL(fileName);
    System.out.println("URL = " + url);
    int rowCount = sav.insertXML(url);
    sav.close();
    System.out.println(" successfully inserted "+rowCount+
              " rows into "+ tabName);
    conn.close();
    catch (Exception e) {
    System.out.println("Error: " + e.toString());
    System.out.println("Aborting XML import for " + tabName);     

    Try setting the batch size to 1 ( ie oracleXMLSave().setBatchSize(1);)
    The batch size defaults to 17 and sometimes this might cause similar behavior. It wonder if there is a bug already reported on this.
    Alex

  • SQL 2012 database behaves differently with a unique index and ignore_dup_key = on when inserting data. It works on SQL 2008 db

    If you have a table with a unique index and ignore_dup_key = on and you INSERT rows into that table with an ORDER BY clause (because you want to control which of the duplicate
    key rows gets inserted),  the wrong row gets inserted in SQL2012.  It works correctly in SQL 2008.
    We have recently migrated  a database from SQL 2008 to SQL 2012.  We do have few other dbs which are in compatability mode 100.  The above operation works fine
    in SQL 2008 dbs but not SQL 2012.
    I've even tried applying the latest patch for SQL 2012 SP2 with CU2. Still the problem exists.  I'm going to call MS support, but want to know if anyone has come across this problem ?

    The MS documentation doesn't guarantee that the first row of the duplicates will always be inserted and the next duplicate row(s) get(s) ignored. Where did you find it in the MS documentation? I think you were just lucky that it was always inserting the
    first row in SQL 2008 (and ignoring the rest of the duplicates) - I don't think this is guaranteed
    Satish Kartan http://www.sqlfood.com/

  • Best Practice for ViewObjects when inserting data through pl/sql procedure

    My applications is oracle form based enterprise level application and we are now developing new module in ADF 11g but there is restriction that all data insertion, updation, and deletion will be through oracle pl/sql procedures. Now my question is that adf pages should be binded with ViewObjects based on Entity Object or with Viewobjects not based on Entity / sql query. Currently I have developed pages with programmatic ViewObjects which are neither based on Entity Objects nor on sql query. In those view objects, i create transient attributes and then used it to create adf pages. Then on save, i extract the data from ViewObject's current row and pass it to procedure. This is working fine but just wondering whether this approach is ok or there is better alternative for that. Ideally i want to create ViewObjects based on EntityObject but don't finding any way to synchronize entityObjects with data inserted through procedures.

    Hi,
    I create a EO for the Database-View and override the doDML()-Method. For insert/update and delete I call the pl/sql-functions.
    See "38.5 Basing an Entity Object on a PL/SQL Package API" in Oracle® Fusion Middleware Fusion Developer's Guide for Oracle Application Development
    Framework.

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

  • Problem using a SQL database Catalogue to insert data to a table

    I am developing with Version:
    10.3.1.0, Build: #99765....
    as part of a step in my process I need to store some data in an audit table.
    I have setup the SQL Catalogue entry and then use the following code:
    sentMail is defined as a local variable
    sentMail = RSPCA.Resources.RSPCA.R_SENTEMAIL()
    sentMail.sentemailBody = sendInternalRequest.htmlbody
    sentMail.sentemailDatesent = Fuego.Lang.Time
    sentMail.sentemailSubject = subject
    sentMail.sentemailTo = creation.participant.email
    sentMail.sentemailType = "People"
    store sentMail
    This works if I comment out this line:
    sentMail.sentemailBody = sendInternalRequest.htmlbody
    The issue I'm having maybe something to do with the size of the data, in oracle the field is a varchar2(4000) and it looks like the catalogue treats it as a String(4000), if I make sure I only put around 1500 characters in the field it works, but as soon as I put all in from my test data (about 2300) it fails with this message:
    The method 'CIL_sendToHQ' from class 'EstablishmentManagement.EMMaintainPeopleProcess.Default_1_0.Instance' could not be successfully executed.
    Caused by: [BEA][Oracle JDBC Driver][Oracle]ORA-01461: can bind a LONG value only for insert into a LONG column
    Caused by: [BEA][Oracle JDBC Driver][Oracle]ORA-01461: can bind a LONG value only for insert into a LONG column
    fuego.lang.ComponentExecutionException: The method 'CIL_sendToHQ' from class 'EstablishmentManagement.EMMaintainPeopleProcess.Default_1_0.Instance' could not be successfully executed.
         at fuego.component.ExecutionThreadContext.invokeMethod(ExecutionThreadContext.java:519)
         at fuego.component.ExecutionThreadContext.invokeMethod(ExecutionThreadContext.java:273)
         at fuego.fengine.FEEngineExecutionContext.invokeMethodAsCil(FEEngineExecutionContext.java:219)
         at fuego.server.execution.EngineExecutionContext.runCil(EngineExecutionContext.java:1278)
         at fuego.server.execution.microactivity.ComponentExecutionMicroActivity.runCil(ComponentExecutionMicroActivity.java:126)
         at fuego.server.execution.microactivity.ComponentExecutionMicroActivity.execute(ComponentExecutionMicroActivity.java:84)
         at fuego.server.execution.microactivity.MicroActivityEngineExecutionHandler.executeActivity(MicroActivityEngineExecutionHandler.java:57)
         at fuego.server.execution.ImmediateActivity.execute(ImmediateActivity.java:42)
         at fuego.server.execution.DefaultEngineExecution$AtomicExecutionTA.runTransaction(DefaultEngineExecution.java:304)
         at fuego.transaction.TransactionAction.startBaseTransaction(TransactionAction.java:470)
         at fuego.transaction.TransactionAction.startTransaction(TransactionAction.java:551)
         at fuego.transaction.TransactionAction.start(TransactionAction.java:212)
         at fuego.server.execution.DefaultEngineExecution.executeImmediate(DefaultEngineExecution.java:123)
         at fuego.server.execution.DefaultEngineExecution.executeAutomaticWork(DefaultEngineExecution.java:62)
         at fuego.server.execution.EngineExecution.executeAutomaticWork(EngineExecution.java:42)
         at fuego.server.execution.ToDoItem.executeAutomaticWork(ToDoItem.java:251)
         at fuego.server.execution.ToDoItem.run(ToDoItem.java:536)
         at fuego.component.ExecutionThread.processMessage(ExecutionThread.java:775)
         at fuego.component.ExecutionThread.processBatch(ExecutionThread.java:755)
         at fuego.component.ExecutionThread.doProcessBatch(ExecutionThread.java:142)
         at fuego.component.ExecutionThread.doProcessBatch(ExecutionThread.java:134)
         at fuego.fengine.ToDoQueueThread$PrincipalWrapper.processBatch(ToDoQueueThread.java:450)
         at fuego.component.ExecutionThread.work(ExecutionThread.java:839)
         at fuego.component.ExecutionThread.run(ExecutionThread.java:408)
    Caused by: fuego.components.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-01461: can bind a LONG value only for insert into a LONG column
         at fuego.sql.TableSQLObject.implicitStore(TableSQLObject.java:409)
         at fuego.sql.TableSQLObject.store(TableSQLObject.java:340)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at fuego.lang.JavaClass.invokeMethod(JavaClass.java:1410)
         at fuego.sql.SQLObject.invoke(SQLObject.java:364)
         at fuego.lang.Invokeable.invokeImpl(Invokeable.java:234)
         at fuego.lang.Invokeable.invokeDynamic(Invokeable.java:188)
         at EstablishmentManagement.EMMaintainPeopleProcess.Default_1_0.Instance.CIL_sendToHQ(Instance.xcdl:100)
         at EstablishmentManagement.EMMaintainPeopleProcess.Default_1_0.Instance.CIL_sendToHQ(Instance.xcdl)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at fuego.component.ExecutionThreadContext.invokeMethod(ExecutionThreadContext.java:512)
         ... 23 more
    Caused by: java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-01461: can bind a LONG value only for insert into a LONG column
         at albpm.jdbc.base.BaseExceptions.createException(Unknown Source)
         at albpm.jdbc.base.BaseExceptions.getException(Unknown Source)
         at albpm.jdbc.oracle.OracleImplStatement.execute(Unknown Source)
         at albpm.jdbc.base.BaseStatement.commonExecute(Unknown Source)
         at albpm.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)
         at albpm.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
         at fuego.jdbc.FaultTolerantPreparedStatement.executeUpdate(FaultTolerantPreparedStatement.java:623)
         at fuego.sql.TableSQLObject.insert(TableSQLObject.java:626)
         at fuego.sql.TableSQLObject.implicitStore(TableSQLObject.java:391)
         ... 39 more
    Edited by: user10778731 on 21-Jan-2010 06:17

    Suspect you're not going to like this answer, but I never use the store() method for a database heir object anymore.
    The store() database method has been broken and then fixed and then broken again on too many release cycles to trust that it will work consistently as MPs/Hotfixes are applied. I'd suspect that your "String(4000)" problem might also be related to using the store() method.
    Others will probably disagree, but only use the OOTB PBL (JDBC) SQL or Dynamic SQL in the PBL logic. In your case, I think you might be best served by using Dynamic SQL. With Dynamic SQL you don't run into the shortcomings of JDBC SQL (String(4000) might be one of them) and you can then test / debug your SQL in your favorite DB tool of choice first (e.g. Toad, Squirrel, Sql Plus). Once successfully tested, you can then paste it back into your PBL.
    Dan

  • Error when inserting data

    when I try to insert some data using XSQL's <insert-request> I get this message:
    Exception 'java.sql.SQLException:Non supported character set: oracle-character-set-170' encountered during processing ROW element 0All prior XML row changes were rolled back. in the XML document.
    my database is using CROATIAN_CROATIA.EE8MSWIN1250
    please tell my why?
    thanks
    null

    source xml
    <?xml version="1.0"?>
    <dokument id="">
    <broj>100006</broj>
    <datum>13.02.2001</datum>
    <partner>
    <par_id>1</par_id>
    <sifra>00001</sifra>
    <naziv>Ritam d.o.o.</naziv>
    </partner>
    <stavka id="">
    <flag>
    </flag>
    <art_id>1</art_id>
    <sifra>00001</sifra>
    <barcode>1234567890123</barcode>
    <naziv>phf
    PHF</naziv>
    <kolicina>2,00</kolicina>
    <cijena>222,00</cijena>
    </stavka>
    <stavka id="">
    <flag>
    </flag>
    <art_id>2</art_id>
    <sifra>00002</sifra>
    <barcode>12345678</barcode>
    <naziv>artikal 1</naziv>
    <kolicina>1,00</kolicina>
    <cijena>111,00</cijena>
    </stavka>
    </dokument>
    insert.xsql
    <?xml version="1.0" encoding="windows-1250" ?>
    <xsql:insert-request xmlns:xsql="urn:oracle-xsql" connection="baza817"
    table="dokument_ov" transform="insert.xsl" date-format="dd.MM.yyyy"/>
    insert.xsl
    <?xml version="1.0" encoding="windows-1250"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" version="1.0"/>
    <xsl:template match="/">
    <rowset>
    <xsl:for-each select="//dokument">
    <row>
    <dok_id><xsl:value-of select="@id"/></dok_id>
    <broj><xsl:value-of select="broj"/></broj>
    <datum><xsl:value-of select="datum"/></datum>
    <partner>
    <par_id><xsl:value-of select="./partner/par_id"/></par_id>
    <sifra><xsl:value-of select="./partner/sifra"/></sifra>
    <naziv><xsl:value-of select="./partner/naziv"/></naziv>
    </partner>
    <stavke>
    <xsl:for-each select="//stavka">
    <stavke_item>
    <kolicina><xsl:value-of select="translate(kolicina,',','.')"/></kolicina>
    <cijena><xsl:value-of select="translate(cijena,',','.')"/></cijena>
    <sta_id><xsl:value-of select="@id"/></sta_id>
    <artikal>
    <art_id><xsl:value-of select="art_id"/></art_id>
    <sifra><xsl:value-of select="sifra"/></sifra>
    <barcode><xsl:value-of select="barcode"/></barcode>
    <naziv><xsl:value-of select="naziv"/></naziv>
    </artikal>
    </stavke_item>
    </xsl:for-each>
    </stavke>
    </row>
    </xsl:for-each>
    </rowset>
    </xsl:template>
    </xsl:stylesheet>
    dokument_ov
    create or replace view dokument_ov as
    select d.dok_id, d.broj, d.datum, partner_ty(p.sifra,p.naziv,p.par_id) partner,
    cast(
    multiset(select s.kolicina, s.cijena, s.sta_id,
    artikal_ty(a.sifra, a.barcode, a.naziv, a.art_id) artikal
    from stavke s, artikli a
    where a.art_id = s.art_id and s.dok_id = d.dok_id order by sta_id) as stavke_ty
    ) stavke
    from dokumenti d, partneri p
    where d.par_id=p.par_id(+)
    order by dok_id
    dokument_ov_ins
    create or replace trigger dokument_ov_ins
    instead of insert on dokument_ov
    for each row
    declare
    m_stavke_t stavke_ty;
    m_stavka_t stavka_ty;
    m_artikal_t artikal_ty;
    m_partner_t partner_ty;
    m_par_id NUMBER;
    m_dok_id NUMBER;
    m_sta_id NUMBER;
    m_art_id NUMBER;
    begin
    if :new.dok_id < 0 then
    delete from stavke where dok_id = abs(:new.dok_id);
    delete from dokumenti where dok_id = abs(:new.dok_id);
    else
    m_partner_t := :new.partner;
    --dokument
    begin
    select dok_id into m_dok_id from dokumenti where dok_id = :new.dok_id;
    update dokumenti set broj = :new.broj, datum = nvl(:new.datum,sysdate), par_id = m_partner_t.par_id
    where dok_id = :new.dok_id;
    exception
    when no_data_found then
    insert into dokumenti(tip, broj, datum, dok_id, par_id)
    values('1', :new.broj, nvl(:new.datum,sysdate), dok_seq.nextval, m_partner_t.par_id)
    returning dok_id into m_dok_id;
    end;
    --stavke
    m_stavke_t := :new.stavke;
    for i in 1..m_stavke_t.count loop
    m_stavka_t := m_stavke_t(i);
    m_artikal_t := m_stavka_t.artikal;
    begin
    if m_stavka_t.sta_id < 0 then
    delete from stavke where sta_id = abs(m_stavka_t.sta_id);
    else
    select sta_id into m_sta_id from stavke where sta_id = m_stavka_t.sta_id and dok_id = m_dok_id;
    update stavke set kolicina = m_stavka_t.kolicina, cijena = m_stavka_t.cijena
    where sta_id = m_stavka_t.sta_id and dok_id = m_dok_id;
    end if;
    exception
    when no_data_found then
    insert into stavke(dok_id, sta_id, kolicina, cijena, art_id)
    values (m_dok_id, sta_seq.nextval, m_stavka_t.kolicina, m_stavka_t.cijena, m_artikal_t.art_id);
    end;
    end loop;
    end if;
    end dokumentview_ins;
    null

  • Error when inserting data .. to check the functionality of a trigger .

    hallo,
    im trying to write a trigger like that :
    CREATE OR REPLACE TRIGGER raum_besetzt
    BEFORE DELETE OR UPDATE OR INSERT ON BUCHUNGEN
    FOR EACH ROW
    DECLARE
    v_p NUMBER;
    v_t NUMBER;
    BEGIN
    SELECT ANzahl_plaetze into v_p
    FROM RAEUME;
    SELECT ANzahl_teilnehmer into v_t
    FROM BUCHUNGEN;
    INSERT INTO BUCHUNGEN VALUES (:NEW.BUCH_ID, :NEW.RAUM_ID, :NEW.MITA_ID, :NEW.VON, :NEW.BIS, :NEW.ANZAHL_TEILNEHMER, :NEW.VART_ID);
    IF (v_t > v_p) THEN RAISE_APPLICATION_ERROR (-20001, ' diesen RAUM ist leer ');
    END IF;
    END;the trigger have to check that all participants will be booked in the room can be accommodated. On error, the reservation is cancel.
    so i implemented it the way that number of participants ( anzahl_teilnehmer ) in the Table Reservations ( Buchungen ) is greater than the number of places ( Anzahl_plaetze ) in the table Rooms ( Raeume )
    so now i want to add some data to the table BUCHUNGEN ( Reservations ), so i can see if the trigger works!
    What i get is the Error below !! :
    Fehler beim Start in Zeile 56 in Befehl:
    INSERT INTO BUCHUNGEN (BUCH_ID, RAUM_ID, MITA_ID, VON, BIS, ANZAHL_TEILNEHMER, VART_ID)
    VALUES                (5, 5, 5, '', '', 30, 3)
    Fehlerbericht:
    SQL-Fehler: ORA-01422: Exakter Abruf gibt mehr als die angeforderte Zeilenzahl zurück
    ORA-06512: in "RAUM_BESETZT", Zeile 5
    ORA-04088: Fehler bei der Ausführung von Trigger 'RAUM_BESETZT'
    01422. 00000 -  "exact fetch returns more than requested number of rows"
    *Cause:    The number specified in exact fetch is less than the rows returned.
    *Action:   Rewrite the query or change number of rows requestedcan anyone help :)
    thank you ..

    Logic such as this should be written in a little api. A trigger is possible, but it might be pretty difficult to implement the full solution in a trigger which has several restrictions. An api usually doesn't have the same technical restrictions (trigger need to prevent endless loops, therefore they will raise an mutating table error if you insert into the same table)
    The main issue is that during the execution of your trigger, another process might add a booking without commiting it yet. But your trigger can't see this new booking from the different session. This has to be solved on a logical level first before solving it on database level. How do you want to handle such a situation?

  • ORA-30931 (again) when inserting data in XMLType table

    Hi,
    I've created a table by registrating an XML Schema in the database.
    The schema is the following :
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xdb:storeVarrayAsTable="true">
         <xsd:element name="Customer" type="customerType" xdb:defaultTable="CUSTOMER"/>
         <xsd:complexType name="customerType" xdb:maintainDOM="false">
              <xsd:sequence>
                   <xsd:element name="NAME" type="xsd:string" xdb:SQLName="NAME" xdb:SQLType="VARCHAR2"/>
                   <xsd:element name="EMAIL" type="xsd:string" xdb:SQLName="EMAIL" xdb:SQLType="VARCHAR2"/>
                   <xsd:element name="ADDRESS" type="xsd:string" maxOccurs="unbounded" xdb:SQLName="ADDRESS" xdb:SQLCollType="ADDRESS_TYPE" xdb:SQLType="VARCHAR2" xdb:maintainOrder="false"/>
                   <xsd:element name="PHONE" type="phoneType" xdb:SQLName="PHONE"/>
                   <xsd:element name="DESCRIPTION" type="contentType"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="contentType" xdb:SQLType="CLOB" xdb:maintainDOM="true">
              <xsd:sequence>
                   <xsd:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
              </xsd:sequence>
         </xsd:complexType>
         <xsd:simpleType name="phoneType">
              <xsd:restriction base="xsd:string">
                   <xsd:pattern value="\\(\\d\{3\}\\)\\d\{3\}-\\d\{4\}"/>
              </xsd:restriction>
         </xsd:simpleType>
    </xsd:schema>
    Now when I try to do an insert in the table and use mixed case in the contents of the description tag I get an ORA-30931.
    Anybody got a clue why?
    Thanks for your help!
    Kris

    Kris
    xsd:any does not allow text() nodes outside of elements, it only allows child elements. If you want to add text() nodes outside of child elements this is mixed text. To get this you want to add mixed="true" to the complexType definition
    contentType
    SQL> begin
    2 dbms_xmlschema.registerSchema('http://localhost:8085/public/customer_simple_ann.xsd',
    3 xmltype('<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracl
    e.com/xdb" xdb:storeVarrayAsTable="true">
    4 <xsd:element name="Customer" type="customerType" xdb:defaultTable="CUSTOMER"/>
    5 <xsd:complexType name="customerType" xdb:maintainDOM="false">
    6 <xsd:sequence>
    7 <xsd:element name="NAME" type="xsd:string" xdb:SQLName="NAME" xdb:SQLType="VARCHAR2"/>
    8 <xsd:element name="EMAIL" type="xsd:string" xdb:SQLName="EMAIL" xdb:SQLType="VARCHAR2"/>
    9 <xsd:element name="ADDRESS" type="xsd:string" maxOccurs="unbounded" xdb:SQLName="ADDRESS" xdb:S
    QLCollType="ADDRESS_TYPE" xdb:SQLType="VARCHAR2" xdb:maintainOrder="false"/>
    10 <xsd:element name="PHONE" type="phoneType" xdb:SQLName="PHONE"/>
    11 <xsd:element name="DESCRIPTION" type="contentType"/>
    12 </xsd:sequence>
    13 </xsd:complexType>
    14 <xsd:complexType mixed="true" name="contentType" xdb:SQLType="CLOB" xdb:maintainDOM="true">
    15 <xsd:sequence>
    16 <xsd:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
    17 </xsd:sequence>
    18 </xsd:complexType>
    19 <xsd:simpleType name="phoneType">
    20 <xsd:restriction base="xsd:string">
    21 <xsd:pattern value="\\(\\d\{3\}\\)\\d\{3\}-\\d\{4\}"/>
    22 </xsd:restriction>
    23 </xsd:simpleType>
    24 </xsd:schema>'));
    25 end;
    26 /
    PL/SQL procedure successfully completed.
    SQL> insert into customer
    2 values (XMLTYPE('<Customer><NAME>Steve Joes</NAME><EMAIL>[email protected]</EMAIL><ADDRESS
    Somewhere, Sometown, RedWood Shores, California</ADDRESS><PHONE>6505678546</PHONE><DESCRIPTION>Hes the man</DESCRIPTION></Customer>').CreateSchemaBasedXML('http://localhost:8085/public/customer_simpl
    e_ann.xsd'))
    3 /
    1 row created.
    SQL>

  • Error Message When Inserting Data Into Table

    Hi,
    I am trying to insert the following value into my customer table, however i get the following error on doing so.
    ERROR: date format picture ends before converting entire input string
    STATEMENT:
    insert into phonecall (start_date_time)
    values(10-JAN-2006 11:53:09)
    any ideas as to what might be wrong with my insert statement to bring up this error ??
    start_date_time is a DATE field by the way.

    Or
    SQL> alter session set nls_date_format='DD-MM-YYYY HH24:MI:SS';
    Session altered.
    SQL> create table aa (test date)
      2  /
    Table created.
    SQL> insert into aa values ('11-12-2006 12:11:22')
      2  /
    1 row created.
    SQL> select * from aa ;
    TEST
    11-12-2006 12:11:22
    SQL>

  • Disk throughput drops when inserting data packages in write-optimized DSO

    Hi all,
    we are currently testing our new freshly installed SAN.
    To see the performance gain in BI, I'm currently doing some test loads.
    And during the monitoring of those loads, I noticed something I'd like someone to explain :-):
    I execute a DTP from PSA to a write-optimized DSO.
    The n° of parallel processes = 9
    Update method = serial extraction, immediate parallel processing
    N° of records transferred: +23.000.000
    Ok, in the first phase (read the PSA) only one process is used (serial extraction).  When I look in OS07, I notice we have very good throughput: +66.000 TransfKB/s. Very nice!
    But as soon as BI starts inserting the data packages, and parallel processing kicks in, the throughput drops to 4K or something, and sometimes we get 20K at max.  That's not too good.
    We have a massive SAN , but the BI system does not seem to use it?
    I was wondering why this is the case.  I already toyed around with the package size, but it's always the same.
    Also I noticed that the allocated processes don't seem to be active.  I allocated 9 BTC processes to this load.
    They are all used, but we only see 3 inserts at the same time, max.  Also in the DTP-monitor, only 3 packages are processed at the same time.  As it's a write-optimized DSO, RSODSO_SETTINGS does not apply I presume.
    Any ideas?
    tnx!

    Hi,
    can you pls try to give some filetr in DTP and try to pull the data.
    I am not sure why first data package is taking long time and otehr data package is taking less time..
    Do you have any start routine..If datapak = 1.. the do this logic..
    Pls check..
    regards
    Gopal

  • How to use sql tag of jstl for inserting data

    hello
    I want to insert the data in to oracle through jsp using standard sql tags of jstl please help me

    1) Go to www.google.com.
    2) Enter in that input field "jstl sql tag tutorial" (assuming you want to learn the JSTL SQL tag library).
    3) Hit that search button.
    4) Explore the results. One of them is http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSTL7.html

  • ORA-14400 error when inserting data in partition

    I have a partiotioned table with 20 columns .. out of 20, I have only one defined as not null..
    So when I tried inserting the data in the column alone am getting the error :
    ORA-14400: inserted partition key does not map to any partition
    this is the structure of the table :
    partition :
    PARTITION BY RANGE (TRANSDATE)
    PARTITION DEC200801 VALUES LESS THAN (TO_DATE(' 2008-12-16 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE CALLST03
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    PARTITION DEC200802 VALUES LESS THAN (TO_DATE(' 2009-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE CALLST03
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    PARTITION JAN200901 VALUES LESS THAN (TO_DATE(' 2009-01-16 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE CALLST03
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    PARTITION JAN200902 VALUES LESS THAN (TO_DATE(' 2009-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE CALLST03
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    PARTITION FEB200901 VALUES LESS THAN (TO_DATE(' 2009-02-14 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE CALLST03
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    PARTITION FEB200902 VALUES LESS THAN (TO_DATE(' 2009-03-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE CALLST03
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    PARTITION MAR200901 VALUES LESS THAN (TO_DATE(' 2009-03-16 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE CALLST03
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    PARTITION MAR200902 VALUES LESS THAN (TO_DATE(' 2009-04-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE CALLST03
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    PARTITION APR200902 VALUES LESS THAN (TO_DATE(' 2009-04-30 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE CALLST03
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    BUFFER_POOL DEFAULT
    What could be the reason ?
    Kai

    From metalink
    Oracle 9i Message~~~~~~~~~~~~~~~~~
    Error:     ORA-14400 (ORA-14400)
    Text:     inserted partition key does not map to any partition
    Cause:     An attempt was made to insert a record into, a Range or Composite
         Range object, with a concatenated partition key that is beyond the
         concatenated partition bound list of the last partition -OR- An
         attempt was made to insert a record into a List object with a
         partition key that did not match the literal values specified for
         any of the partitions.
    Action:     Do not insert the key. Or, add a partition capable of accepting
         the key, Or add values matching the key to a partition
         specification
    >
    So check the date .
    What is your insert statement.
    Anand
    Edited by: Anand... on Mar 4, 2009 5:42 PM

Maybe you are looking for

  • The CustomDatumExample.java only works if the Employee object has 2 attributes.

    The CustomDatumExample.java only works if the Employee object has 2 attributes - (EmpName and EmpNo). If I try to add another attribute to the Employee object I get java.lang.ArrayIndexOutOfBoundsException: 2 on the getAttr3 method. Anyone know why?

  • Latest version will not download.

    There are several of the same version that have downloaded and I see them on this listing. They are doing something but I think never get to where they should be. When I start firefox I get the same old message that I am using an old version and down

  • Routing audio out of logic

    I have just purchased a Korg Monotron and am trying to send sound out from Logic into the Monotron, and then filter the audio in the Monotron and record this back into Logic, however I have a problem. The audio I want to send out of Logic is routed t

  • Integration between ECC and TM

    Hello guys, Please, what I only need to confirm is if considering all the new functionalities in TM 9.1 and the Brazilian taxes, what is the essential EHP? Thank you,

  • Proper method for building kernel modules? [solved]

    I am attempting to build a custom kernel module for a PCI express interface to an FPGA.  However, I seem to be running into some issues with getting the standard kernel module makefile to work correctly.  Here is my makefile: # object files to build