Oracle ODBC error when inserting "end" or "begin"

I think I may have found a bug in the Oracle ODBC driver....
I am using version 8.01.73.00 of the Oracle ODBC driver, and my VB application is trying to insert a record into a table using ADO. All works fine, until the user tries to enter the word "end", or "begin" into any of the text (CLOB) fields. The following code shows how I am doing an insert:
Dim cmd As ADODB.Command
Set cmd = New ADODB.Command
cmd.ActiveConnection = "DSN=Envoy;uid=Envoy;pwd=significance;"
cmd.CommandText = "Insert into Mon_Reading (Creation_User, Creation_Date, Reading_Date, Param_ID, Mon_ID, Value, ApplicableYN, Site_ID, Prev_MEter_Value, MeterResetYN, UOM_ID, LimitsApplicableYN, Lower, Upper, Limit_UOM_ID, ApprovedYN, Comments ) Values ('Matttt', '01-jan-2002', '01-jan-2003', 1, 1, 1., 'Y', 1, 0, 'N', 1, 'N', 0, 0, 0, 'Y', ' end ');"
cmd.CommandType = adCmdText
cmd.Execute , , adExecuteNoRecords
As you can see, the text " end " is being added to the comments field, a CLOB data field. When executed, this causes an Oracle ORA-0911 error (invalid character), and the insert fails.
Heres the weird thing - if you change the word "end" to anything else apart from "begin" - it will work!!! Also, it only fails if you wrap the "end" in spaces?!!?!! Users that reported this were entering comments like "this is the end of June" - this would have caused the error. If you copy teh failed SQL and paste it into SQLPlus, it executes OK.
I can only presume this is an Oracle bug. Anyone else have an ideas? What can I do as a workaround?

First thought would be to grab the updated 8.1.7.x ODBC driver (8.1.7.7 IIRC). Perhaps this problem has already been solved.
Justin

