ORA-07445 (solaris 9.0.) when inserting into LONG column

i am getting a core-dump when inserting into a table w/ long column. running 9.0.1 on solaris.
ORA-07445: exception encountered: core dump [kghtshrt()+68] [SIGSEGV] [Address not mapped to object] [0x387BBF0] [] []
if anyone has ANY input - please provide it ... i am desperate at this point.
i am trying to avoid upgrading to 9.2.0 to solve this problem.
regards -
jerome

You should report this in a service request on http://metalink.oracle.com.
It is a shame that you put all the effort here to describe your problem, but on the other hand you can now also copy & paste the question to Oracle Support.
Because you are using 10.2.0.3; I am guessing that you have a valid service contract...

Similar Messages

  • ORA- 01461 : Can Bind a long value only for insert into a column error

    I was trying to create a new job using dbms_job.isubmit
    begin
    sys.dbms_job.isubmit(job => 1111,
    what => '',
    next_date => to_date('21-10-2011 03:00:00', 'dd-mm-yyyy hh24:mi:ss'),
    interval => 'TRUNC(SYSDATE+1)+3/24');
    commit;
    end;
    However, I am getting the error 'ORA- 01461 : Can Bind a long value only for insert into a column error'.
    I tried a lot but cant get rid of.
    Any help gurus ?

    You have an error in the code:
    1. you don't provide a value for 'what' - you have to tell Oracle what it should execute when it submits the job.
    And remember - with ISUBMIT the next_date parameter has datatype VARCHAR2 - SUBMIT uses datatype DATE. So make sure you provide a VARCHAR2 value and do not rely on implicit conversion.
    >
    PROCEDURE DBMS_JOB.ISUBMIT
    (job IN BINARY_INTEGER
    ,what IN VARCHAR2
    ,next_date IN VARCHAR2
    ,interval IN VARCHAR2 DEFAULT 'null'
    ,no_parse IN BOOLEAN DEFAULT FALSE);
    PROCEDURE DBMS_JOB.SUBMIT
    (job OUT BINARY_INTEGER
    ,what IN VARCHAR2
    ,next_date IN DATE DEFAULT SYSDATE
    ,interval IN VARCHAR2 DEFAULT 'null'
    ,no_parse IN BOOLEAN DEFAULT FALSE);

  • BUG? ORA-01461 in Unit Tester when saving a long Dynamic Value Query

    I get an ORA-01461 "can bind a LONG value only for insert into a LONG column" error when saving a Test Implementation with a Dynamic Value Query whose length of the SQL statement is roughly 2,000 characters - I'm UNIONing ALL about 30 test case values together, but it seems to be choking on such a long SQL string for some reason....
    I am running version Early Adopter Release #2 (2.1.0.63), build MAIN-63.10.
    Thoughts?

    Confirmed.
    Bug 9119144: ORA-01461 IN UNIT TESTER WHEN SAVING A LONG DYNAMIC VALUE QUERY (OR OTHER CLOB)
    Brian Jeffries
    SQL Developer Team

  • Split one column  value and insert into multiple columns

    hi
    am new to plsql .
    i want to split a characters from one column and insert into multiple columns
    i tried used substr function the symbol ',' vary his place dynamically ,so i can't apply substr function.
    for eg:  before split
    col1 :
    col2 :
    col3 :
    col4 :
    colu5: adsdf,fgrty,erfth,oiunth,okujt
    after split
    col1 :adsd
    col2 :fgrty
    col3 :erfth
    col4 :oiunth
    col5 : adsdf,fgrty,erfth,oiunth,okujt
    can anyone help me
    thanks
    Edited by: 800324 on Dec 23, 2010 8:28 AM
    Edited by: 800324 on Dec 23, 2010 8:36 AM

    How about:
    SQL> create table t
      2  (col1 varchar2(30)
      3  ,col2 varchar2(30)
      4  ,col3 varchar2(30)
      5  ,col4 varchar2(30)
      6  ,col5 varchar2(30)
      7  );
    Table created.
    SQL> insert into t (col5) values ('adsdf,fgrty,erfth,oiunth,okujt');
    1 row created.
    SQL> insert into t (col5) values ('x,y');
    1 row created.
    SQL> insert into t (col5) values ('a,b,c,d');
    1 row created.
    SQL> select * from t;
    COL1                           COL2                           COL3                           COL4                           COL5
                                                                                                                                adsdf,fgrty,erfth,oiunth,okujt
                                                                                                                                x,y
                                                                                                                                a,b,c,d
    3 rows selected.
    SQL>
    SQL> merge into t a
      2  using ( with t1 as ( select col5||',' col5
      3                       from   t
      4                     )
      5          select substr(col5, 1, instr(col5, ',', 1, 1)-1) col1
      6          ,      substr(col5, instr(col5, ',', 1, 1)+1, instr(col5, ',', 1, 2)- instr(col5, ',', 1, 1)-1) col2
      7          ,      substr(col5, instr(col5, ',', 1, 2)+1, instr(col5, ',', 1, 3)- instr(col5, ',', 1, 2)-1) col3
      8          ,      substr(col5, instr(col5, ',', 1, 3)+1, instr(col5, ',', 1, 4)- instr(col5, ',', 1, 3)-1) col4
      9          ,      rtrim(col5, ',') col5
    10          from   t1
    11        ) b
    12  on ( a.col5 = b.col5 )
    13  when matched then update set a.col1 = b.col1
    14                             , a.col2 = b.col2
    15                             , a.col3 = b.col3
    16                             , a.col4 = b.col4
    17  when not matched then insert (a.col1) values (null);
    3 rows merged.
    SQL> select * from t;
    COL1                           COL2                           COL3                           COL4                           COL5
    adsdf                          fgrty                          erfth                          oiunth                         adsdf,fgrty,erfth,oiunth,okujt
    x                              y                                                                                            x,y
    a                              b                              c                              d                              a,b,c,d
    3 rows selected.
    SQL> Assuming you're on 9i...

  • Instead of Insert, Verify not inserting into identity column.

    I am writing an Instead of Insert trigger. I would like to fire an error when inserting into an 'Identity' column.  Since UPDATE([ColumnName]) always returns TRUE for insert statements, is there an easy/fast way around this? I don't
    want to use: 
    IF(EXISTS(SELECT [i].[AS_ID] FROM [inserted] [i] WHERE [i].[AS_ID] IS NULL))
    here is my pseudo-code...
    CREATE VIEW [org].[Assets]
    WITH SCHEMABINDING
    AS
    SELECT
    [AS].[AS_ID], -- Identity field in base table
    [AS].[Tag],
    [AS].[Name]
    FROM [org].[AS_Assets_Rewind](DEFAULT, DEFAULT, DEFAULT) [AS];
    GO
    CREATE TRIGGER [org].[Assets_Insert]
    ON [org].[Assets]
    INSTEAD OF INSERT
    AS
    BEGIN
    SET NOCOUNT ON;
    SET XACT_ABORT ON;
    -- How does this statment need to be written to throw the error?
    -- UPDATE([AS_ID]) always returns TRUE
    IF(UPDATE([AS_ID]))
    RAISERROR('INSERT into the anchor identity column ''AS_ID'' is not allowed.', 16, 1) WITH NOWAIT;
    -- Is there a faster/better method than this?
    IF(EXISTS(SELECT [i].[AS_ID] FROM [inserted] [i] WHERE [i].[AS_ID] IS NOT NULL))
    RAISERROR('INSERT into the anchor identity column ''AS_ID'' is not allowed.', 16, 1) WITH NOWAIT;
    -- Do Stuff
    END;
    -- Should error for inserting into [AS_ID] field (which is an identity field)
    INSERT INTO [org].[Assets]([AS_ID], [Tag], [Name])
    VALUES(1, 'f451', 'Paper burns'),
    (2, 'k505.928', 'Paper burns in Chemistry');
    -- No error should occur
    INSERT INTO [org].[Assets]([Tag], [Name])
    VALUES('f451', 'Paper burns'),
    ('k505.928', 'Paper burns in Chemistry');

    IDENTITY is in single quotes, maybe i should have made it italics to indicate it is not the name of the column, but a logical reference to a column that has the identity property set.
    the "_Rewind" suffix is to indicate the function "looks back into time".
    Schema design is wrong? How do you recommend creating a SQL Server 2012 database that can
    1) keep a history of data with respect to changing time and transaction time
    2) update data that does not arrive at one time, aka, I may get your name and phone number today, but your e-mail address tomorrow - we need to be able to differentiate when different data was updated.
    3) no physical deletes (due to needing to go back in time)
    FYI: 
    I have examined R. Snodgrass's, L. Rönnbäck's, and T. Johnston's bi-temporal design patterns.
    here is the DDL:
    CREATE SCHEMA [posit];
    GO
    CREATE SCHEMA [org];
    GO
    CREATE TABLE [posit].[PO_Positor]
    [PO_PositorId] INT NOT NULL IDENTITY(1, 1),
    [PO_PositorApp] NVARCHAR(128) NOT NULL CONSTRAINT [DF__PO_Positor_PO_PositorApp] DEFAULT(APP_NAME()),
    CONSTRAINT [CL__PO_Positor_PO_PositorApp] CHECK([PO_PositorApp] <> ''),
    [PO_PositorName] NVARCHAR(128) NOT NULL CONSTRAINT [DF__PO_Positor_PO_PositorName] DEFAULT(SUSER_SNAME()),
    CONSTRAINT [CL__PO_Positor_PO_PositorName] CHECK([PO_PositorName] <> ''),
    [PO_PositorHost] NVARCHAR(128) NOT NULL CONSTRAINT [DF__PO_Positor_PO_PositorHost] DEFAULT(HOST_NAME()),
    CONSTRAINT [CL__PO_Positor_PO_PositorHost] CHECK([PO_PositorHost] <> ''),
    [PO_PositorSID] VARBINARY(85) NOT NULL CONSTRAINT [DF__PO_Positor_PO_PositorSID] DEFAULT(SUSER_SID()),
    [PO_PositorUID] INT NOT NULL CONSTRAINT [DF__PO_Positor_PO_PositorUID] DEFAULT(SUSER_ID()),
    [PO_PositorNote] VARCHAR(348) NULL CONSTRAINT [CL__PO_Positor_PO_PositorNote] CHECK([PO_PositorNote] <> ''),
    [PO_PositorInserted] DATETIMEOFFSET(7) NOT NULL CONSTRAINT [DF__PO_Positor_PO_PositorInserted] DEFAULT(SYSDATETIMEOFFSET()),
    [PO_RowGuid] UNIQUEIDENTIFIER NOT NULL CONSTRAINT [DF__PO_Positor_PO_RowGuid] DEFAULT(NEWSEQUENTIALID()) ROWGUIDCOL,
    CONSTRAINT [UX__PO_Positor_PO_RowGuid] UNIQUE NONCLUSTERED([PO_RowGuid]),
    CONSTRAINT [PK__PO_Positor] PRIMARY KEY ([PO_PositorId] ASC),
    CONSTRAINT [UK__PO_Positor] UNIQUE CLUSTERED ([PO_PositorApp] ASC, [PO_PositorHost] ASC, [PO_PositorUID] ASC)
    GO
    CREATE PROCEDURE [posit].[Insert_Positor]
    @PositorNote NVARCHAR(348) = NULL
    AS
    BEGIN
    DECLARE @ProcedureDesc NVARCHAR(261) = N'[' + OBJECT_SCHEMA_NAME(@@PROCID) + N'].[' + OBJECT_NAME(@@PROCID) + N']';
    SET @PositorNote = COALESCE(@PositorNote, N'Automatically created by: ' + @ProcedureDesc);
    DECLARE @Id TABLE
    [Id] INT NOT NULL
    INSERT INTO [posit].[PO_Positor]([PO_PositorNote])
    OUTPUT [inserted].[PO_PositorId]
    INTO @Id([Id])
    VALUES (@PositorNote);
    RETURN (SELECT TOP 1 [i].[Id] FROM @Id [i]);
    END;
    GO
    CREATE PROCEDURE [posit].[Return_PositorId]
    AS
    BEGIN
    DECLARE @PositorId INT = [posit].[Get_PositorId]();
    IF (@PositorId IS NULL)
    BEGIN
    DECLARE @ProcedureDesc NVARCHAR(261) = N'[' + OBJECT_SCHEMA_NAME(@@PROCID) + N'].[' + OBJECT_NAME(@@PROCID) + N']';
    DECLARE @PositorNote NVARCHAR(348) = N'Automatically created by: ' + @ProcedureDesc;
    EXECUTE @PositorId = [posit].[Insert_Positor] @PositorNote;
    END;
    RETURN @PositorId;
    END;
    GO
    CREATE FUNCTION [posit].[Get_PositorId]
    RETURNS INT
    AS
    BEGIN
    DECLARE @PositorId INT = NULL;
    SELECT TOP 1
    @PositorId = [p].[PO_PositorId]
    FROM
    [posit].[PO_Positor] [p]
    WHERE [p].[PO_PositorApp] = APP_NAME()
    AND [p].[PO_PositorHost] = HOST_NAME()
    AND [p].[PO_PositorUID] = SUSER_ID();
    RETURN @PositorId;
    END;
    GO
    CREATE TABLE [org].[AS_Assets]
    [AS_ID] INT NOT NULL IDENTITY(1, 1),
    [AS_PositedBy] INT NOT NULL CONSTRAINT [DF__AS_Assets_PositedBy] DEFAULT([posit].[Get_PositorId]())
    CONSTRAINT [FK__AS_Assets_PositedBy] REFERENCES [posit].[PO_Positor]([PO_PositorId]),
    [AS_PositedAt] DATETIMEOFFSET(7) NOT NULL CONSTRAINT [DF__AS_Assets_PositedAt] DEFAULT(SYSDATETIMEOFFSET()),
    [AS_RowGuid] UNIQUEIDENTIFIER NOT NULL CONSTRAINT [DF__AS_Assets_RowGuid] DEFAULT(NEWSEQUENTIALID()) ROWGUIDCOL,
    CONSTRAINT [UX__AS_Assets_RowGuid] UNIQUE([AS_RowGuid]),
    CONSTRAINT [PK__AS_Assets] PRIMARY KEY CLUSTERED ([AS_ID] ASC)
    GO
    CREATE TABLE [org].[AS_NME_Assets_Name_Posit]
    [AS_NME_ID] INT NOT NULL IDENTITY(1, 1),
    [AS_NME_AS_ID] INT NOT NULL CONSTRAINT [FK__AS_NME_Assets_Name_Posit_AS_NME_AS_ID] REFERENCES [org].[AS_Assets]([AS_ID]),
    [AS_NME_AssetTag] VARCHAR(12) NOT NULL CONSTRAINT [CL__AS_NME_Assets_Name_Posit_AS_NME_AssetTag] CHECK([AS_NME_AssetTag] <> ''),
    [AS_NME_AssetName] NVARCHAR(24) NOT NULL CONSTRAINT [CL__AS_NME_Assets_Name_Posit_AS_NME_AssetName] CHECK([AS_NME_AssetName] <> ''),
    [AS_NME_AssetDetail] NVARCHAR(48) NOT NULL CONSTRAINT [CL__AS_NME_Assets_Name_Posit_AS_NME_AssetDetail] CHECK([AS_NME_AssetDetail] <> ''),
    [AS_NME_Checksum] AS BINARY_CHECKSUM([AS_NME_AssetTag], [AS_NME_AssetName], [AS_NME_AssetDetail])
    PERSISTED NOT NULL,
    [AS_NME_ChangedAt] DATETIMEOFFSET(7) NOT NULL CONSTRAINT [DF__AS_NME_Assets_Name_Posit_ChangedAt] DEFAULT(SYSDATETIMEOFFSET()),
    [AS_NME_RowGuid] UNIQUEIDENTIFIER NOT NULL CONSTRAINT [DF__AS_NME_Assets_Name_Posit_RowGuid] DEFAULT(NEWSEQUENTIALID()) ROWGUIDCOL,
    CONSTRAINT [UX__AS_NME_Assets_Name_Posit_RowGuid] UNIQUE NONCLUSTERED([AS_NME_RowGuid]),
    CONSTRAINT [PK__AS_NME_Assets_Name_Posit] PRIMARY KEY([AS_NME_ID] ASC),
    CONSTRAINT [UK__AS_NME_Assets_Name_Posit] UNIQUE CLUSTERED([AS_NME_AS_ID] ASC, [AS_NME_ChangedAt] DESC, [AS_NME_Checksum] ASC)
    WITH (FILLFACTOR = 95)
    GO
    CREATE TABLE [org].[AS_NME_Assets_Name_Annex]
    [AS_NME_ID] INT NOT NULL CONSTRAINT [FK__AS_NME_Assets_Name_Annex_AS_NME_ID] REFERENCES [org].[AS_NME_Assets_Name_Posit]([AS_NME_ID]),
    [AS_NME_PositedBy] INT NOT NULL CONSTRAINT [DF__AS_NME_Assets_Name_Annex_PositedBy] DEFAULT([posit].[Get_PositorId]())
    CONSTRAINT [FK__AS_NME_Assets_Name_Annex_PositedBy] REFERENCES [posit].[PO_Positor]([PO_PositorId]),
    [AS_NME_PositedAt] DATETIMEOFFSET(7) NOT NULL CONSTRAINT [DF__AS_NME_Assets_Name_Annex_PositedAt] DEFAULT(SYSDATETIMEOFFSET()),
    [AS_NME_PositReliability] TINYINT NOT NULL CONSTRAINT [DF__AS_NME_Assets_Name_Annex_PositRel] DEFAULT(50),
    [AS_NME_PositReliable] AS CONVERT(BIT, CASE WHEN [AS_NME_PositReliability] > 0 THEN 1 ELSE 0 END)
    PERSISTED NOT NULL,
    [AS_NME_RowGuid] UNIQUEIDENTIFIER NOT NULL CONSTRAINT [DF__AS_NME_Assets_Name_Annex_RowGuid] DEFAULT(NEWSEQUENTIALID()) ROWGUIDCOL,
    CONSTRAINT [UX__AS_NME_Assets_Name_Annex_RowGuid] UNIQUE NONCLUSTERED([AS_NME_RowGuid]),
    CONSTRAINT [PK__AS_NME_Assets_Name_Annex] PRIMARY KEY CLUSTERED([AS_NME_ID] ASC, [AS_NME_PositedAt] DESC, [AS_NME_PositedBy] ASC)
    WITH (FILLFACTOR = 95)
    GO
    CREATE TABLE [org].[AS_GEO_Assets_Location_Posit]
    [AS_GEO_ID] INT NOT NULL IDENTITY(1, 1),
    [AS_GEO_AS_ID] INT NOT NULL CONSTRAINT [FK__AS_GEO_Assets_Location_Posit_AS_GEO_AS_ID] REFERENCES [org].[AS_Assets]([AS_ID]),
    [AS_GEO_Longitude_Deg] DECIMAL(17, 14) NOT NULL CONSTRAINT [CR__AS_GEO_Assets_Location_Posit_Longitude_Deg_L] CHECK([AS_GEO_Longitude_Deg] >= -180.0),
    CONSTRAINT [CR__AS_GEO_Assets_Location_Posit_Longitude_Deg_U] CHECK([AS_GEO_Longitude_Deg] <= 180.0),
    [AS_GEO_Latitude_Deg] DECIMAL(17, 14) NOT NULL CONSTRAINT [CR__AS_GEO_Assets_Location_Posit_Latitude_Deg_L] CHECK([AS_GEO_Latitude_Deg] >= -90.0),
    CONSTRAINT [CR__AS_GEO_Assets_Location_Posit_Latitude_Deg_U] CHECK([AS_GEO_Latitude_Deg] <= 90.0),
    [AS_GEO_Wgs84] AS geography::STPointFromText('POINT(' + CONVERT(VARCHAR(19), [AS_GEO_Longitude_Deg], 0) + ' ' + CONVERT(VARCHAR(19), [AS_GEO_Latitude_Deg], 0) + ')', 4326),
    [AS_GEO_Checksum] AS BINARY_CHECKSUM([AS_GEO_Longitude_Deg], [AS_GEO_Latitude_Deg])
    PERSISTED NOT NULL,
    [AS_GEO_ChangedAt] DATETIMEOFFSET(7) NOT NULL CONSTRAINT [DF__AS_GEO_Assets_Location_Posit_ChangedAt] DEFAULT(SYSDATETIMEOFFSET()),
    [AS_GEO_RowGuid] UNIQUEIDENTIFIER NOT NULL CONSTRAINT [DF__AS_GEO_Assets_Location_Posit_RowGuid] DEFAULT(NEWSEQUENTIALID()) ROWGUIDCOL,
    CONSTRAINT [UX__AS_GEO_Assets_Location_Posit_RowGuid] UNIQUE NONCLUSTERED([AS_GEO_RowGuid]),
    CONSTRAINT [PK__AS_GEO_Assets_Location_Posit] PRIMARY KEY([AS_GEO_ID] ASC),
    CONSTRAINT [UK__AS_GEO_Assets_Location_Posit] UNIQUE CLUSTERED([AS_GEO_AS_ID] ASC, [AS_GEO_ChangedAt] DESC, [AS_GEO_Checksum] ASC)
    WITH (FILLFACTOR = 95)
    GO
    CREATE TABLE [org].[AS_GEO_Assets_Location_Annex]
    [AS_GEO_ID] INT NOT NULL CONSTRAINT [FK__AS_GEO_Assets_Location_Annex_AS_GEO_ID] REFERENCES [org].[AS_GEO_Assets_Location_Posit]([AS_GEO_ID]),
    [AS_GEO_PositedBy] INT NOT NULL CONSTRAINT [DF__AS_GEO_Assets_Location_Annex_PositedBy] DEFAULT([posit].[Get_PositorId]())
    CONSTRAINT [FK__AS_GEO_Assets_Location_Annex_PositedBy] REFERENCES [posit].[PO_Positor]([PO_PositorId]),
    [AS_GEO_PositedAt] DATETIMEOFFSET(7) NOT NULL CONSTRAINT [DF__AS_GEO_Assets_Location_Annex_PositedAt] DEFAULT(SYSDATETIMEOFFSET()),
    [AS_GEO_PositReliability] TINYINT NOT NULL CONSTRAINT [DF__AS_GEO_Assets_Location_Annex_PositRel] DEFAULT(50),
    [AS_GEO_PositReliable] AS CONVERT(BIT, CASE WHEN [AS_GEO_PositReliability] > 0 THEN 1 ELSE 0 END)
    PERSISTED NOT NULL,
    [AS_GEO_RowGuid] UNIQUEIDENTIFIER NOT NULL CONSTRAINT [DF__AS_GEO_Assets_Location_Annex_RowGuid] DEFAULT(NEWSEQUENTIALID()) ROWGUIDCOL,
    CONSTRAINT [UX__AS_GEO_Assets_Location_Annex_RowGuid] UNIQUE NONCLUSTERED([AS_GEO_RowGuid]),
    CONSTRAINT [PK__AS_GEO_Assets_Location_Annex] PRIMARY KEY CLUSTERED([AS_GEO_ID] ASC, [AS_GEO_PositedAt] DESC, [AS_GEO_PositedBy] ASC)
    WITH (FILLFACTOR = 95)
    GO
    CREATE FUNCTION [org].[AS_NME_Assets_Name_Posit_RW]
    @ChangedBefore DATETIMEOFFSET(7) = '9999-12-31'
    RETURNS TABLE
    WITH SCHEMABINDING
    AS
    RETURN
    SELECT
    [p].[AS_NME_ID],
    [p].[AS_NME_AS_ID],
    [p].[AS_NME_AssetTag],
    [p].[AS_NME_AssetName],
    [p].[AS_NME_AssetDetail],
    [p].[AS_NME_Checksum],
    [p].[AS_NME_ChangedAt]
    FROM
    [org].[AS_NME_Assets_Name_Posit] [p]
    WHERE
    [p].[AS_NME_ChangedAt] < @ChangedBefore;
    GO
    CREATE FUNCTION [org].[AS_NME_Assets_Name_Annex_RW]
    @PositedBefore DATETIMEOFFSET(7) = '9999-12-31'
    RETURNS TABLE
    WITH SCHEMABINDING
    AS
    RETURN
    SELECT
    [a].[AS_NME_ID],
    [a].[AS_NME_PositedBy],
    [a].[AS_NME_PositedAt],
    [a].[AS_NME_PositReliability],
    [a].[AS_NME_PositReliable]
    FROM
    [org].[AS_NME_Assets_Name_Annex] [a]
    WHERE[a].[AS_NME_PositedAt] < @PositedBefore;
    GO
    CREATE FUNCTION [org].[AS_NME_Assets_Name_RW]
    @ChangedBefore DATETIMEOFFSET(7) = '9999-12-31',
    @PositedBefore DATETIMEOFFSET(7) = '9999-12-31'
    RETURNS TABLE
    WITH SCHEMABINDING
    AS
    RETURN
    SELECT
    [p].[AS_NME_ID],
    [p].[AS_NME_AS_ID],
    [p].[AS_NME_AssetTag],
    [p].[AS_NME_AssetName],
    [p].[AS_NME_AssetDetail],
    [p].[AS_NME_Checksum],
    [p].[AS_NME_ChangedAt],
    [a].[AS_NME_PositedBy],
    [a].[AS_NME_PositedAt],
    [a].[AS_NME_PositReliability],
    [a].[AS_NME_PositReliable]
    FROM
    [org].[AS_NME_Assets_Name_Posit_RW](@ChangedBefore) [p]
    INNER JOIN
    [org].[AS_NME_Assets_Name_Annex_RW](@PositedBefore) [a]
    ON [a].[AS_NME_ID] = [p].[AS_NME_ID]
    AND [a].[AS_NME_PositedAt] = (
    SELECT TOP 1
    [s].[AS_NME_PositedAt]
    FROM
    [org].[AS_NME_Assets_Name_Annex_RW](@PositedBefore) [s]
    WHERE [s].[AS_NME_ID] = [p].[AS_NME_ID]
    ORDER BY
    [s].[AS_NME_PositedAt] DESC
    GO
    CREATE FUNCTION [org].[AS_GEO_Assets_Location_Posit_RW]
    @ChangedBefore DATETIMEOFFSET(7) = '9999-12-31'
    RETURNS TABLE
    WITH SCHEMABINDING
    AS
    RETURN
    SELECT
    [p].[AS_GEO_ID],
    [p].[AS_GEO_AS_ID],
    [p].[AS_GEO_Longitude_Deg],
    [p].[AS_GEO_Latitude_Deg],
    [p].[AS_GEO_Wgs84],
    [p].[AS_GEO_Checksum],
    [p].[AS_GEO_ChangedAt]
    FROM
    [org].[AS_GEO_Assets_Location_Posit] [p]
    WHERE
    [p].[AS_GEO_ChangedAt] < @ChangedBefore;
    GO
    CREATE FUNCTION [org].[AS_GEO_Assets_Location_Annex_RW]
    @PositedBefore DATETIMEOFFSET(7) = '9999-12-31'
    RETURNS TABLE
    WITH SCHEMABINDING
    AS
    RETURN
    SELECT
    [a].[AS_GEO_ID],
    [a].[AS_GEO_PositedBy],
    [a].[AS_GEO_PositedAt],
    [a].[AS_GEO_PositReliability],
    [a].[AS_GEO_PositReliable]
    FROM
    [org].[AS_GEO_Assets_Location_Annex] [a]
    WHERE
    [a].[AS_GEO_PositedAt] < @PositedBefore;
    GO
    CREATE FUNCTION [org].[AS_GEO_Assets_Location_RW]
    @ChangedBefore DATETIMEOFFSET(7) = '9999-12-31',
    @PositedBefore DATETIMEOFFSET(7) = '9999-12-31'
    RETURNS TABLE
    WITH SCHEMABINDING
    AS
    RETURN
    SELECT
    [p].[AS_GEO_ID],
    [p].[AS_GEO_AS_ID],
    [p].[AS_GEO_Longitude_Deg],
    [p].[AS_GEO_Latitude_Deg],
    [p].[AS_GEO_Wgs84],
    [p].[AS_GEO_Checksum],
    [p].[AS_GEO_ChangedAt],
    [a].[AS_GEO_PositedBy],
    [a].[AS_GEO_PositedAt],
    [a].[AS_GEO_PositReliability],
    [a].[AS_GEO_PositReliable]
    FROM
    [org].[AS_GEO_Assets_Location_Posit_RW](@ChangedBefore) [p]
    INNER JOIN
    [org].[AS_GEO_Assets_Location_Annex_RW](@PositedBefore) [a]
    ON [a].[AS_GEO_ID] = [p].[AS_GEO_ID]
    AND [a].[AS_GEO_PositedAt] = (
    SELECT TOP 1
    [s].[AS_GEO_PositedAt]
    FROM
    [org].[AS_GEO_Assets_Location_Annex_RW](@PositedBefore) [s]
    WHERE [s].[AS_GEO_ID] = [p].[AS_GEO_ID]
    ORDER BY
    [s].[AS_GEO_PositedAt] DESC
    GO
    CREATE FUNCTION [org].[AS_Assets_Rewind]
    @ChangedBefore DATETIMEOFFSET(7) = '9999-12-31',
    @PositedBefore DATETIMEOFFSET(7) = '9999-12-31',
    @Reliable BIT = 1
    RETURNS TABLE
    WITH SCHEMABINDING
    AS
    RETURN
    SELECT
    [AS].[AS_ID],
    [AS].[AS_PositedBy],
    [AS].[AS_PositedAt],
    [NME].[AS_NME_ID],
    [NME].[AS_NME_AS_ID],
    [NME].[AS_NME_AssetTag],
    [NME].[AS_NME_AssetName],
    [NME].[AS_NME_AssetDetail],
    [NME].[AS_NME_Checksum],
    [NME].[AS_NME_ChangedAt],
    [NME].[AS_NME_PositedBy],
    [NME].[AS_NME_PositedAt],
    [NME].[AS_NME_PositReliability],
    [NME].[AS_NME_PositReliable],
    [GEO].[AS_GEO_ID],
    [GEO].[AS_GEO_AS_ID],
    [GEO].[AS_GEO_Longitude_Deg],
    [GEO].[AS_GEO_Latitude_Deg],
    [GEO].[AS_GEO_Wgs84],
    [GEO].[AS_GEO_Checksum],
    [GEO].[AS_GEO_ChangedAt],
    [GEO].[AS_GEO_PositedBy],
    [GEO].[AS_GEO_PositedAt],
    [GEO].[AS_GEO_PositReliability],
    [GEO].[AS_GEO_PositReliable]
    FROM
    [org].[AS_Assets] [AS]
    INNER JOIN
    [org].[AS_NME_Assets_Name_RW](@ChangedBefore, @PositedBefore) [NME]
    ON [NME].[AS_NME_AS_ID] = [AS].[AS_ID]
    AND [NME].[AS_NME_PositReliable] = @Reliable
    AND [NME].[AS_NME_ID] = (
    SELECT TOP 1
    [NME_s].[AS_NME_ID]
    FROM
    [org].[AS_NME_Assets_Name_RW](@ChangedBefore, @PositedBefore) [NME_s]
    WHERE [NME_s].[AS_NME_AS_ID] = [AS].[AS_ID]
    ORDER BY
    [NME_s].[AS_NME_ChangedAt] DESC,
    [NME_s].[AS_NME_PositedAt] DESC
    LEFT OUTER JOIN
    [org].[AS_GEO_Assets_Location_RW](@ChangedBefore, @PositedBefore) [GEO]
    ON [GEO].[AS_GEO_AS_ID] = [AS].[AS_ID]
    AND [GEO].[AS_GEO_PositReliable] = @Reliable
    AND [GEO].[AS_GEO_ID] = (
    SELECT TOP 1
    [GEO_s].[AS_GEO_ID]
    FROM
    [org].[AS_GEO_Assets_Location_RW](@ChangedBefore, @PositedBefore) [GEO_s]
    WHERE [GEO_s].[AS_GEO_AS_ID] = [AS].[AS_ID]
    ORDER BY
    [GEO_s].[AS_GEO_ChangedAt] DESC,
    [GEO_s].[AS_GEO_PositedAt] DESC
    GO
    CREATE VIEW [org].[AS_NME_Assets_Name_SK]
    WITH SCHEMABINDING
    AS
    SELECT
    [p].[AS_NME_ID],
    [p].[AS_NME_AS_ID],
    [p].[AS_NME_AssetTag],
    [p].[AS_NME_AssetName],
    [p].[AS_NME_AssetDetail],
    [p].[AS_NME_Checksum],
    [p].[AS_NME_ChangedAt],
    [a].[AS_NME_PositedBy],
    [a].[AS_NME_PositedAt],
    [a].[AS_NME_PositReliability],
    [a].[AS_NME_PositReliable]
    FROM
    [org].[AS_NME_Assets_Name_Posit] [p]
    INNER JOIN
    [org].[AS_NME_Assets_Name_Annex] [a]
    ON [a].[AS_NME_ID] = [p].[AS_NME_ID];
    GO
    CREATE UNIQUE CLUSTERED INDEX [PK__AS_NME_Assets_Name_SK]
    ON [org].[AS_NME_Assets_Name_SK]
    [AS_NME_AS_ID] ASC,
    [AS_NME_ChangedAt] DESC,
    [AS_NME_PositedAt] DESC,
    [AS_NME_PositedBy] ASC,
    [AS_NME_PositReliable] ASC
    WITH (FILLFACTOR = 95);
    GO
    CREATE VIEW [org].[AS_GEO_Assets_Location_SK]
    WITH SCHEMABINDING
    AS
    SELECT
    [p].[AS_GEO_ID],
    [p].[AS_GEO_AS_ID],
    [p].[AS_GEO_Wgs84],
    [p].[AS_GEO_Checksum],
    [p].[AS_GEO_ChangedAt],
    [a].[AS_GEO_PositedBy],
    [a].[AS_GEO_PositedAt],
    [a].[AS_GEO_PositReliability],
    [a].[AS_GEO_PositReliable]
    FROM
    [org].[AS_GEO_Assets_Location_Posit] [p]
    INNER JOIN
    [org].[AS_GEO_Assets_Location_Annex] [a]
    ON [a].[AS_GEO_ID] = [p].[AS_GEO_ID];
    GO
    CREATE UNIQUE CLUSTERED INDEX [PK__AS_GEO_Assets_Location_SK]
    ON [org].[AS_GEO_Assets_Location_SK]
    [AS_GEO_AS_ID] ASC,
    [AS_GEO_ChangedAt] DESC,
    [AS_GEO_PositedAt] DESC,
    [AS_GEO_PositedBy] ASC,
    [AS_GEO_PositReliable] ASC
    WITH (FILLFACTOR = 95);
    GO
    CREATE VIEW [org].[AS_Assets_Current]
    WITH SCHEMABINDING
    AS
    SELECT
    [AS].[AS_ID],
    [AS].[AS_PositedBy],
    [AS].[AS_PositedAt],
    [AS].[AS_NME_ID],
    [AS].[AS_NME_AS_ID],
    [AS].[AS_NME_AssetTag],
    [AS].[AS_NME_AssetName],
    [AS].[AS_NME_AssetDetail],
    [AS].[AS_NME_Checksum],
    [AS].[AS_NME_ChangedAt],
    [AS].[AS_NME_PositedBy],
    [AS].[AS_NME_PositedAt],
    [AS].[AS_NME_PositReliability],
    [AS].[AS_NME_PositReliable],
    [AS].[AS_GEO_ID],
    [AS].[AS_GEO_AS_ID],
    [AS].[AS_GEO_Longitude_Deg],
    [AS].[AS_GEO_Latitude_Deg],
    [AS].[AS_GEO_Wgs84],
    [AS].[AS_GEO_Checksum],
    [AS].[AS_GEO_ChangedAt],
    [AS].[AS_GEO_PositedBy],
    [AS].[AS_GEO_PositedAt],
    [AS].[AS_GEO_PositReliability],
    [AS].[AS_GEO_PositReliable]
    FROM [org].[AS_Assets_Rewind](DEFAULT, DEFAULT, DEFAULT) [AS];
    GO
    CREATE TRIGGER [org].[AS_Assets_Current_Insert]
    ON [org].[AS_Assets_Current]
    INSTEAD OF INSERT
    AS
    BEGIN
    SET NOCOUNT ON;
    SET XACT_ABORT ON;
    IF(EXISTS(SELECT [i].[AS_ID] FROM [inserted] [i] WHERE [i].[AS_ID] IS NOT NULL))
    RAISERROR('INSERT into the anchor identity column ''AS_ID'' is not allowed.', 16, 1) WITH NOWAIT;
    IF(EXISTS(SELECT [i].[AS_NME_ID] FROM [inserted] [i] WHERE [i].[AS_NME_ID] IS NOT NULL))
    RAISERROR('INSERT into the identity column ''AS_NME_ID'' is not allowed.', 16, 1) WITH NOWAIT;
    IF(EXISTS(SELECT [i].[AS_NME_AS_ID] FROM [inserted] [i] WHERE [i].[AS_NME_AS_ID] IS NOT NULL))
    RAISERROR('INSERT into the foreign key identity column ''AS_NME_AS_ID'' is not allowed.', 16, 1) WITH NOWAIT;
    IF(EXISTS(SELECT [i].[AS_NME_Checksum] FROM [inserted] [i] WHERE [i].[AS_NME_Checksum] IS NOT NULL))
    RAISERROR('INSERT into the computed column ''AS_NME_Checksum'' is not allowed.', 16, 1) WITH NOWAIT;
    IF(EXISTS(SELECT [i].[AS_NME_PositReliable] FROM [inserted] [i] WHERE [i].[AS_NME_PositReliable] IS NOT NULL))
    RAISERROR('INSERT into the computed column ''AS_NME_PositReliable'' is not allowed.', 16, 1) WITH NOWAIT;
    IF(EXISTS(SELECT [i].[AS_GEO_ID] FROM [inserted] [i] WHERE [i].[AS_GEO_ID] IS NOT NULL))
    RAISERROR('INSERT into the identity column ''AS_GEO_ID'' is not allowed.', 16, 1) WITH NOWAIT;
    IF(EXISTS(SELECT [i].[AS_GEO_AS_ID] FROM [inserted] [i] WHERE [i].[AS_GEO_AS_ID] IS NOT NULL))
    RAISERROR('INSERT into the foreign key identity column ''AS_GEO_AS_ID'' is not allowed.', 16, 1) WITH NOWAIT;
    IF(EXISTS(SELECT [i].[AS_GEO_Checksum] FROM [inserted] [i] WHERE [i].[AS_GEO_Checksum] IS NOT NULL))
    RAISERROR('INSERT into the computed column ''AS_GEO_Checksum'' is not allowed.', 16, 1) WITH NOWAIT;
    IF(EXISTS(SELECT [i].[AS_GEO_PositReliable] FROM [inserted] [i] WHERE [i].[AS_GEO_PositReliable] IS NOT NULL))
    RAISERROR('INSERT into the computed column ''AS_GEO_PositReliable'' is not allowed.', 16, 1) WITH NOWAIT;
    IF(EXISTS(SELECT [i].[AS_GEO_Wgs84] FROM [inserted] [i] WHERE [i].[AS_GEO_Wgs84] IS NOT NULL))
    RAISERROR('INSERT into the computed column ''AS_GEO_Wgs84'' is not allowed.', 16, 1) WITH NOWAIT;
    DECLARE @Reliability INT = 50;
    DECLARE @Now DATETIMEOFFSET(7) = SYSDATETIMEOFFSET();
    DECLARE @PositedBy INT;
    EXECUTE @PositedBy = [posit].[Return_PositorId];
    DECLARE @Inserted TABLE
    [AS_PositedBy] INT NOT NULL,
    [AS_PositedAt] DATETIMEOFFSET(7) NOT NULL,
    [AS_NME_AssetTag] VARCHAR(12) NOT NULL CHECK([AS_NME_AssetTag] <> ''),
    [AS_NME_AssetName] NVARCHAR(24) NOT NULL CHECK([AS_NME_AssetName] <> ''),
    [AS_NME_AssetDetail] NVARCHAR(48) NOT NULL CHECK([AS_NME_AssetDetail] <> ''),
    [AS_NME_Checksum] AS BINARY_CHECKSUM([AS_NME_AssetTag], [AS_NME_AssetName], [AS_NME_AssetDetail])
    PERSISTED NOT NULL,
    [AS_NME_ChangedAt] DATETIMEOFFSET(7) NOT NULL,
    [AS_NME_PositedBy] INT NOT NULL,
    [AS_NME_PositedAt] DATETIMEOFFSET(7) NOT NULL,
    [AS_NME_PositReliability] TINYINT NOT NULL,
    [AS_GEO_Longitude_Deg] DECIMAL(17, 14) NULL CHECK([AS_GEO_Longitude_Deg] >= -180.0), CHECK([AS_GEO_Longitude_Deg] <= 180.0),
    [AS_GEO_Latitude_Deg] DECIMAL(17, 14) NULL CHECK([AS_GEO_Latitude_Deg] >= -90.0), CHECK([AS_GEO_Latitude_Deg] <= 90.0),
    [AS_GEO_Checksum] AS BINARY_CHECKSUM([AS_GEO_Longitude_Deg], [AS_GEO_Latitude_Deg])
    PERSISTED NOT NULL,
    [AS_GEO_ChangedAt] DATETIMEOFFSET(7) NOT NULL,
    [AS_GEO_PositedBy] INT NOT NULL,
    [AS_GEO_PositedAt] DATETIMEOFFSET(7) NOT NULL,
    [AS_GEO_PositReliability] TINYINT NOT NULL,
    [ROW_ID] INT NOT NULL,
    PRIMARY KEY([ROW_ID] ASC)
    INSERT INTO @Inserted
    [AS_PositedBy],
    [AS_PositedAt],
    [AS_NME_AssetTag],
    [AS_NME_AssetName],
    [AS_NME_AssetDetail],
    [AS_NME_ChangedAt],
    [AS_NME_PositedBy],
    [AS_NME_PositedAt],
    [AS_NME_PositReliability],
    [AS_GEO_Longitude_Deg],
    [AS_GEO_Latitude_Deg],
    [AS_GEO_ChangedAt],
    [AS_GEO_PositedBy],
    [AS_GEO_PositedAt],
    [AS_GEO_PositReliability],
    [ROW_ID]
    SELECT
    COALESCE([i].[AS_PositedBy], @PositedBy),
    COALESCE([i].[AS_PositedAt], @Now),
    [i].[AS_NME_AssetTag],
    [i].[AS_NME_AssetName],
    [i].[AS_NME_AssetDetail],
    COALESCE([i].[AS_NME_ChangedAt], @Now),
    COALESCE([i].[AS_NME_PositedBy], @PositedBy),
    COALESCE([i].[AS_NME_PositedAt], @Now),
    COALESCE([i].[AS_NME_PositReliability], @Reliability),
    [i].[AS_GEO_Longitude_Deg],
    [i].[AS_GEO_Latitude_Deg],
    COALESCE([i].[AS_GEO_ChangedAt], @Now),
    COALESCE([i].[AS_GEO_PositedBy], @PositedBy),
    COALESCE([i].[AS_GEO_PositedAt], @Now),
    COALESCE([i].[AS_GEO_PositReliability], @Reliability),
    ROW_NUMBER() OVER (PARTITION BY [i].[AS_ID] ORDER BY [i].[AS_ID])
    FROM
    [inserted] [i]
    LEFT OUTER JOIN
    [org].[AS_Assets_Current] [c]
    ON [c].[AS_NME_Checksum] = BINARY_CHECKSUM([i].[AS_NME_AssetTag], [i].[AS_NME_AssetName], [i].[AS_NME_AssetDetail])
    WHERE
    [i].[AS_ID] IS NULL
    AND [i].[AS_NME_ID] IS NULL
    AND [i].[AS_NME_AS_ID] IS NULL
    AND [i].[AS_GEO_ID] IS NULL
    AND [i].[AS_GEO_AS_ID] IS NULL
    AND [c].[AS_NME_AS_ID] IS NULL;
    DECLARE @Anchor TABLE
    [ROW_ID] INT NOT NULL IDENTITY(1, 1),
    [AS_ID] INT NOT NULL,
    PRIMARY KEY([ROW_ID] ASC),
    UNIQUE CLUSTERED([AS_ID] ASC)
    INSERT INTO [org].[AS_Assets]
    [AS_PositedBy],
    [AS_PositedAt]
    OUTPUT
    [inserted].[AS_ID]
    INTO
    @Anchor
    [AS_ID]
    SELECT
    [i].[AS_PositedBy],
    [i].[AS_PositedAt]
    FROM
    @Inserted [i]
    ORDER BY
    [i].[ROW_ID] ASC;
    DECLARE @NME_Posit TABLE
    [AS_NME_ID] INT NOT NULL,
    [AS_NME_Checksum] INT NOT NULL,
    PRIMARY KEY([AS_NME_ID] ASC),
    UNIQUE CLUSTERED([AS_NME_Checksum] ASC)
    INSERT INTO [org].[AS_NME_Assets_Name_Posit]
    [AS_NME_AS_ID],
    [AS_NME_AssetTag],
    [AS_NME_AssetName],
    [AS_NME_AssetDetail],
    [AS_NME_ChangedAt]
    OUTPUT
    [inserted].[AS_NME_ID],
    [inserted].[AS_NME_Checksum]
    INTO
    @NME_Posit
    [AS_NME_ID],
    [AS_NME_Checksum]
    SELECT
    [a].[AS_ID],
    [i].[AS_NME_AssetTag],
    [i].[AS_NME_AssetName],
    [i].[AS_NME_AssetDetail],
    [i].[AS_NME_ChangedAt]
    FROM
    @Inserted [i]
    LEFT OUTER JOIN
    @Anchor [a]
    ON [a].[ROW_ID] = [i].[ROW_ID]
    WHERE [a].[AS_ID] IS NOT NULL;
    INSERT INTO [org].[AS_NME_Assets_Name_Annex]
    [AS_NME_ID],
    [AS_NME_PositedBy],
    [AS_NME_PositedAt],
    [AS_NME_PositReliability]
    SELECT
    [p].[AS_NME_ID],
    [i].[AS_NME_PositedBy],
    [i].[AS_NME_PositedAt],
    [i].[AS_NME_PositReliability]
    FROM
    @Inserted [i]
    INNER JOIN
    @NME_Posit [p]
    ON [p].[AS_NME_Checksum] = [i].[AS_NME_Checksum];
    DECLARE @GEO_Posit TABLE
    [AS_GEO_ID] INT NOT NULL,
    [AS_GEO_Checksum] INT NOT NULL,
    PRIMARY KEY([AS_GEO_ID] ASC),
    UNIQUE CLUSTERED([AS_GEO_Checksum] ASC)
    INSERT INTO [org].[AS_GEO_Assets_Location_Posit]
    [AS_GEO_AS_ID],
    [AS_GEO_Longitude_Deg],
    [AS_GEO_Latitude_Deg],
    [AS_GEO_ChangedAt]
    OUTPUT
    [inserted].[AS_GEO_ID],
    [inserted].[AS_GEO_Checksum]
    INTO
    @GEO_Posit
    [AS_GEO_ID],
    [AS_GEO_Checksum]
    SELECT
    [a].[AS_ID],
    [i].[AS_GEO_Longitude_Deg],
    [i].[AS_GEO_Latitude_Deg],
    [i].[AS_NME_ChangedAt]
    FROM
    @Inserted [i]
    LEFT OUTER JOIN
    @Anchor [a]
    ON [a].[ROW_ID] = [i].[ROW_ID]
    WHERE [a].[AS_ID] IS NOT NULL
    AND [i].[AS_GEO_Longitude_Deg] IS NOT NULL
    AND [i].[AS_GEO_Latitude_Deg] IS NOT NULL;
    INSERT INTO [org].[AS_GEO_Assets_Location_Annex]
    [AS_GEO_ID],
    [AS_GEO_PositedBy],
    [AS_GEO_PositedAt],
    [AS_GEO_PositReliability]
    SELECT
    [p].[AS_GEO_ID],
    [i].[AS_GEO_PositedBy],
    [i].[AS_GEO_PositedAt],
    [i].[AS_GEO_PositReliability]
    FROM
    @Inserted [i]
    INNER JOIN
    @GEO_Posit [p]
    ON [p].[AS_GEO_Checksum] = [i].[AS_GEO_Checksum];
    END;
    GO
    CREATE TRIGGER [org].[AS_Assets_Current_Update]
    ON [org].[AS_Assets_Current]
    INSTEAD OF UPDATE
    AS
    BEGIN
    SET NOCOUNT ON;
    SET XACT_ABORT ON;
    IF(UPDATE([AS_ID]))
    RAISERROR('Cannot update the anchor identity column ''AS_ID''.', 16, 1);
    IF(UPDATE([AS_PositedBy]))
    RAISERROR('Cannot update the anchor column ''AS_PositedBy''.', 16, 1);
    IF(UPDATE([AS_PositedAt]))
    RAISERROR('Cannot update the anchor column ''AS_PositedAt''.', 16, 1);
    IF(UPDATE([AS_NME_ID]))
    RAISERROR('Cannot update the identity column ''AS_NME_ID''.', 16, 1);
    IF(UPDATE([AS_NME_AS_ID]))
    RAISERROR('Cannot update the foreign key identity column ''AS_NME_AS_ID''.', 16, 1);
    IF(UPDATE([AS_NME_Checksum]))
    RAISERROR('Cannot update the computed column ''AS_NME_Checksum''.', 16, 1);
    IF(UPDATE([AS_NME_PositReliable]))
    RAISERROR('Cannot update the computed column ''AS_NME_PositReliable''.', 16, 1);
    IF(UPDATE([AS_GEO_ID]))
    RAISERROR('Cannot update the identity column ''AS_GEO_ID''.', 16, 1);
    IF(UPDATE([AS_GEO_AS_ID]))
    RAISERROR('Cannot update the foreign key identity column ''AS_GEO_AS_ID''.', 16, 1);
    IF(UPDATE([AS_GEO_Checksum]))
    RAISERROR('Cannot update the computed column ''AS_GEO_Checksum''.', 16, 1);
    IF(UPDATE([AS_GEO_PositReliable]))
    RAISERROR('Cannot update the computed column ''AS_GEO_PositReliable''.', 16, 1);
    IF(UPDATE([AS_GEO_Wgs84]))
    RAISERROR('Cannot update the computed column ''AS_GEO_Wgs84''.', 16, 1);
    DECLARE @Now DATETIMEOFFSET(7) = SYSDATETIMEOFFSET();
    DECLARE @PositedBy INT;
    EXECUTE @PositedBy = [posit].[Return_PositorId];
    DECLARE @Inserted TABLE
    [AS_ID] INT NOT NULL,
    [AS_PositedBy] INT NOT NULL,
    [AS_PositedAt] DATETIMEOFFSET(7) NOT NULL,
    [AS_NME_ID] INT NOT NULL,
    [AS_NME_AS_ID] INT NOT NULL,
    [AS_NME_AssetTag] VARCHAR(12) NULL CHECK([AS_NME_AssetTag] <> ''),
    [AS_NME_AssetName] NVARCHAR(24) NULL CHECK([AS_NME_AssetName] <> ''),
    [AS_NME_AssetDetail] NVARCHAR(48) NULL CHECK([AS_NME_AssetDetail] <> ''),
    [AS_NME_Checksum] AS BINARY_CHECKSUM([AS_NME_AssetTag], [AS_NME_AssetName], [AS_NME_AssetDetail])
    PERSISTED NOT NULL,
    [AS_NME_ChangedAt] DATETIMEOFFSET(7) NOT NULL,
    [AS_NME_PositedBy] INT NOT NULL,
    [AS_NME_PositedAt] DATETIMEOFFSET(7) NOT NULL,
    [AS_NME_PositReliability] TINYINT NOT NULL,
    [AS_GEO_ID] INT NULL,
    [AS_GEO_AS_ID] INT NULL,
    [AS_GEO_Longitude_Deg] DECIMAL(17, 14) NULL CHECK([AS_GEO_Longitude_Deg] >= -180.0), CHECK([AS_GEO_Longitude_Deg] <= 180.0),
    [AS_GEO_Latitude_Deg] DECIMAL(17, 14) NULL CHECK([AS_GEO_Latitude_Deg] >= -90.0), CHECK([AS_GEO_Latitude_Deg] <= 90.0),
    [AS_GEO_Checksum] AS BINARY_CHECKSUM([AS_GEO_Longitude_Deg], [AS_GEO_Latitude_Deg])
    PERSISTED NOT NULL,
    [AS_GEO_ChangedAt] DATETIMEOFFSET(7) NULL,
    [AS_GEO_PositedBy] INT NULL,
    [AS_GEO_PositedAt] DATETIMEOFFSET(7) NULL,
    [AS_GEO_PositReliability] TINYINT NULL,
    [ROW_ID] INT NOT NULL,
    PRIMARY KEY([ROW_ID] ASC)
    INSERT INTO @Inserted
    [AS_ID],
    [AS_PositedBy],
    [AS_PositedAt],
    [AS_NME_ID],
    [AS_NME_AS_ID],
    [AS_NME_AssetTag],
    [AS_NME_AssetName],
    [AS_NME_AssetDetail],
    [AS_NME_ChangedAt],
    [AS_NME_PositedBy],
    [AS_NME_PositedAt],
    [AS_NME_PositReliability],
    [AS_GEO_ID],
    [AS_GEO_AS_ID],
    [AS_GEO_Longitude_Deg],
    [AS_GEO_Latitude_Deg],
    [AS_GEO_ChangedAt],
    [AS_GEO_PositedBy],
    [AS_GEO_PositedAt],
    [AS_GEO_PositReliability],
    [ROW_ID]
    SELECT
    [i].[AS_ID],
    CASE WHEN (UPDATE([AS_PositedBy])) THEN [i].[AS_PositedBy] ELSE @PositedBy END,
    CASE WHEN (UPDATE([AS_PositedAt])) THEN [i].[AS_PositedAt] ELSE @Now END,
    [i].[AS_NME_ID],
    [i].[AS_NME_AS_ID],
    [i].[AS_NME_AssetTag],
    [i].[AS_NME_AssetName],
    [i].[AS_NME_AssetDetail],
    CASE WHEN (UPDATE([AS_NME_ChangedAt])) THEN [i].[AS_NME_ChangedAt] ELSE @Now END,
    CASE WHEN (UPDATE([AS_NME_PositedBy])) THEN [i].[AS_NME_PositedBy] ELSE @PositedBy END,
    CASE WHEN (UPDATE([AS_NME_PositedAt])) THEN [i].[AS_NME_PositedAt] ELSE @Now END,
    [i].[AS_NME_PositReliability],
    [i].[AS_GEO_ID],
    [i].[AS_GEO_AS_ID],
    [i].[AS_GEO_Longitude_Deg],
    [i].[AS_GEO_Latitude_Deg],
    CASE WHEN (UPDATE([AS_GEO_ChangedAt])) THEN [i].[AS_GEO_ChangedAt] ELSE @Now END,
    CASE WHEN (UPDATE([AS_GEO_PositedBy])) THEN [i].[AS_GEO_PositedBy] ELSE @PositedBy END,
    CASE WHEN (UPDATE([AS_GEO_PositedAt])) THEN [i].[AS_GEO_PositedAt] ELSE @Now END,
    [i].[AS_GEO_PositReliability],
    ROW_NUMBER() OVER (PARTITION BY [i].[AS_ID] ORDER BY [i].[AS_ID])
    FROM
    [inserted] [i]
    LEFT OUTER JOIN
    [org].[AS_Assets_Current] [c]
    ON [c].[AS_NME_Checksum] = BINARY_CHECKSUM([i].[AS_NME_AssetTag], [i].[AS_NME_AssetName], [i].[AS_NME_AssetDetail])
    LEFT OUTER JOIN
    [org].[AS_Assets_Current] [g]
    ON [g].[AS_GEO_Checksum] = BINARY_CHECKSUM([i].[AS_GEO_Longitude_Deg], [i].[AS_GEO_Latitude_Deg])
    WHERE
    [c].[AS_NME_AS_ID] IS NULL
    OR [g].[AS_NME_AS_ID] IS NULL;
    DECLARE @NME_Posit TABLE
    [AS_NME_ID] INT NOT NULL,
    [AS_NME_Checksum] INT NOT NULL,
    PRIMARY KEY([AS_NME_ID] ASC),
    UNIQUE CLUSTERED([AS_NME_Checksum] ASC)
    INSERT INTO [org].[AS_NME_Assets_Name_Posit]
    [AS_NME_AS_ID],
    [AS_NME_AssetTag],
    [AS_NME_AssetName],
    [AS_NME_AssetDetail],
    [AS_NME_ChangedAt]
    OUTPUT
    [inserted].[AS_NME_ID],
    [inserted].[AS_NME_Checksum]
    INTO
    @NME_Posit
    [AS_NME_ID],
    [AS_NME_Checksum]
    SELECT
    [i].[AS_NME_AS_ID],
    [i].[AS_NME_AssetTag],
    [i].[AS_NME_AssetName],
    [i].[AS_NME_AssetDetail],
    [i].[AS_NME_ChangedAt]
    FROM @Inserted [i];
    INSERT INTO [org].[AS_NME_Assets_Name_Annex]
    [AS_NME_ID],
    [AS_NME_PositedBy],
    [AS_NME_PositedAt],
    [AS_NME_PositReliability]
    SELECT
    [p].[AS_NME_ID],
    CASE WHEN (UPDATE([AS_NME_PositedBy])) THEN [i].[AS_NME_PositedBy] ELSE @PositedBy END,
    CASE WHEN (UPDATE([AS_NME_PositedAt])) THEN [i].[AS_NME_PositedAt] ELSE @Now END,
    [i].[AS_NME_PositReliability]
    FROM @Inserted [i]
    INNER JOIN
    @NME_Posit [p]
    ON [p].[AS_NME_Checksum] = [i].[AS_NME_Checksum];
    INSERT INTO [org].[AS_NME_Assets_Name_Annex]
    [AS_NME_ID],
    [AS_NME_PositedBy],
    [AS_NME_PositedAt],
    [AS_NME_PositReliability]
    SELECT
    [i].[AS_NME_ID],
    CASE WHEN (UPDATE([AS_NME_PositedBy])) THEN [i].[AS_NME_PositedBy] ELSE @PositedBy END,
    CASE WHEN (UPDATE([AS_NME_PositedAt])) THEN [i].[AS_NME_PositedAt] ELSE @Now END,
    [i].[AS_NME_PositReliability]
    FROM [inserted] [i]
    LEFT OUTER JOIN
    @NME_Posit [p]
    ON [p].[AS_NME_Checksum] = BINARY_CHECKSUM([i].[AS_NME_AssetTag])
    WHERE
    [p].[AS_NME_ID] IS NULL;
    DECLARE @GEO_Posit TABLE
    [AS_GEO_ID] INT NOT NULL,
    [AS_GEO_Checksum] INT NOT NULL,
    PRIMARY KEY([AS_GEO_ID] ASC),
    UNIQUE CLUSTERED([AS_GEO_Checksum] ASC)
    INSERT INTO [org].[AS_GEO_Assets_Location_Posit]
    [AS_GEO_AS_ID],
    [AS_GEO_Longitude_Deg],
    [AS_GEO_Latitude_Deg],
    [AS_GEO_ChangedAt]
    OUTPUT
    [inserted].[AS_GEO_ID],
    [inserted].[AS_GEO_Checksum]
    INTO
    @GEO_Posit
    [AS_GEO_ID],
    [AS_GEO_Checksum]
    SELECT
    [i].[AS_GEO_AS_ID],
    [i].[AS_GEO_Longitude_Deg],
    [i].[AS_GEO_Latitude_Deg],
    [i].[AS_GEO_ChangedAt]
    FROM @Inserted [i];
    INSERT INTO [org].[AS_GEO_Assets_Location_Annex]
    [AS_GEO_ID],
    [AS_GEO_PositedBy],
    [AS_GEO_PositedAt],
    [AS_GEO_PositReliability]
    SELECT
    [p].[AS_GEO_ID],
    CASE WHEN (UPDATE([AS_GEO_PositedBy])) THEN [i].[AS_GEO_PositedBy] ELSE @PositedBy END,
    CASE WHEN (UPDATE([AS_GEO_PositedAt])) THEN [i].[AS_GEO_PositedAt] ELSE @Now END,
    [i].[AS_GEO_PositReliability]
    FROM @Inserted [i]
    INNER JOIN
    @GEO_Posit [p]
    ON [p].[AS_GEO_Checksum] = [i].[AS_GEO_Checksum];
    INSERT INTO [org].[AS_GEO_Assets_Location_Annex]
    [AS_GEO_ID],
    [AS_GEO_PositedBy],
    [AS_GEO_PositedAt],
    [AS_GEO_PositReliability]
    SELECT
    [i].[AS_GEO_ID],
    CASE WHEN (UPDATE([AS_GEO_PositedBy])) THEN [i].[AS_GEO_PositedBy] ELSE @PositedBy END,
    CASE WHEN (UPDATE([AS_GEO_PositedAt])) THEN [i].[AS_GEO_PositedAt] ELSE @Now END,
    [i].[AS_GEO_PositReliability]
    FROM [inserted] [i]
    LEFT OUTER JOIN
    @GEO_Posit [p]
    ON [p].[AS_GEO_Checksum] = BINARY_CHECKSUM([i].[AS_GEO_Longitude_Deg], [i].[AS_GEO_Latitude_Deg])
    WHERE
    [p].[AS_GEO_ID] IS NULL;
    END;
    GO
    CREATE TRIGGER [org].[AS_Assets_Current_Delete]
    ON [org].[AS_Assets_Current]
    INSTEAD OF DELETE
    AS
    BEGIN
    SET NOCOUNT ON;
    DECLARE @Now DATETIMEOFFSET(7) = SYSDATETIMEOFFSET();
    DECLARE @PositedBy INT;
    EXECUTE @PositedBy = [posit].[Return_PositorId];
    INSERT INTO [org].[AS_NME_Assets_Name_Annex]
    [AS_NME_ID],
    [AS_NME_PositedBy],
    [AS_NME_PositedAt],
    [AS_NME_PositReliability]
    SELECT
    [d].[AS_NME_ID],
    @PositedBy,
    @Now,
    0
    FROM
    [deleted] [d];
    INSERT INTO [org].[AS_GEO_Assets_Location_Annex]
    [AS_GEO_ID],
    [AS_GEO_PositedBy],
    [AS_GEO_PositedAt],
    [AS_GEO_PositReliability]
    SELECT
    [d].[AS_GEO_ID],
    @PositedBy,
    @Now,
    0
    FROM
    [deleted] [d];
    END;
    GO
    INSERT INTO [org].[AS_Assets_Current]
    [AS].[AS_NME_AssetTag],
    [AS].[AS_NME_AssetName],
    [AS].[AS_NME_AssetDetail],
    [AS].[AS_GEO_Longitude_Deg],
    [AS].[AS_GEO_Latitude_Deg]
    SELECT
    [AS].[AS_NME_AssetTag],
    [AS].[AS_NME_AssetName],
    [AS].[AS_NME_AssetDetail],
    [AS].[AS_GEO_Longitude_Deg],
    [AS].[AS_GEO_Latitude_Deg]
    FROM (VALUES
    ('999', 'Dallas Test 3', 'Dallas Test 3', NULL, NULL, 'Plant', 'AUT', NULL)
    ) [AS]([AS_NME_AssetTag], [AS_NME_AssetName], [AS_NME_AssetDetail], [AS_GEO_Longitude_Deg], [AS_GEO_Latitude_Deg], [CN_ADD_Type_ID], [CN_ADD_Country_ID], [CN_ADD_State]);
    GO

  • ORA-07445 in the alert log when inserting into table with XMLType column

    I'm trying to insert an xml-document into a table with a schema-based XMLType column. When I try to insert a row (using plsql-developer) - oracle is busy for a few seconds and then the connection to oracle is lost.
    Below you''ll find the following to recreate the problem:
    a) contents from the alert log
    b) create script for the table
    c) the before-insert trigger
    d) the xml-schema
    e) code for registering the schema
    f) the test program
    g) platform information
    Alert Log:
    Fri Aug 17 00:44:11 2007
    Errors in file /oracle/app/oracle/product/10.2.0/db_1/admin/dntspilot2/udump/dntspilot2_ora_13807.trc:
    ORA-07445: exception encountered: core dump [SIGSEGV] [Address not mapped to object] [475177] [] [] []
    Create script for the table:
    CREATE TABLE "DNTSB"."SIGNATURETABLE"
    (     "XML_DOCUMENT" "SYS"."XMLTYPE" ,
    "TS" TIMESTAMP (6) WITH TIME ZONE NOT NULL ENABLE
    ) XMLTYPE COLUMN "XML_DOCUMENT" XMLSCHEMA "http://www.sporfori.fo/schemas/www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd" ELEMENT "Object"
    ROWDEPENDENCIES ;
    Before-insert trigger:
    create or replace trigger BIS_SIGNATURETABLE
    before insert on signaturetable
    for each row
    declare
    -- local variables here
    l_sigtab_rec signaturetable%rowtype;
    begin
    if (:new.xml_document is not null) then
    :new.xml_document.schemavalidate();
    end if;
    l_sigtab_rec.xml_document := :new.xml_document;
    end BIS_SIGNATURETABLE2;
    XML-Schema (xmldsig-core-schema.xsd):
    =====================================================================================
    <?xml version="1.0" encoding="utf-8"?>
    <!-- Schema for XML Signatures
    http://www.w3.org/2000/09/xmldsig#
    $Revision: 1.1 $ on $Date: 2002/02/08 20:32:26 $ by $Author: reagle $
    Copyright 2001 The Internet Society and W3C (Massachusetts Institute
    of Technology, Institut National de Recherche en Informatique et en
    Automatique, Keio University). All Rights Reserved.
    http://www.w3.org/Consortium/Legal/
    This document is governed by the W3C Software License [1] as described
    in the FAQ [2].
    [1] http://www.w3.org/Consortium/Legal/copyright-software-19980720
    [2] http://www.w3.org/Consortium/Legal/IPR-FAQ-20000620.html#DTD
    -->
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xdb="http://xmlns.oracle.com/xdb"
    targetNamespace="http://www.w3.org/2000/09/xmldsig#" version="0.1" elementFormDefault="qualified">
    <!-- Basic Types Defined for Signatures -->
    <xs:simpleType name="CryptoBinary">
    <xs:restriction base="xs:base64Binary">
    </xs:restriction>
    </xs:simpleType>
    <!-- Start Signature -->
    <xs:element name="Signature" type="ds:SignatureType"/>
    <xs:complexType name="SignatureType">
    <xs:sequence>
    <xs:element ref="ds:SignedInfo"/>
    <xs:element ref="ds:SignatureValue"/>
    <xs:element ref="ds:KeyInfo" minOccurs="0"/>
    <xs:element ref="ds:Object" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="Id" type="xs:ID" use="optional"/>
    </xs:complexType>
    <xs:element name="SignatureValue" type="ds:SignatureValueType"/>
    <xs:complexType name="SignatureValueType">
    <xs:simpleContent>
    <xs:extension base="xs:base64Binary">
    <xs:attribute name="Id" type="xs:ID" use="optional"/>
    </xs:extension>
    </xs:simpleContent>
    </xs:complexType>
    <!-- Start SignedInfo -->
    <xs:element name="SignedInfo" type="ds:SignedInfoType"/>
    <xs:complexType name="SignedInfoType">
    <xs:sequence>
    <xs:element ref="ds:CanonicalizationMethod"/>
    <xs:element ref="ds:SignatureMethod"/>
    <xs:element ref="ds:Reference" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="Id" type="xs:ID" use="optional"/>
    </xs:complexType>
    <xs:element name="CanonicalizationMethod" type="ds:CanonicalizationMethodType"/>
    <xs:complexType name="CanonicalizationMethodType" mixed="true">
    <xs:sequence>
    <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded"/>
    <!-- (0,unbounded) elements from (1,1) namespace -->
    </xs:sequence>
    <xs:attribute name="Algorithm" type="xs:anyURI" use="required"/>
    </xs:complexType>
    <xs:element name="SignatureMethod" type="ds:SignatureMethodType"/>
    <xs:complexType name="SignatureMethodType" mixed="true">
    <xs:sequence>
    <xs:element name="HMACOutputLength" minOccurs="0" type="ds:HMACOutputLengthType"/>
    <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    <!-- (0,unbounded) elements from (1,1) external namespace -->
    </xs:sequence>
    <xs:attribute name="Algorithm" type="xs:anyURI" use="required"/>
    </xs:complexType>
    <!-- Start Reference -->
    <xs:element name="Reference" type="ds:ReferenceType"/>
    <xs:complexType name="ReferenceType">
    <xs:sequence>
    <xs:element ref="ds:Transforms" minOccurs="0"/>
    <xs:element ref="ds:DigestMethod"/>
    <xs:element ref="ds:DigestValue"/>
    </xs:sequence>
    <xs:attribute name="Id" type="xs:ID" use="optional"/>
    <xs:attribute name="URI" type="xs:anyURI" use="optional"/>
    <xs:attribute name="Type" type="xs:anyURI" use="optional"/>
    </xs:complexType>
    <xs:element name="Transforms" type="ds:TransformsType"/>
    <xs:complexType name="TransformsType">
    <xs:sequence>
    <xs:element ref="ds:Transform" maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    <xs:element name="Transform" type="ds:TransformType"/>
    <xs:complexType name="TransformType" mixed="true">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
    <xs:any namespace="##other" processContents="lax"/>
    <!-- (1,1) elements from (0,unbounded) namespaces -->
    <xs:element name="XPath" type="xs:string"/>
    </xs:choice>
    <xs:attribute name="Algorithm" type="xs:anyURI" use="required"/>
    </xs:complexType>
    <!-- End Reference -->
    <xs:element name="DigestMethod" type="ds:DigestMethodType"/>
    <xs:complexType name="DigestMethodType" mixed="true">
    <xs:sequence>
    <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="Algorithm" type="xs:anyURI" use="required"/>
    </xs:complexType>
    <xs:element name="DigestValue" type="ds:DigestValueType"/>
    <xs:simpleType name="DigestValueType">
    <xs:restriction base="xs:base64Binary"/>
    </xs:simpleType>
    <!-- End SignedInfo -->
    <!-- Start KeyInfo -->
    <xs:element name="KeyInfo" type="ds:KeyInfoType"/>
    <xs:complexType name="KeyInfoType" mixed="true">
    <xs:choice maxOccurs="unbounded">
    <xs:element ref="ds:KeyName"/>
    <xs:element ref="ds:KeyValue"/>
    <xs:element ref="ds:RetrievalMethod"/>
    <xs:element ref="ds:X509Data"/>
    <xs:element ref="ds:PGPData"/>
    <xs:element ref="ds:SPKIData"/>
    <xs:element ref="ds:MgmtData"/>
    <xs:any processContents="lax" namespace="##other"/>
    <!-- (1,1) elements from (0,unbounded) namespaces -->
    </xs:choice>
    <xs:attribute name="Id" type="xs:ID" use="optional"/>
    </xs:complexType>
    <xs:element name="KeyName" type="xs:string"/>
    <xs:element name="MgmtData" type="xs:string"/>
    <xs:element name="KeyValue" type="ds:KeyValueType"/>
    <xs:complexType name="KeyValueType" mixed="true">
    <xs:choice>
    <xs:element ref="ds:DSAKeyValue"/>
    <xs:element ref="ds:RSAKeyValue"/>
    <xs:any namespace="##other" processContents="lax"/>
    </xs:choice>
    </xs:complexType>
    <xs:element name="RetrievalMethod" type="ds:RetrievalMethodType"/>
    <xs:complexType name="RetrievalMethodType">
    <xs:sequence>
    <xs:element ref="ds:Transforms" minOccurs="0"/>
    </xs:sequence>
    <xs:attribute name="URI" type="xs:anyURI"/>
    <xs:attribute name="Type" type="xs:anyURI" use="optional"/>
    </xs:complexType>
    <!-- Start X509Data -->
    <xs:element name="X509Data" type="ds:X509DataType"/>
    <xs:complexType name="X509DataType">
    <xs:sequence maxOccurs="unbounded">
    <xs:choice>
    <xs:element name="X509IssuerSerial" type="ds:X509IssuerSerialType"/>
    <xs:element name="X509SKI" type="xs:base64Binary"/>
    <xs:element name="X509SubjectName" type="xs:string"/>
    <xs:element name="X509Certificate" type="xs:base64Binary"/>
    <xs:element name="X509CRL" type="xs:base64Binary"/>
    <xs:any namespace="##other" processContents="lax"/>
    </xs:choice>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="X509IssuerSerialType">
    <xs:sequence>
    <xs:element name="X509IssuerName" type="xs:string"/>
    <xs:element name="X509SerialNumber" type="xs:integer"/>
    </xs:sequence>
    </xs:complexType>
    <!-- End X509Data -->
    <!-- Begin PGPData -->
    <xs:element name="PGPData" type="ds:PGPDataType"/>
    <xs:complexType name="PGPDataType">
    <xs:choice>
    <xs:sequence>
    <xs:element name="PGPKeyID" type="xs:base64Binary"/>
    <xs:element name="PGPKeyPacket" type="xs:base64Binary" minOccurs="0"/>
    <xs:any namespace="##other" processContents="lax" minOccurs="0"
    maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:sequence>
    <xs:element name="PGPKeyPacket" type="xs:base64Binary"/>
    <xs:any namespace="##other" processContents="lax" minOccurs="0"
    maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:choice>
    </xs:complexType>
    <!-- End PGPData -->
    <!-- Begin SPKIData -->
    <xs:element name="SPKIData" type="ds:SPKIDataType"/>
    <xs:complexType name="SPKIDataType">
    <xs:sequence maxOccurs="unbounded">
    <xs:element name="SPKISexp" type="xs:base64Binary"/>
    <xs:any namespace="##other" processContents="lax" minOccurs="0"/>
    </xs:sequence>
    </xs:complexType>
    <!-- End SPKIData -->
    <!-- End KeyInfo -->
    <!-- Start Object (Manifest, SignatureProperty) -->
    <xs:element name="Object" type="ds:ObjectType"/>
    <xs:complexType name="ObjectType" mixed="true">
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
    <xs:any namespace="##any" processContents="lax"/>
    </xs:sequence>
    <xs:attribute name="Id" type="xs:ID" use="optional"/>
    <xs:attribute name="MimeType" type="xs:string" use="optional"/> <!-- add a grep facet -->
    <xs:attribute name="Encoding" type="xs:anyURI" use="optional"/>
    </xs:complexType>
    <xs:element name="Manifest" type="ds:ManifestType"/>
    <xs:complexType name="ManifestType">
    <xs:sequence>
    <xs:element ref="ds:Reference" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="Id" type="xs:ID" use="optional"/>
    </xs:complexType>
    <xs:element name="SignatureProperties" type="ds:SignaturePropertiesType"/>
    <xs:complexType name="SignaturePropertiesType">
    <xs:sequence>
    <xs:element ref="ds:SignatureProperty" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="Id" type="xs:ID" use="optional"/>
    </xs:complexType>
    <xs:element name="SignatureProperty" type="ds:SignaturePropertyType"/>
    <xs:complexType name="SignaturePropertyType" mixed="true">
    <xs:choice maxOccurs="unbounded">
    <xs:any namespace="##other" processContents="lax"/>
    <!-- (1,1) elements from (1,unbounded) namespaces -->
    </xs:choice>
    <xs:attribute name="Target" type="xs:anyURI" use="required"/>
    <xs:attribute name="Id" type="xs:ID" use="optional"/>
    </xs:complexType>
    <!-- End Object (Manifest, SignatureProperty) -->
    <!-- Start Algorithm Parameters -->
    <xs:simpleType name="HMACOutputLengthType">
    <xs:restriction base="xs:integer"/>
    </xs:simpleType>
    <!-- Start KeyValue Element-types -->
    <xs:element name="DSAKeyValue" type="ds:DSAKeyValueType"/>
    <xs:complexType name="DSAKeyValueType">
    <xs:sequence>
    <xs:sequence minOccurs="0">
    <xs:element name="P" type="ds:CryptoBinary"/>
    <xs:element name="Q" type="ds:CryptoBinary"/>
    </xs:sequence>
    <xs:element name="G" type="ds:CryptoBinary" minOccurs="0"/>
    <xs:element name="Y" type="ds:CryptoBinary"/>
    <xs:element name="J" type="ds:CryptoBinary" minOccurs="0"/>
    <xs:sequence minOccurs="0">
    <xs:element name="Seed" type="ds:CryptoBinary"/>
    <xs:element name="PgenCounter" type="ds:CryptoBinary"/>
    </xs:sequence>
    </xs:sequence>
    </xs:complexType>
    <xs:element name="RSAKeyValue" type="ds:RSAKeyValueType"/>
    <xs:complexType name="RSAKeyValueType">
    <xs:sequence>
    <xs:element name="Modulus" type="ds:CryptoBinary"/>
    <xs:element name="Exponent" type="ds:CryptoBinary"/>
    </xs:sequence>
    </xs:complexType>
    <!-- End KeyValue Element-types -->
    <!-- End Signature -->
    </xs:schema>
    ===============================================================================
    Code for registering the xml-schema
    begin
    dbms_xmlschema.deleteSchema('http://xmlns.oracle.com/xdb/schemas/DNTSB/www.sporfori.fo/schemas/www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd',
    dbms_xmlschema.DELETE_CASCADE_FORCE);
    end;
    begin
    DBMS_XMLSCHEMA.REGISTERURI(
    schemaurl => 'http://www.sporfori.fo/schemas/www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd',
    schemadocuri => 'http://www.sporfori.fo/schemas/www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd',
    local => TRUE,
    gentypes => TRUE,
    genbean => FALSE,
    gentables => TRUE,
    force => FALSE,
    owner => 'DNTSB',
    options => 0);
    end;
    Test program
    -- Created on 17-07-2006 by EEJ
    declare
    XML_TEXT3 CLOB := '<Object xmlns="http://www.w3.org/2000/09/xmldsig#">
                                  <SignatureProperties>
                                       <SignatureProperty Target="">
                                            <Timestamp xmlns="http://www.sporfori.fo/schemas/dnts/general/2006/11/14">2007-05-10T12:00:00-05:00</Timestamp>
                                       </SignatureProperty>
                                  </SignatureProperties>
                             </Object>';
    xmldoc xmltype;
    begin
    xmldoc := xmltype(xml_text3);
    insert into signaturetable
    (xml_document, ts)
    values
    (xmldoc, current_timestamp);
    end;
    Platform information
    Operating system:
    -bash-3.00$ uname -a
    SunOS dntsdb 5.10 Generic_125101-09 i86pc i386 i86pc
    SQLPlus:
    SQL*Plus: Release 10.2.0.3.0 - Production on Fri Aug 17 00:15:13 2007
    Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
    Enter password:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
    With the Partitioning and Data Mining options
    Kind Regards,
    Eyðun

    You should report this in a service request on http://metalink.oracle.com.
    It is a shame that you put all the effort here to describe your problem, but on the other hand you can now also copy & paste the question to Oracle Support.
    Because you are using 10.2.0.3; I am guessing that you have a valid service contract...

  • ORA-06502: error when inserting into table via db link with long datatype

    Folks,
    I am getting the following error:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small.
    This occurs when an insert is done via a database link into a table that has a LONG data type for one of the columns, and the string contains some carriage returns and or line feeds.
    I have checked by removing the db link, and inserting into a local table with identical column data types, where there is no error.
    So this might be another db link bug?
    So I need to remove the carriage returns and/or line feeds
    in my pl/sql block in the page process. I have tried
    l_text := REPLACE(l_text, CHR(10), ' ');
    l_text := REPLACE(l_text, CHR(13), NULL);
    but still getting the ORA-06502. Would really appreciate some advice here, please.
    Cheers
    KIM

    Scott,
    Time to 'fess up':
    My fault sorry, the error was coming from another page process where I had allowed insufficient string length for one of the variables, and my error message did not identify the page process clearly.
    This leads me to make a request for future releases, could the system error messages state which page process caused the problem?
    One other thing I notice, and this might be a feature not a fault, the page processes are numbered: "Page Process:      3 of 5". However process 3 is not the 3rd one to be processed, and probably refers to the order in which they are created. Should the number reflect the process order?
    Cheers
    KIM

  • Inconsistent datatypes error when inserting into a object

    I am trying to insert some test data into the table emp.I have managed to succesfully create the objects and types but when I try to insert into the emp table I get a inconsistent datatypes error however I have checked the datatypes and they all seem fine. Can anyone help me.
    thanks
    CREATE OR REPLACE TYPE Address_T AS object
    (ADDR1                VC2_40,
    ADDR2               VC2_40,
    CITY_TX          VC2_40,
    COUNTY_CD          VC2_40,
    POST_CD          VC2_40);
    CREATE OR REPLACE TYPE PERSON_T AS OBJECT (
    LNAME_TX           NAME_T,
    FNAME_TX           NAME_T,
    BIRTH_DATE          DATE,
    TELEPHONE          VC2_20,
    EMAIL               VC2_40);
    CREATE OR REPLACE TYPE EMP_T AS OBJECT (
    EMP_ID     NUMBER (10),
    PERSON     PERSON_T,
    ADDRESS ADDRESS_T,
    HIRE_DATE DATE)
    CREATE TABLE EMP OF EMP_T
    (EMP_ID NOT NULL PRIMARY KEY);
    INSERT INTO EMP VALUES (1,           
    PERSON_T('PETCH',
    'GAVIN',
    '23-JAN-80',
    '(01964)550700',
    '[email protected]'),
    ADDRESS_T('67 CANADA',
    'WALKINGTON',
    'BEVERLEY',
    'EAST YORKSHIRE',
    'HU17 7RL'),
    '11-FEB-02'
    ERROR at line 1:
    ORA-00932: inconsistent datatypes

    Gavin,
    What is your VC2_40 and NAME_T type definition? Your insert used these as varchar2, which is a built-in type not a user-defined type. If you explicitly define these to be varchar2's, the insert statement works fine.
    Regards,
    Geoff
    I am trying to insert some test data into the table emp.I have managed to succesfully create the objects and types but when I try to insert into the emp table I get a inconsistent datatypes error however I have checked the datatypes and they all seem fine. Can anyone help me.
    thanks
    CREATE OR REPLACE TYPE Address_T AS object
    (ADDR1                VC2_40,
    ADDR2               VC2_40,
    CITY_TX          VC2_40,
    COUNTY_CD          VC2_40,
    POST_CD          VC2_40);
    CREATE OR REPLACE TYPE PERSON_T AS OBJECT (
    LNAME_TX           NAME_T,
    FNAME_TX           NAME_T,
    BIRTH_DATE          DATE,
    TELEPHONE          VC2_20,
    EMAIL               VC2_40);
    CREATE OR REPLACE TYPE EMP_T AS OBJECT (
    EMP_ID     NUMBER (10),
    PERSON     PERSON_T,
    ADDRESS ADDRESS_T,
    HIRE_DATE DATE)
    CREATE TABLE EMP OF EMP_T
    (EMP_ID NOT NULL PRIMARY KEY);
    INSERT INTO EMP VALUES (1,           
    PERSON_T('PETCH',
    'GAVIN',
    '23-JAN-80',
    '(01964)550700',
    '[email protected]'),
    ADDRESS_T('67 CANADA',
    'WALKINGTON',
    'BEVERLEY',
    'EAST YORKSHIRE',
    'HU17 7RL'),
    '11-FEB-02'
    ERROR at line 1:
    ORA-00932: inconsistent datatypes

  • Float truncated when inserted into table

    Hi,
    I'm trying to insert float values into a table with a column of type NUMBER(4,2) and the values are getting truncated to integer values. My environment is :
    Database: Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production
    jdbc lib: 9.0.1.4
    I tried it with the jdbc lib version 9.0.1 and it works, but I didn't figure a way to use it, since I'm using it in a 9iAS environment and there's no driver classes12dms.jar for this version. If I try to use the classes12.zip version I get an exception when trying to access the database complaining about some classes missing (These classes missing are in the classes12dms.jar)
    Here's a simple test case:
    import java.sql.*;
    public class TesteFloat {
    public TesteFloat() {
    public static void main(String[] args) {
    Connection con = null;
    PreparedStatement stmt = null;
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:hal9000","kitbordo","kitbordo");
    stmt = con.prepareStatement("insert into teste (teste) values (?)");
    for (int i = 0; i < 10; i++) {
    stmt.setFloat(1,2.32f * i );
    //stmt.addBatch();
    stmt.executeUpdate();
    //stmt.executeBatch();
    con.commit();
    } catch (Exception e) {
    e.printStackTrace();
    } finally {
    if (con != null) {
    try {
    con.close();
    } catch (SQLException e) {
    CREATE TABLE TESTE
    TESTE NUMBER(4,2)
    )

    Hi,
    I'm trying to insert float values into a table with a column of type NUMBER(4,2) and the values are getting truncated to integer values. My environment is :
    Database: Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production
    jdbc lib: 9.0.1.4
    I tried it with the jdbc lib version 9.0.1 and it works, but I didn't figure a way to use it, since I'm using it in a 9iAS environment and there's no driver classes12dms.jar for this version. If I try to use the classes12.zip version I get an exception when trying to access the database complaining about some classes missing (These classes missing are in the classes12dms.jar)
    Here's a simple test case:
    import java.sql.*;
    public class TesteFloat {
    public TesteFloat() {
    public static void main(String[] args) {
    Connection con = null;
    PreparedStatement stmt = null;
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:hal9000","kitbordo","kitbordo");
    stmt = con.prepareStatement("insert into teste (teste) values (?)");
    for (int i = 0; i < 10; i++) {
    stmt.setFloat(1,2.32f * i );
    //stmt.addBatch();
    stmt.executeUpdate();
    //stmt.executeBatch();
    con.commit();
    } catch (Exception e) {
    e.printStackTrace();
    } finally {
    if (con != null) {
    try {
    con.close();
    } catch (SQLException e) {
    CREATE TABLE TESTE
    TESTE NUMBER(4,2)
    )

  • 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

  • Error when inserting into table - Undefined Variable

    DB = Oracle 10.2.0.1
    WEBSERV = Apache 2.0.55
    LANG = PHP5
    I have created (or more accurately, copied) a php script to insert data into one of my database tables when I press submit. The code is as follows (my connect string works fine and its included in the dbutils.php file):
    <?php
    if($submit == "submit"){
    include "dbutils.php";
      $query = "insert into users values (seq_user_usr_id.NEXTVAL, '$usr_name')";
      $cursor = OCIParse ($db_conn, $query);
      if ($cursor == false){
        echo OCIError($cursor)."<BR>";
        exit;
      $result = OCIExecute ($cursor);
      if ($result == false){
        echo OCIError($cursor)."<BR>";
        exit;
      OCICommit ($db_conn);
      OCILogoff ($db_conn);
    else{
       echo '
        <html><body>
        <form method="post" action="index.php">
    <table width="400" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td>Please enter a username:</td>
        <td><input type="text" name="usr_name"></input><br></td>
    </tr>
    <tr>
        <td><input type="submit" name="button" value="Submit"></input></td>
    </tr>
    </table>
        </form>
        </body></html>
    ?></p>I am getting the following error regarding an undefined variable:
    [Fri Jan 20 13:11:22 2006] [error] [client 127.0.0.1] PHP Notice: Undefined variable: submit in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\mywebsite\\test.php on line 3
    Where would I declare this variable? It is just a check to see if the submit button is pressed as far as I can see. Any help would be greatfully appreciated.
    W8

    I have changed the code to this:
    <?php
    if($submit == "submit"){
    include "dbutils.php";
    $usr_name = $_POST['usr_name'];
    $query = "insert into users (column1, column2) values (seq_user_usr_id.NEXTVAL, '$usr_name')";
    $cursor = OCIParse ($db_conn, $query);
    if ($cursor == false){
    echo OCIError($cursor)."
    exit;
    $result = OCIExecute ($cursor);
    if ($result == false){
    echo OCIError($cursor)."
    exit;
    OCICommit ($db_conn);
    OCILogoff ($db_conn);
    else{
    $submit = $_POST['submit'];
    echo '
    <html><body>
    <form method="post" action="index.php">
    <table width="400" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td>Please enter a username:</td>
    <td><input type="text" name="usr_name"></input>
    </td>
    </tr>
    <tr>
    <td><input type="submit" name="submit" value="submit"></input></td>
    </tr>
    </table>
    </form>
    </body></html>
    ?>And now I am getting the following error:
    [Mon Jan 23 13:45:32 2006] [error] [client 127.0.0.1] PHP Notice:  Undefined index:  submit in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\mywebsite\\test2.php on line 24Does anyone have any ideas?
    I am struggling to find an example to work from to get this working. If anyone can point me to any literature that will explain the code so that I can work this out for myself that would also be a great help.

  • SQL Query produces different results when inserting into a table

    I have an SQL query which produces different results when run as a simple query to when it is run as an INSERT INTO table SELECT ...
    The query is:
    SELECT   mhldr.account_number
    ,        NVL(MAX(DECODE(ap.party_sysid, mhldr.party_sysid,ap.empcat_code,NULL)),'UNKNWN') main_borrower_status
    ,        COUNT(1) num_apps
    FROM     app_parties ap
    SELECT   accsta.account_number
    ,        actply.party_sysid
    ,        RANK() OVER (PARTITION BY actply.table_sysid, actply.loanac_latype_code ORDER BY start_date, SYSID) ranking
    FROM     activity_players actply
    ,        account_status accsta
    WHERE    1 = 1
    AND      actply.table_id (+) = 'ACCGRP'
    AND      actply.acttyp_code (+) = 'MHLDRM'
    AND      NVL(actply.loanac_latype_code (+),TO_NUMBER(SUBSTR(accsta.account_number,9,2))) = TO_NUMBER(SUBSTR(accsta.account_number,9,2))
    AND      actply.table_sysid (+) = TO_NUMBER(SUBSTR(accsta.account_number,1,8))
    ) mhldr
    WHERE    1 = 1
    AND      ap.lenapp_account_number (+) = TO_NUMBER(SUBSTR(mhldr.account_number,1,8))
    GROUP BY mhldr.account_number;      The INSERT INTO code:
    TRUNCATE TABLE applicant_summary;
    INSERT /*+ APPEND */
    INTO     applicant_summary
    (  account_number
    ,  main_borrower_status
    ,  num_apps
    SELECT   mhldr.account_number
    ,        NVL(MAX(DECODE(ap.party_sysid, mhldr.party_sysid,ap.empcat_code,NULL)),'UNKNWN') main_borrower_status
    ,        COUNT(1) num_apps
    FROM     app_parties ap
    SELECT   accsta.account_number
    ,        actply.party_sysid
    ,        RANK() OVER (PARTITION BY actply.table_sysid, actply.loanac_latype_code ORDER BY start_date, SYSID) ranking
    FROM     activity_players actply
    ,        account_status accsta
    WHERE    1 = 1
    AND      actply.table_id (+) = 'ACCGRP'
    AND      actply.acttyp_code (+) = 'MHLDRM'
    AND      NVL(actply.loanac_latype_code (+),TO_NUMBER(SUBSTR(accsta.account_number,9,2))) = TO_NUMBER(SUBSTR(accsta.account_number,9,2))
    AND      actply.table_sysid (+) = TO_NUMBER(SUBSTR(accsta.account_number,1,8))
    ) mhldr
    WHERE    1 = 1
    AND      ap.lenapp_account_number (+) = TO_NUMBER(SUBSTR(mhldr.account_number,1,8))
    GROUP BY mhldr.account_number;      When run as a query, this code consistently returns 2 for the num_apps field (for a certain group of accounts), but when run as an INSERT INTO command, the num_apps field is logged as 1. I have secured the tables used within the query to ensure that nothing is changing the data in the underlying tables.
    If I run the query as a cursor for loop with an insert into the applicant_summary table within the loop, I get the same results in the table as I get when I run as a stand alone query.
    I would appreciate any suggestions for what could be causing this odd behaviour.
    Cheers,
    Steve
    Oracle database details:
    Oracle Database 10g Release 10.2.0.2.0 - Production
    PL/SQL Release 10.2.0.2.0 - Production
    CORE 10.2.0.2.0 Production
    TNS for 32-bit Windows: Version 10.2.0.2.0 - Production
    NLSRTL Version 10.2.0.2.0 - Production
    Edited by: stevensutcliffe on Oct 10, 2008 5:26 AM
    Edited by: stevensutcliffe on Oct 10, 2008 5:27 AM

    stevensutcliffe wrote:
    Yes, using COUNT(*) gives the same result as COUNT(1).
    I have found another example of this kind of behaviour:
    Running the following INSERT statements produce different values for the total_amount_invested and num_records fields. It appears that adding the additional aggregation (MAX(amount_invested)) is causing problems with the other aggregated values.
    Again, I have ensured that the source data and destination tables are not being accessed / changed by any other processes or users. Is this potentially a bug in Oracle?Just as a side note, these are not INSERT statements but CTAS statements.
    The only non-bug explanation for this behaviour would be a potential query rewrite happening only under particular circumstances (but not always) in the lower integrity modes "trusted" or "stale_tolerated". So if you're not aware of any corresponding materialized views, your QUERY_REWRITE_INTEGRITY parameter is set to the default of "enforced" and your explain plan doesn't show any "MAT_VIEW REWRITE ACCESS" lines, I would consider this as a bug.
    Since you're running on 10.2.0.2 it's not unlikely that you hit one of the various "wrong result" bugs that exist(ed) in Oracle. I'm aware of a particular one I've hit in 10.2.0.2 when performing a parallel NESTED LOOP ANTI operation which returned wrong results, but only in parallel execution. Serial execution was showing the correct results.
    If you're performing parallel ddl/dml/query operations, try to do the same in serial execution to check if it is related to the parallel feature.
    You could also test if omitting the "APPEND" hint changes anything but still these are just workarounds for a buggy behaviour.
    I suggest to consider installing the latest patch set 10.2.0.4 but this requires thorough testing because there were (more or less) subtle changes/bugs introduced with [10.2.0.3|http://oracle-randolf.blogspot.com/2008/02/nasty-bug-introduced-with-patch-set.html] and [10.2.0.4|http://oracle-randolf.blogspot.com/2008/04/overview-of-new-and-changed-features-in.html].
    You could also open a SR with Oracle and clarify if there is already a one-off patch available for your 10.2.0.2 platform release. If not it's quite unlikely that you are going to get a backport for 10.2.0.2.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Insert into NVARCHAR2 columns(ORA_01461, ORA-01026)

    Hi,
    Oracle8i Client 8.1.5 (OCI8)
    Oracle9i Client 9.0.1 (OCI9)
    Oracle8i/9i DB
    I want to insert strings into a table with two NVARCHAR2 columns with OCI.
    NLS_NCHAR_CHARACTERSET is UTF8 (DB). The provided String is encoded in Windows-1252.
    The supplied buffers in the OCIBindByPos have a size of 200bytes each.
    ->With OCI8 I'm getting the message:
    "ORA-01026 multiple buffers of size > 4000 in the bind list"
    If only one NVARCHAR2 column is involved (or if I use normal
    VARCHAR2 instead) it works fine.
    ->With OCI9 I get the message:
    "ORA-01461 can bind a LONG value only for insert into a LONG column"
    But only, if I set the OCI_ATTR_MAXDATA_SIZE attribute.
    If I do not set the OCI_ATTR_MAXDATA_SIZE attribute, it works, but if
    I supply a buffer bigger than 1333 bytes in the OCIBindByPos for the second
    NVARCHAR2 column, then ORA_01461 happens. The buffer for the first NVARCHAR2
    column can be set to a higher values
    ->The same behaviour occurs with NCHAR, NCLOB (->national character types)
    These are the main steps:
    OCIBindByPos((OCIStmt *) pStmtInsert, (OCIBind **) &pBind,
    (OCIError *) pError, (ub4) i, (dvoid *)pData,
    (sb4) bufferSize, //200bytes
    (ub2) dataTypeSQLT, //SQLT_STR
    (dvoid *) pIndicator, (ub2 *) 0, (ub2 *) 0, (ub4) 0,
              (ub4 *) 0, (ub4) OCI_DEFAULT);
    OCIAttrSet((dvoid *) pBind, OCI_HTYPE_BIND,
    &Frm, //SQLCS_NCHAR
         0, OCI_ATTR_CHARSET_FORM, (OCIError *) pError);
    OCIAttrSet((dvoid *) pBind, OCI_HTYPE_BIND,
    (dvoid *) &charSet, //WE8MSWIN1252
         0, OCI_ATTR_CHARSET_ID, (OCIError *) pError);
    OCIAttrSet((dvoid *) pBind, OCI_HTYPE_BIND,
    (dvoid *) &maxDataSize, //->size of the column in bytes
    0, OCI_ATTR_MAXDATA_SIZE, (OCIError *) pError);
    OCIStmtExecute((OCISvcCtx *) pServiceContext, (OCIStmt *) pStmtInsert,(OCIError *) pError,
    (ub4) 1, (ub4) 0, (OCISnapshot *) 0, (OCISnapshot *) 0,
    OCI_COMMIT_ON_SUCCESS);
    Any ideas?
    Thanks,
    Axel

    I found this link referring to a similar problem that was apparently fixed in version 10.2.0.4 of the server: ORA-01461: can bind a LONG value only for insert into a LONG column Should I try to upgrade the server and see if that fixes things?

  • Performance issue when inserting into spatial indexed table with JDBC

    We have a table named 'feature' which has a "sdo_geometry" column, and we created spatial index on that column,
    CREATE TABLE feature ( id number, desc varchar, oshape sdo_gemotry)
    CREATE INDEX feature_sp_idx ON feature(oshape) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
    Then we executed the following SQL to insert about 800 records into that table(We tried this by using DB visualizer and
    our Java application, both of them were using JDBC driver to connect to the oracle 11gR2 database) .
    insert into feature(id,desc,oshape) values (1001,xxx,xxxxx);
    insert into feature (id,desc,oshape) values (1002,xxx,xxxxx);
    insert into feature (id,desc,oshape) values (1800,xxx,xxxxx);
    We encoutered the same problem as this topic
    Performance of insert with spatial index
    It takes nearly 1 secs for inserting one record,compare to 50 records inserted per sec without spatial index,
    which is 50x drop in peformance when doing insertion with spatial index.
    However, when we copy and paste those insertion scripts into Oracle Client(same test and same table with spatial index), we got a totally different performance result:
    more than 50 records inserted in 1 secs, just as fast as the insertion without building spatial index.
    Is it because Oracle Client is not using JDBC? Perhaps JDBC was got something wrong when updating those spatial indexed tables.
    Edited by: 860605 on 19/09/2011 18:57
    Edited by: 860605 on 19/09/2011 18:58
    Edited by: 860605 on 19/09/2011 19:00

    Normally JDBC use auto-commit. So each insert can causes a commit.
    I don't know about Oracle Client. In sqlplus, insert is just a insert,
    and you execute "commit" to explicitly commit your changes.
    So maybe this is the reason.

  • Incorrect data value when insert into oracle table

    Would like to ask expert here, how could I insert data into oracle table where the value is 03 ? The case is like that,  the column was defined as varchar2(50) data type, and I have a csv file where the value is 03 but when load into oracle table the value become 3 instead of 03.

    user11432758 wrote:
    Would like to ask expert here, how could I insert data into oracle table where the value is 03 ? The case is like that,  the column was defined as varchar2(50) data type, and I have a csv file where the value is 03 but when load into oracle table the value become 3 instead of 03.
    implicit datatype conversion to NUMBER can result in leading zero to be eliminated.
    How do I ask a question on the forums?
    https://forums.oracle.com/message/9362002#9362002

Maybe you are looking for

  • Ready to take a swandive out the window after my computer!!!  Please help!!

    I am going nuts. I got an iPod Nano today, and being as I already had the iPod shuffle, I thought I could just hook it up and fly at 'er. But no... I am ready to pitch the computer out the window. I am given a message when I hook the nano up that I n

  • Adobe Acrobat XI Standard - SN issue

    I click on "Abobe Acrobat XI Standard".  "Validating Serial Number....".  Box pops up "Serial Number Upgrade".  I select the Product "Adobe Acrobat X Stqandard".  I enter the SN indicated on my order confirmation.  And click Next.  Immediately receiv

  • "Java Virtual Machine not loaded"

    I get this message every time I boot up. It just started recently. Anyone know how to fix that? Everything seems to run okay, but that annoying box pops up every time. "Java Virtual Machine not loaded" Thanks in advance. kar

  • Homesharing with more than 5 computers?

    So if I already have my iTunes account synced with 5 computers, but I don't use two of the computers anymore and they don't work to deactivate itunes, is there any way to share my music with one more computer?  Please help!

  • 2G died should I go for the Gs

    My original iphone just died..with my help (a drop) and I have the goPhone pick your plan option. As I understand it I am not eligible for an upgrade with the nice prices...so I have to purchase at full price and get a 2 year contract/.... I sooooooo