Similar Messages

  • Error when inserting or changing in a sorted table

    Hi Experts,
    When i am executing a webdynpro application it says Error when inserting or changing in a sorted table. Can any one help for this.
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: GET_CATEGORY_LIST of program /1BCWDY/F9XHYWN4WKNMG4CDUGA8==CP
    Method: IF_COMPONENTCONTROLLER~GET_CATEGORY_LIST of program /1BCWDY/F9XHYWN4WKNMG4CDUGA8==CP
    Method: WDDOMODIFYVIEW of program /1BCWDY/F9XHYWN4WKNMG4CDUGA8==CP
    Method: IF_WDR_VIEW_DELEGATE~WD_DO_MODIFY_VIEW of program /1BCWDY/F9XHYWN4WKNMG4CDUGA8==CP
    Method: DO_MODIFY_VIEW of program CL_WDR_DELEGATING_VIEW========CP
    Method: MODIFY_VIEW of program CL_WDR_VIEW===================CP
    Method: DO_MODIFY_VIEW of program CL_WDR_CLIENT_COMPONENT=======CP
    Method: DO_MODIFY_VIEW of program CL_WDR_WINDOW_PHASE_MODEL=====CP
    Method: PROCESS_REQUEST of program CL_WDR_WINDOW_PHASE_MODEL=====CP
    Method: PROCESS_REQUEST of program CL_WDR_WINDOW=================CP
    in ST22
    Object Definition
      DATA: lo_node                   TYPE REF TO if_wd_context_node,
            lo_node_info              TYPE REF TO if_wd_context_node_info,
            lo_element                TYPE REF TO if_wd_context_element.
    Additional Data declarations
      DATA: lv_key TYPE string.
    Get context node.
      lo_node = wd_context->get_child_node( name = 'DROPDOWNLISTS' ).
      lo_node_info = lo_node->get_node_info( ).
    Call method to fetch the categories.
      CALL METHOD cl_hap_wd_start_page_ui=>category_get_list
        EXPORTING
          add_on_application = add_on_application
        IMPORTING
          t_categories       = lt_categories.
    Append Default selection entry 'All'.
      lw_category-category_id = '00000000'.
      lw_category-category_name = 'All'.
      APPEND lw_category TO lt_categories.
    Sort table after appending the new entry.
      SORT lt_categories ASCENDING.
    Loop through the category list and populate key(category_id) value(category_name) pair for
      LOOP AT lt_categories INTO lw_category.
        lw_key_value-key = lw_category-category_id.
      625     lw_key_value-value = lw_category-category_name.
    >>>>>     APPEND lw_key_value TO lt_key_values.------>Here it throws an error
      627     CLEAR: lw_key_value, lw_category.
      628   ENDLOOP.
      629
      630 * Bind the category key-value pair to the context attribute.
      631   CALL METHOD lo_node_info->set_attribute_value_set
      632     EXPORTING
      633       name      = 'CATEGORY_LIST'
      634       value_set = lt_key_values.
      635
      636 * Make the entry 'All' as default selected.
      637   CALL METHOD lo_node->set_attribute
      638     EXPORTING
      639       value = '00000000'
      640       name  = 'CATEGORY_LIST'.
      641
      642 ENDMETHOD.
      643
      644 method GET_EMPLOYEES.
      645

    Hello Durga,
    from the error what I understood is lt_key_values is a sorted table and you are trying append a new line to it. Incase of sorted table you need to use the INSERT statement and not the APPEND statement.
    INSERT lw_key_value INTO table lt_key_values.
    BR, Saravanan

  • Error when inserting Web Dynpro script in Adobe form

    Hi
    In my WD component in one of the view I have an ADOBE form (Online scenario) and a button to save data into backend. In the ADOBE form everything is working properly, however the problem is when I click on the button to save, Its not getting into my action code. Even I am not getting any error other than the wait symbol.
    In the form I have taken ZCI layout but when i'm inserting Webdynpro Script its showing an error 'Error when inserting Web Dynpro script'.
    Please let me know why this error is getting.
    Thanks
    Ram

    Hi Ram,
    I hope  you help me,
    I have the same error, when I insert a web Dynrp Script, what version of SAPGUI do you use?
    Thanks

  • Error when inserting Web Dynpro script

    Hello,
    I am trying to create a new form using fields from KNA1 and am using ISR controls. When I try to insert Webdynpro scripts i get message "Error when inserting Web Dynpro script" Message no. FPUIFB094.
    Has anyone faced this error? no notes are available regarding this and in SDN.
    Regards
    Prasad

    It must be atleast ALD 7.1. Check this [Thread|Re: Problem on Button; having the same issue. Also check the SAPNOTE 962763.

  • " Error when inserting in PSA table RSTSODSPART" when loading into PSA

    Hello,
    Did anyone encounter something similar, and found a solution ?
    BI 7.0 -  EnhP 1 - SP5
    When loading data from R/3 into PSA, we encounter following error message:
    " Error when inserting in PSA table RSTSODSPART"
    ===============================================================
    - the first datapackage is written successfully to PSA,
    but from the second datapackage onwards the error message pops-up
    " Error when inserting in PSA table RSTSODSPART"
    - The original dataselection in the infopackage is somewhere stored
    If the selection in the InfoPackage is reduced (e.g. only one document i.o. a period)
    it stil starts loading according the original selection (the month)
    - If we create a new InfoPackage and select very few data (only one datapackage)
    then we can load to PSA succesfully, but when we load to DSO we can't activate the DSO.
    - We remarked that:
    Two versions of the PSA exist for that datasource 0FI_GL_40:
    a Table(/BIC/B0000555000) in version 1 exists,
    a Table(/BIC/B0000555001) in version 2 exists
    Thanks in advance,
    Best regards

    Hello All,
    We had a problem similar to what Ilse Depoortere describes. The problem happens in our BW QA system a few days/weeks after it has been copied from Production. Data loads start failing with these two error messages:
    RSM2 851 - Error when writing in PSA (Caller 32)
    RSAR 130 - Error 7 when adding to PSA (Caller 70)
    We have just implemented the fix described in note 1340371 (replaced the LIB_DBSL with patch level 247), and the problem is gone. Failed data load process chains can be restarted and finish successfully.
    This has been a really useful discussion, thanks all! And thanks to my coworker Bob who found it.
    Vince Vajda

  • Undocumented ODBC Error when trying an insert on ORACLE 8 from ACCESS97

    Hi
    I have a application with ACCESS 97 dealing with Oracle 8.1.7
    The ODBC Driver version is 8.01.06
    The connecting chain is : ODBC;DRIVER={Oracle ODBC Driver};DBQ=DP3_IST;" & _
    "DBA=W;APA=T;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;FRL=F;MTS=T;CSR=F;PFC=10;TLO=0;
    I have no problems for reading with select but when i try to execute an insert,
    i get the following error message: " reserved error (-7778); there is no message for this error "
    It work's when using the "Microsoft ODBC for Oracle 2.573.3711.00" and unfortunatly i'm not allowed to use it.
    Does anyone know what was the problem?
    Regards
    Pierre-Yves LAGRAVERE

    The two lines you quote aren't errors, they're warnings and they're pretty standard fare. If there isn't anything else in the ODBC log, then the driver isn't returning any errors. I'm not sure why Access is failing, so let's look at the client configuration first.
    - I assume you've successfully installed the 8.1.6 client on the machine with Access. Were there any errors during the install?
    - You say you're using the 8.1.6 version of the Oracle ODBC driver-- can you look to see what the last digit of the version is? If possible, I'd start by downloading the most recent 8.1.6.x ODBC driver from OTN.
    - Check which version of the MDAC you have installed (new versions & a version checker are available from Microsoft at <http://www.microsoft.com/data>.
    - The ODBC driver you download above will list which versions of the MDAC it is expected to work with. Make sure your version is one of the listed versions.
    Justin

  • Errors when inserting and updating form using VIEW.

    Here's my view:
    CREATE OR REPLACE FORCE
    VIEW  "SH_ADD_EMPLOYEES_VW" ("EMP_ID", "DEPT_ID", "JOB_DESC_ID", "EMPNO", "EMP_FIRST", "EMP_LAST", "USER_NAME", "USER_INI", "DEPTNO", "DEPT_DESC", "ROLES_ID", "ADMIN", "CREATES", "APPROVES", "QUALITY", "CUST_SVC", "SH_LOCAL",
    "SH_OFFICE", "SYSTEM")
    AS
      select
    "SH_EMPLOYEES"."EMP_ID" as "EMP_ID",
    "SH_EMPLOYEES"."DEPT_ID" as "DEPT_ID",
    "SH_EMPLOYEES"."JOB_DESC_ID" as "JOB_DESC_ID",
    "SH_EMPLOYEES"."EMPNO"  as "EMPNO",
    "SH_EMPLOYEES"."EMP_FIRST" as "EMP_FIRST",
    "SH_EMPLOYEES"."EMP_LAST" as "EMP_LAST",
    "SH_EMPLOYEES"."USER_NAME" as "USER_NAME",
    "SH_EMPLOYEES"."USER_INI" as "USER_INI",
    "SH_EMPLOYEES"."DEPTNO" as "DEPTNO",
    "SH_EMPLOYEES"."DEPT_DESC" as "DEPT_DESC",
    "DOC_ROLES"."ROLES_ID" as "ROLES_ID",
    "DOC_ROLES"."ADMIN" as "ADMIN",
    "DOC_ROLES"."CREATES" as "CREATES",
    "DOC_ROLES"."APPROVES" as "APPROVES",
    "DOC_ROLES"."QUALITY" as "QUALITY",
    "DOC_ROLES"."CUST_SVC" as "CUST_SVC",
    "DOC_ROLES"."SH_LOCAL" as "SH_LOCAL",
    "DOC_ROLES"."SH_OFFICE" as "SH_OFFICE",
    "DOC_ROLES"."SYSTEM" as "SYSTEM"
    FROM "SH_EMPLOYEES" "SH_EMPLOYEES", "DOC_ROLES" "DOC_ROLES"
    where "SH_EMPLOYEES"."EMP_ID" = "DOC_ROLES"."EMP_ID"
    Here's my trigger (note - I am not using the EXCEPTION clause or (declaration of it)  because it throws an error on msg=>: 'This is my message.' Any help here would be great as well.)
    CREATE OR REPLACE TRIGGER bi_ADD_EMPLOYEES_VW
    INSTEAD OF insert ON SH_ADD_EMPLOYEES_vw
    for each row
    declare
    duplicate_info EXCEPTION;
    PRAGMA EXCEPTION_INIT(duplicate_info, -00001);
    begin
    insert into SH_EMPLOYEES
    (EMP_ID, DEPT_ID, JOB_DESC_ID, EMPNO, EMP_FIRST, EMP_LAST, USER_NAME, USER_INI, DEPTNO, DEPT_DESC)
    values
    (:new.EMP_ID, :new.DEPT_ID, :new.JOB_DESC_ID, :new.EMPNO, :new.EMP_FIRST, :new.EMP_LAST, :new.USER_NAME, :new.USER_INI, :new.DEPTNO, :new.DEPT_DESC);
    insert into DOC_ROLES
    (ROLES_ID, ADMIN, CREATES, APPROVES, QUALITY, CUST_SVC, SH_LOCAL, SH_OFFICE, SYSTEM)
    VALUES (
    :new.ROLES_ID, :new.ADMIN, :new.CREATES, :new.APPROVES, :new.QUALITY, :new.CUST_SVC, :new.SH_LOCAL, :new.SH_OFFICE, :new.SYSTEM);
    EXCEPTION
    WHEN duplicate_info THEN
      RAISE_APPLICATION_ERROR (
       num=> -20107
       msg=> 'Duplicate employee');
    END bi_ADD_EMPLOYEES_VW;
    ERROR ON UPDATE:
    ORA-20505: Error in DML: p_rowid=1001,
    p_alt_rowid=EMP_ID, p_rowid2=2, p_alt_rowid2=ROLES_ID. ORA-01779: cannot modify
    a column which maps to a non key-preserved table
    ERROR ON INSERT:
    ORA-01400: cannot insert NULL into
    ("SPICE_HUNTER1"."SH_EMPLOYEES"."EMP_ID") ORA-06512: at
    "SPICE_HUNTER1.BI_SH_ADD_EMPLOYEES_VW", line 3 ORA-04088: error during execution
    of trigger 'SPICE_HUNTER1.BI_SH_ADD_EMPLOYEES_VW' ORA-06512: at
    "SYS.WWV_DBMS_SQL", line 549 ORA-06512: at "APEX_040000.WWV_FLOW_DML", line 1121
    ORA-22816: unsupported feature with RETURNING clause
    Error Unable to process row on table SH_ADD_EMPLOYEES_VW

    From what I see you are not handling emp_id when it is null.. you need to assign it a value when null from sequence.. that column cannot be null, hence the error, and in order to "modify" a column in that table the DML needs that id to have a value.

  • Error when inserting in a table with an identity column

    Hi,
    I am new to Oracle SOA suite and ESB.
    I have been through the Oracle training and have worked for about 2 months with the tooling.
    We have a Database adabter that inserts data in 5 Tables with relations to each other.
    Each table has his own not NULL Identity column.
    When running/ testing the ESB service we get the error at the end of this post.
    From this we learned that the Database adapter inserts the value NULL in the identity column.
    We cannot find in the documentation how to get the database adabter to skip this first column and ignore it.
    Is this possible within the wizard? Our impression is no
    Is this possible somwhere else/
    And if so How can we do this?
    If anyone can help it would be greatly appreciated
    Pepijn
    Generic error.
    oracle.tip.esb.server.common.exceptions.BusinessEventRejectionException: An unhandled exception has been thrown in the ESB system. The exception reported is: "org.collaxa.thirdparty.apache.wsif.WSIFException: esb:///ESB_Projects/GVB_PDI_PDI_Wegschrijven_Medewerkergegevens/testurv.wsdl [ testurv_ptt::insert(VastAdresCollection) ] - WSIF JCA Execute of operation 'insert' failed due to: DBWriteInteractionSpec Execute Failed Exception.
    insert failed. Descriptor name: [testurv.VastAdres]. [Caused by: Cannot insert explicit value for identity column in table 'VastAdres' when IDENTITY_INSERT is set to OFF.]
    ; nested exception is:
         ORABPEL-11616
    DBWriteInteractionSpec Execute Failed Exception.
    insert failed. Descriptor name: [testurv.VastAdres]. [Caused by: Cannot insert explicit value for identity column in table 'VastAdres' when IDENTITY_INSERT is set to OFF.]
    Caused by Uitzondering [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.3.0) (Build 070608)): oracle.toplink.exceptions.DatabaseException
    Interne uitzondering: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert explicit value for identity column in table 'VastAdres' when IDENTITY_INSERT is set to OFF.Foutcode: 544
    Call:INSERT INTO dbo.VastAdres (ID, BeginDatum, Einddatum, Land, Plaats, Postcode, VolAdres) VALUES (?, ?, ?, ?, ?, ?, ?)
         bind => [null, 1894-06-24 00:00:00.0, 1872-09-04 00:00:00.0, Nederland, Wijdewormer, 1456 NR, Oosterdwarsweg 8]
    Query:InsertObjectQuery(<VastAdres null />).

    Hi,
    Click on the resources tab in the ESB system/ Project to see the ESB system design and all the components in it.
    Click on the Database adapter that you want to edit..and make the necesary changes..
    Check this link.
    http://download-uk.oracle.com/docs/cd/B31017_01/core.1013/b28764/esb008.htm for "6.8.2 How to Modify Adapter Services" section.
    If you are calling a database procedure which inturn makes the insert, you will have to make changes in the database and you job would be much simpler. It seems there are limitations on what you can change in the Database adapter once it is created. Please check the link for further details.
    Thanks,
    Rajesh

  • Error when inserting a new record (Ctrl+Down)

    Hello,
    [http://img402.imageshack.us/my.php?image=12846351.jpg]
    Here the problem is : when i press Ctrl+Down (Insert new record), i enter data into all those fields, but i got an error
    Cannot Insert Record ("ROGER"."NUME") cannot be null (roger is my username which i logged on). And i completed all fields
    Also, when inserting data into fields, when i click on another field, it points me back automatically to the last completed field, then when i click again on the next field, i can enter data in that field. why the cursor cannot be on the next field when i first click there?
    i changed the property of the items Required = No (but however, in the database cannot be null).
    Please help if you can.
    Thanks

    For your other issue, with null fields on your forms.
    have you ever tried to log those fields value into a log table?
    A better and simple idea is:
    Create a temp table, with four columns: seq, section, message, type
    Where section is the column to condition any search you want to make
    message is the column to write anything you want
    type is the column which holds the tpe of the record, like info, debug, warn, etc.
    then create a database procedure
    this procedure must recieve the section, message, type and insert them into the log table and do commit.
    in yiour pre-insert trigger [forms level] or in your when-button-pressed or even better on your on-commit trigger [forms level]
    write the following code:
    begin
    database_procdure('MY_FORM_NAME', 'THE VALUES ARE: 1='||:1||' 2='||:2||' 3='||:3, 'INFO');
    end;
    After that you can do a select in your sql*plus with the following statement:
    select *
    from temp_table
    where selction like 'MY_FORM_NAME';
    then you can track if any of the values you think is null or has a value, in fact, has a value.
    best regards,
    Abdel Miranda
    AEMS Global Group
    Panama

  • Error when inserting into dynamically created filename-file

    Howry
    Am am receiving the following error when i am trying to insert into a file that have a dynamic filename (through declared variable, as date etc.).
    I presume it is trying to look for the target file with the same name as the dynamic value passed through by the variable, but cannot find it- can anyone tell me how i can rather create the file as appose to insert into an already created file..?
    Your help in this regard is much appreciated.
    Here is the error:
    ODI-1217: Session SAPO_hlr_suburbs (1577001) fails with return code 7000.
    ODI-1226: Step 6_Ins_final fails after 1 attempt(s).
    ODI-1240: Flow 6_Ins_final fails while performing a Integration operation. This flow loads target table #l_date.unl.
    ODI-1228: Task 6_Ins_final (Integration) fails on the target FILE connection SAPO_HLR_SUBURBS.
    Caused By: java.sql.SQLException: File C:\Files\Gero work\ODI In Files\SAPO_HLR_SUBURBS/2012-01-24 12:06:13.463.unl was not found
         at com.sunopsis.jdbc.driver.file.FileConnection.prepareForWriting(FileConnection.java:339)
         at com.sunopsis.jdbc.driver.file.impl.commands.CommandInsert.execute(CommandInsert.java:50)
         at com.sunopsis.jdbc.driver.file.CommandExecutor.executeCommand(CommandExecutor.java:33)
         at com.sunopsis.jdbc.driver.file.FilePreparedStatement.executeUpdate(FilePreparedStatement.java:138)
         at com.sunopsis.sql.SnpsQuery.executeUpdate(SnpsQuery.java:665)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.executeUpdate(SnpSessTaskSql.java:3218)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execStdOrders(SnpSessTaskSql.java:1785)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java:2805)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt(SnpSessTaskSqlI.java:68)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2515)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:534)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:449)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1954)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:322)
         at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:224)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:246)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:237)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:794)
         at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:114)
         at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
         at java.lang.Thread.run(Thread.java:619)

    What operating system are you using?
    The name of your file has the time within it , you cant have a filename with ':' in it on Windows.
    Try using ALPHANUMERIC datatype for the variable and pull the current datetime as a char with something like :
    select to_char( sysdate ,'YYYY-MM_DD HHMISS') from dual

  • How to avoid mutating error when insert or update record

    Hi ,
    I have one transaction table which is having some detail record under one transaction number, after the one transaction number is over by insert or update, i
    want to check the total amounts of one flag should be matched on same table if it is not then give error message. But i am getting mutating error on insert or update event trigger on statement level trigger on above table.
    Is there any other way to avoid mutating error to solve the above problem or some temp table concepts to be used. help me its urgent.
    Thanks in advance,
    Sachin Khaladkar
    Pune

    Sachin, here's as short of an example as I could come up with on the fly. The sample data is ficticious and for example only.
    Let's say I need to keep a table of items by category and my business rule states that the items in the table within each category must total to 100% at all times. So I want to insert rows and then make sure any category added sums to 100% or I will rollback the transation. I can't sum the rows in a row-level trigger because I'd have to query the table and it is mutating (in the middle of being changed by a transaction). Even if I could query it while it is mutating, there may be multiple rows in a category with not all yet inserted, so checking the sum after each row is not useful.
    So here I will create;
    1. the item table
    2. a package to hold my record collection (associative array) for the trigger code (the category is used as a key to the array; if I insert 3 rows for a given category, I only need to sum that category once, right?
    3. a before statement trigger to initialize the record collection (since package variables hang around for the entire database session, I need to clear the array before the start of every DML (INSERT in this case) statement against the item table)
    4. a before row trigger to collect categories being inserted
    5. an after statement trigger to validate my business rule
    I then insert some sample data so you can see how it works. Let me know if you have any questions about this.
    SQL> CREATE TABLE item_t
      2   (category  NUMBER(2)   NOT NULL
      3   ,item_code VARCHAR2(2) NOT NULL
      4   ,pct       NUMBER(3,2) NOT NULL);
    Table created.
    SQL>
    SQL> CREATE OR REPLACE PACKAGE trg_pkg IS
      2    TYPE t_item_typ IS TABLE OF item_t.category%TYPE
      3      INDEX BY PLS_INTEGER;
      4    t_item       t_item_typ;
      5    t_empty_item t_item_typ;
      6  END trg_pkg;
      7  /
    Package created.
    SQL> SHOW ERRORS;
    No errors.
    SQL>
    SQL> CREATE OR REPLACE TRIGGER item_bs_trg
      2    BEFORE INSERT
      3    ON item_t
      4  BEGIN
      5    DBMS_OUTPUT.put_line('Initializing...');
      6    trg_pkg.t_item := trg_pkg.t_empty_item;
      7  END item_bs_trg;
      8  /
    Trigger created.
    SQL> SHOW ERRORS;
    No errors.
    SQL>
    SQL> CREATE OR REPLACE TRIGGER item_br_trg
      2    BEFORE INSERT
      3    ON item_t
      4    FOR EACH ROW
      5  BEGIN
      6    trg_pkg.t_item(:NEW.category) := :NEW.category;
      7    DBMS_OUTPUT.put_line('Inserted Item for Category: '||:NEW.category);
      8  END item_br_trg;
      9  /
    Trigger created.
    SQL> SHOW ERRORS;
    No errors.
    SQL>
    SQL> CREATE OR REPLACE TRIGGER item_as_trg
      2    AFTER INSERT
      3    ON item_t
      4  DECLARE
      5    CURSOR c_item (cp_category item_t.category%TYPE) IS
      6      SELECT SUM(pct) pct
      7        FROM item_t
      8       WHERE category = cp_category;
      9  BEGIN
    10    DBMS_OUTPUT.put_line('Verifying...');
    11    FOR i IN trg_pkg.t_item.FIRST..trg_pkg.t_item.LAST LOOP
    12      DBMS_OUTPUT.put_line('Checking Category: '||trg_pkg.t_item(i));
    13      FOR rec IN c_item(trg_pkg.t_item(i)) LOOP
    14        IF rec.pct != 1 THEN
    15          RAISE_APPLICATION_ERROR(-20001,'Category '||trg_pkg.t_item(i)||' total = '||rec.pct);
    16        END IF;
    17      END LOOP;
    18    END LOOP;
    19  END item_as_trg;
    20  /
    Trigger created.
    SQL> SHOW ERRORS;
    No errors.
    SQL> INSERT INTO item_t
      2    SELECT 1, 'AA', .3 FROM DUAL
      3    UNION ALL
      4    SELECT 2, 'AB', .6 FROM DUAL
      5    UNION ALL
      6    SELECT 1, 'AC', .2 FROM DUAL
      7    UNION ALL
      8    SELECT 3, 'AA',  1 FROM DUAL
      9    UNION ALL
    10    SELECT 1, 'AA', .5 FROM DUAL
    11    UNION ALL
    12    SELECT 2, 'AB', .4 FROM DUAL;
    Initializing...
    Inserted Item for Category: 1
    Inserted Item for Category: 2
    Inserted Item for Category: 1
    Inserted Item for Category: 3
    Inserted Item for Category: 1
    Inserted Item for Category: 2
    Verifying...
    Checking Category: 1
    Checking Category: 2
    Checking Category: 3
    6 rows created.
    SQL>
    SQL> SELECT * FROM item_t ORDER BY category, item_code, pct;
      CATEGORY IT        PCT
             1 AA         .3
             1 AA         .5
             1 AC         .2
             2 AB         .4
             2 AB         .6
             3 AA          1
    6 rows selected.
    SQL>
    SQL> INSERT INTO item_t
      2    SELECT 4, 'AB', .5 FROM DUAL
      3    UNION ALL
      4    SELECT 5, 'AC', .2 FROM DUAL
      5    UNION ALL
      6    SELECT 5, 'AA', .5 FROM DUAL
      7    UNION ALL
      8    SELECT 4, 'AB', .5 FROM DUAL
      9    UNION ALL
    10    SELECT 4, 'AC', .4 FROM DUAL;
    Initializing...
    Inserted Item for Category: 4
    Inserted Item for Category: 5
    Inserted Item for Category: 5
    Inserted Item for Category: 4
    Inserted Item for Category: 4
    Verifying...
    Checking Category: 4
    INSERT INTO item_t
    ERROR at line 1:
    ORA-20001: Category 4 total = 1.4
    ORA-06512: at "PNOSKO.ITEM_AS_TRG", line 12
    ORA-04088: error during execution of trigger 'PNOSKO.ITEM_AS_TRG'
    SQL>
    SQL> SELECT * FROM item_t ORDER BY category, item_code, pct;
      CATEGORY IT        PCT
             1 AA         .3
             1 AA         .5
             1 AC         .2
             2 AB         .4
             2 AB         .6
             3 AA          1
    6 rows selected.
    SQL>

  • Error when inserting  file 4KB in a BLOB column.

    Hello,
    I am getting the following error when I am trying to insert a file > 4KB in a
    BLOB column.
    ORA-01461: can bind a LONG value only for insert into a LONG column.
    We are using Weblogic5.1.0 sp10, Oracle 8.0.5 with WL OCI driver.
    There is no change even after setting the following property weblogic.oci.min_bind_size=660
    Please can anyone help?
    Thanks.

    Hello,
    I tried using the following sql stmts to override the NLS_LANG setting on both
    server and client for a session.
    ALTER SESSION SET NLS_LANGUAGE = AMERICAN;
    ALTER SESSION SET NLS_TERRITORY = AMERICA;
    It still gave the same error.
    I tried the same using Oracle thin driver.Even then the same problem.
    As I mentioned earlier, we are using oracle 8.0.5.
    and here is the code I am using for writing BLOB data
    java.sql.PreparedStatement prepstmt = conn.prepareStatement("Update TEST_BLOB
    set BLOBATTACH = ? where IDX =1");
    ByteArrayOutputStream ostream = new ByteArrayOutputStream();
    ObjectOutputStream p = new ObjectOutputStream(ostream);
    p.writeObject(data);
    prepstmt.setBinaryStream(1, new ByteArrayInputStream(ostream.toByteArray()), ostream.size());
    prepstmt.executeUpdate();
    prepstmt.close();
    Any suggestions ?
    Thanks.
    "Slava Imeshev" <[email protected]> wrote:
    Latha,
    You need to make sure you have the same NLS_LANG setting both for the
    client
    and the server.
    Regards,
    Slava Imeshev
    "Latha Pusapaty" <[email protected]> wrote in message
    news:[email protected]...
    I Tried that. But still getting the same exception.
    java.sql.SQLException: ORA-01461: can bind a LONG value only for insertinto a
    LONG column
    at weblogic.db.oci.OciCursor.getCDAException(OciCursor.java:230)
    at weblogic.jdbcbase.oci.Statement.executeUpdate(Statement.java:980)
    atweblogic.jdbc20.pool.PreparedStatement.executeUpdate(PreparedStatement.java:
    47)
    atweblogic.jdbc20.rmi.internal.PreparedStatementImpl.executeUpdate(PreparedSta
    tementImpl.java:54)
    atweblogic.jdbc20.rmi.SerialPreparedStatement.executeUpdate(SerialPreparedStat
    ement.java:55)
    at fictx.TRServlet.doPost(TRServlet.java, Compiled Code)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java, CompiledCode)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java, CompiledCode)
    atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    Compiled Code)
    atweblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
    l.java,
    Compiled Code)
    atweblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
    l.java,
    Compiled Code)
    atweblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
    Manager.java,
    Compiled Code)
    at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java,Compiled
    Code)
    at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java,Compiled
    Code)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled Code)
    Same code is working fine for files less than 4000 bytes.
    Oracle table has only one BLOB column.
    I have set weblogic.oci.selectBlobChunkSize=1200 .
    Where could be the problem?
    Andreas Bittorf <[email protected]> wrote:
    We resolved the problem as following:
    ps = con.prepareStatement
    ("update tq_businessmodel set
    businessmodel=?,lastupdate=?
    "WHERE taskid=?");
    ByteArrayOutputStream ostream = new ByteArrayOutputStream();
    ObjectOutputStream p = new ObjectOutputStream(ostream);
    p.writeObject(businessModel);
    ps.setBinaryStream(1, newByteArrayInputStream(ostream.toByteArray()),
    ostream.size());
    ps.setTimestamp(2,new Timestamp(System.currentTimeMillis()));
    ps.setLong(3,taskid);
    ps.executeUpdate();

  • ODBC Error when implementing BI Apps on SQL Server

    Hey,
    we are implementing BI Apps using SQL Server as the warehouse database, and we are running into the following errors when viewing the out-of-the-box reports:
    [ODBC SQL Server Driver][SQL Server]'concat' is not a recognized built-in function name
    [ODBC SQL Server Driver][SQL Server]Incorrect syntax near 'NULLS'..
    It appears that the standard reports are using Oracle-specific SQL functions that are not available in SQL Server. Yet BI Apps is supposedly certified with SQL Server.
    Have anyone else run into this issue? If so, how did you get around it?
    Thanks,
    Yi

    Ah, sorry, I misunderstood.
    Yes, the CONCAT_SUPPORT feature is checked for both value and default. However, CONCAT_NULL_RETURNS_NULL is not checked. Should I check it?
    It's great to know that you have it working on SQL server. I must be missing some configuration then.
    Thanks,
    Yi

  • Oracle ODBC Error - Option Value Changed - What does it Mean and How to fix

    We have an asp web report making calls to an oracle 8i database. It appears that we get the following error on regular basis for one particular report:
    Microsoft OLE DB Provider for ODBC Drivers error '80040e31'
    [Oracle][ODBC]Option value changed.
    /FinalBilling/Report2.asp, line 49
    When the web page is refreshed, it appears the error goes away. Any new call to the database from the web page will start with the error again though.
    Other web pages seem to work ok with out error.
    Did a number of google searches did not find anything definative that seemed to help.

    These messages can be ignored. They are common but innocuous. There is nothing you need to fix.

  • Error when inserting xml with xsi:noNamespaceSchemaLocation

    Hello,
    Hopefully this isn't a stupid question....
    I am currently using Oracle 9.2.0.6.0 to try out XML.
    I haven't been able to get our DBAs to set up XML DB in its entirety so I just have the basics, i.e. I have access to the xmltype object but none of the packages like DBMS_SCHEMA and DBMS_XDB. Therefore, I haven't been able to register any schemas in the database.
    So what I'd like to know is why do I get an ORA-21700 error when I try to load an xml document which has the 'xsi:noNamespaceSchemaLocation' attribute'. If I take this out of the XML document, it loads.
    From my initial reading, I got the impression that registering a schema in order to validate documents was an optional, although probably an ideal, step to take.
    So another way of phrasing this subject might be: can one insert xml documents without the use of a schema?
    The example code is shown below.
    dbase> INSERT INTO MY_TABLE( id , message_type , status , rcvd_time, filename , xmlcol)
    2 VALUES ( 1, 0 , 'RECEIVED', sysdate , 'tempfilename' ,
    3 xmltype('<ExampleXML xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
    4 xsi:noNamespaceSchemaLocation = "ExampleXML.xsd">
    5 <tag1>
    6 <tag2 attr1="something">Some data
    7 </tag2>
    8 </tag1>
    9 </ExampleXML>')
    10 );
    xmltype('<ExampleXML xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
    ERROR at line 3:
    ORA-21700: object does not exist or is marked for delete
    ORA-06512: at "SYS.XMLTYPE", line 0
    ORA-06512: at line 1
    dbase> ed
    Wrote file afiedt.buf
    1 INSERT INTO MY_TABLE ( id , message_type , status , rcvd_time, filename , xmlcol)
    2 VALUES ( 1, 0 , 'RECEIVED', sysdate , 'tempfilename' ,
    3 xmltype('<ExampleXML xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
    4 >
    5 <tag1>
    6 <tag2 attr1="something">Some data
    7 </tag2>
    8 </tag1>
    9 </ExampleXML>')
    10* )
    dbase> /
    1 row created.
    The xmlcol column was created simply as an xmltype column.

    Basically using XMLType without XML DB is almost impossible in 9.2.x. Please have the DBA's install XML DB by running the script $ORACLE_HOME/rdbms/admin/catqm.sql. They can follow the installing XDB instuctions in the XML DB Developer's guide.
    What is actually happening here is that the PARSER is hard wired to always check is a document that contains an noNamespaceSchemaLocation or schemaLocation tag is associated with an XML Schema that has been registered with Oracle XML DB. If is is, special action is takem, if it isn't then no special action is taken. Unfortunately for various arcane technical reasons if the the XDB repository is not present the check fails totally. Even if we fixed this bug, which has been marked not feasible to fix in the past, there are many other issues with the inbuilt XML technology having dependancies on the presence of the XML DB repository and XDB database user.
    So the net/net is don't use XMLType or any XML related features in 9.2.x or later unless XML DB is installed. It is extremenly likely at this point in time that XML DB will become a mandatory component of the next release of the database. At that point you will no longer have an option. It will be automatically installed when a database is created or updated and there will be no way of un-installing it.

Maybe you are looking for

  • Workflow step Problem - INVOICE

    Hi Experts , I have to trigger a workflow in case of inbound INVOICE error . I have defined one of the step in my workflow using standard task (TS00008056) and did the binding with following details. Task : TS00008056 (Standard task for INVOICE FI).

  • Purpose of Messages link in MI Client SP 18 ?

    Hi, Could anyone please tell me the purpose of Messages link in MI Client SP 18 ? what is it for ? when and what kind of messages it contain ? Currenlty when i am clicking on it , it is showing error page . Thanks & Regards, Vipin

  • Variables in sql*plus

    many times, i am confused by the way to assess a variable defined in sql*plus. can someone give a clear explanation on the difference and when to use which? &var, &&var, :var

  • Solaris 8 Installed, but won't run

    I�m pretty new to UNIX environments, so any advice or help in regard to the problem I�m having with Solaris 8 on my Compaq Presario would be much appreciated. It's a 1G Athlon with 128M of memory. I�ve installed the software, though throughout the in

  • Wall Boards for UCCX 7.0

    Any recommendations for a Wall Board for UCCX 7.0?