Create trigger automatic

Hi
I have oracle database 11gR2 . I dont have eny permission in datbase auditing,scn and ..... . I want to save all changes in database . i have 3 tables : tables , columns ,rowaction . in tables , saving name of all tables , in columns , saving name of all columns with tableid . I want to save old value and new value before and after insert in tables in rowaction table. So i should to create triggers for all tables in database automatically with procedure,that is run when insert or delete or update is occured . but I can not 'CREATE TRIGGER' in procedure .
in below you can see that procedure and trigger i wrote .
do you have any idea ?
Thanks
declare
      tablesid number ;
      tablenames varchar2(4000);
      cursor c1 is
      select id , title from hr.tables;
    begin
        open c1;
        loop
          fetch c1 into tablesid , tablenames;
         CREATE OR REPLACE TRIGGER tablenames||'_before_insert'
          before insert
          on hr.tablenames
          DECLARE
         columnid number ;
          columnval number ;
          columntitle varchar(4000);
          cursor c2 is
          select id from hr.columns where tableid = tablesid ;
          BEGIN
          -- open c2 ;
           for rec in c2 loop
           select title into columntitle from hr.columns where id = rec.id
           insert into hr.rowaction(columnid,newvalue,oldvalue,actiondate)
             select  id ,:new.columntitle,:old.columntitle,sysdate
             from hr.tabletiltes
             where id = rec.id
          select title into columntitle from hr.columns where id = rec.id;
          dbms_output.put_line(columntitle);
         end loop;
        end;
        end loop ;close c1; end;
>ORA-06550: line 11, column 6:
PLS-00103: Encountered the symbol "CREATE" when expecting one of the following:
   ( begin case declare end exit for goto if loop mod null
   pragma raise return select update while with <an identifier>
   <a double-quoted delimited-identifier> <a bind variable> <<
   continue close current delete fetch lock insert open rollback
   savepoint set sql execute commit forall merge pipe purge
06550. 00000 -  "line %s, column %s:\n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action :
Bind Variable "new" is NOT DECLARED
anonymous block completed
Bind Variable "new" is NOT DECLARED
anonymous block completed
Message was edited by: saeed.sh110

The explanation for this requirement is over on this thread: saving all action in database with triggers
(which is now locked)
I have oracle database 11gR2 . I dont have eny permission in datbase auditing,scn and ..... . I want to save all changes in database . i have 3 tables : tables , columns ,rowaction . in tables , saving name of all tables , in columns , saving name of all columns with tableid . I want to save old value and new value before and after insert in tables in rowaction table. So i should to create triggers for all tables in database automatically with procedure,that is run when insert or delete or update is occured . but I can not 'CREATE TRIGGER' in procedure .
Do you have any idea ?
Continuation for this question should be on this original thread.

Similar Messages

  • Use of "DBA_OBJECTS" in "AFTER CREATE" Trigger

    Hi,
    We would like to store some extra information about our objects we have in the database. To do so we tought of the idea of creating a 'documenting' table containing an object_id that references to the object_id from the view dba_views.
    Now we want to automatically create a new record in our documenting table when a new object is created, in the first stage this should only contain the object_id
    To accomplish this we are using an 'AFTER CREATE' trigger, but when this trigger fires and the code searches for the new object_id in dba_objects, it does not return any records and generates an error. Likely because when the trigger is executed, the view is not yet updated?
    create or replace
    TRIGGER TRG_TEST
    AFTER CREATE ON SCOTT.SCHEMA
    DECLARE
    tmp VARCHAR2(50);
    BEGIN
    dbms_output.put_line(ora_dict_obj_name);
    select object_id
    into tmp
    from dba_objects
    where object_name = ora_dict_obj_name;
    dbms_output.put_line(tmp);
    END;
    Error report:
    ORA-04088: Fout bij uitvoering van trigger 'SCOTT.TRG_TEST'.
    ORA-01403: Geen gegevens gevonden.
    ORA-06512: in regel 6
    04088. 00000 - "error during execution of trigger '%s.%s'"
    *Cause:    A runtime error occurred during execution of a trigger.
    *Action:   Check the triggers which were involved in the operation.
    It's in dutch, so I'll have a go at translating:
    Error report:
    ORA-04088: Exception while executing trigger 'SCOTT.TRG_TEST'.
    ORA-01403: No data found
    ORA-06512: in rule 6
    04088. 00000 - "error during execution of trigger '%s.%s'"
    *Cause:    A runtime error occurred during execution of a trigger.
    *Action:   Check the triggers which were involved in the operation.
    Does anyone have an idea of how I can accomplish what I'm trying to do here.. Or maybe something I'm doing wrong?
    Thanks in advance!
    Davy

    What is "ora_dict_obj_name" defined as?
    Another option might be to setup a DBMS_SCHEDULER job to run the following insert
    firstly though, create the following table ;
    create document_table as (select * from dba_objects where rownum < 1)and then setup a DBMS_SCHEDULER job to run the following:
    begin
      insert into document_table
      (select dbo.*
       from   dba_objects    dbo
             ,document_Table dtb
       where  dbo.Object_ID = dtb.Object_ID(+)
       and    dtb.Object_ID is null);
       commit;
       exception
        when others then
          rollback;
          -- log a message somewhere with the error, i.e. SQLERRM
    end;
    /Note, I specified all columns, but you'll probably specify explicitly which column you require, in which case the CREATE table would change as well.
    Then you won't have a need for any trigger, and can better manage when you want your documentation to be updated.
    Another option might be to use COMMENT, which can be used on tables, views, materialized views, but won't cover all objects
    to the extent you might want.
    SQL> desc emp2
    Name                                                                                                  
    EMPNO                                                                                                 
    JOB                                                                                                   
    START_DATE                                                                                            
    SAL                                                                                                   
    DEPT                                                                                                  
    END_DATE                                                                                              
    SQL> comment on column emp2.sal is 'Existing Salary of employee as paid at most recent month end';

  • Error in Creating Trigger

    Hi All,
    I have a problem in creating a trigger.
    I have two fields named last_updated_by, last_updated_date which
    r common to all the tables.
    If the user made any change to the exiting record, the values of
    the those two colums should get changed automatically with the
    username and sysdate.
    When I wrote a trigger its giving mutation error.
    Can I update these value by stored procedure via trigger?
    I heard its possible by DBMS_JOB package. Can anyone give idea?
    Thanks in Advance.
    Regards
    Gopinath Kona

    You should only get the mutating table probllem if you're doing
    SELCT or DML against the table the trigger's built on. Which
    suggests that you're approaching this the wrong way.
    Try CREATE TRIGGER blah blah
    FOR EACH ROW
    :new.last_updated_by := USER;
    :new.last_updated_date := SYSDATE;
    END;
    If that's what you are doing then the problem lies elsewhere.
    Rgds, APC

  • Process chain to trigger automatically after file arrives in AL11.

    Hi All,
    There is a text file(.txt) which comes from mainframes team every Sunday between 11 AM to 6 PM and gets placed in AL11 inbound directory following which we manually trigger a process chain which uses this file.
    The requirement is that this chain should trigger automatically after the file arrives in AL11 in BW.
    Is it necessary for the mainframe team to send another control file or some other file in addition to the text file to trigger this process chain..?
    Is there any other way the process chain can be triggered in BW without any changes required from the mainframe team.
    Additional information:
    Also I came to know that this can happen through some system command statements using SM49 we can schedule this chain.
    Else can some ABAP Program code be used to make this process automatic?
    Please help me.

    Hi,
    You can do the following, in your process chain change the start variant and make it event dependent. Now you can do the following,
    1) Create a table in SE11 which will have fields like Process chain name and execution date as primary fields. This table will be used further for checking purpose.
    2) Now create a ABAP program as shown in below given article, in this program in addition to raising an event you will have to read the file from app server.
    3) If program can read file from app server means you will raise an event and make entry in above table for preventing further execution of process chain. If program can't read file from app server then program will simply end without doing anything.
    4) Now you can schedule this program after every hour or 30 min. as per your requirement, the program will first check if the process chain execution entry exists in the above 'Z' table or not. If entry exists means the process chain has been already executed and the program will be terminated.
    5) You can use FM to read data from app server. You need to be careful while placing file on app server, because it has to be different naming convention or something else to identify that the current day file is available.
    [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a01cc44a-5aac-2d10-3eaa-a3bbf645d25c?QuickLink=index&overridelayout=true]
    Regards,
    Durgesh.

  • Create trigger and use "nextval" to get next sequence nbr

    Hi i created a table and a primary key for that table as follows:
    create table PROD_TRNSLTN
    PROD_PK VARCHAR2(16),
    CNTRC_CD VARCHAR2(10),
    PROD VARCHAR2(10),
    PLN VARCHAR2(10)
    alter table PROD_TRNSLTN
    add constraint PROD_TRNSLN_PK primary key (PROD_PK);
    i then created a trigger to automatically populate the primary key
    create trigger PROD_TRNSLTN_TRGR
    before insert on PROD_TRNSLTN
    for each row
    begin
    Select PROD_PK.nextval into :new.PROD_PK from dual;
    end;
    i get no syntax error, but when i use SQLLoader to insert rows into this table i get:
    "ORA-04098: trigger 'IAVE.PROD_TRNSLTN_TRGR' is invalid and failed re-validation"
    Why??
    Edited by: aft5425 on Oct 30, 2008 11:37 AM

    Hi,
    So you can compile via your editor? It sounds handy, but if it doesn't show error messages, and it doesn't allow you to indent your code, it's not worth it.
    Save your code (as prod_trnsltn_trgr.sql):
    create trigger    PROD_TRNSLTN_TRGR
    before insert on  PROD_TRNSLTN
    for each row
    begin
        Select  PROD_PK.nextval
        into    :new.PROD_PK
        from    dual;
    end;
    SHOW ERRORSThe open SQL*Plus in a separate window and say
    SQL> @full_path\prod_trnsltn_trgrIf you can't fix the problem, post your code and all messages you get in SQL*Plus.

  • Execute create trigger script in a procedure

    Is it possible to create a trigger with pl/sql?
    I have made a procedure thats makes the create or replace trigger statement.
    (when i copy and past the statement the trigger is created succesvol)
    How can i execute the create trigger statement on the end of the procedure?
    Thanks.

    Well, then proceed with dynamic SQL.
    Or, in my opinion much better: produce a SQL script with variables for table name and trigger name.
    Then run this script with the appropriate values every time you have created a table.
    Cheers,
    Guido
    Edited by: Guido on Oct 22, 2008 10:30 AM

  • Need help with create trigger based on more then 1 table and join.

    Hello,
    Here i have 3 tables
    1. Employee
    PERSON_ID
    1
    1
    N
    NUMBER
    None
    ORG_ID
    2
    N
    NUMBER
    Frequency
    LOC_ID
    3
    N
    NUMBER
    Frequency
    JOB_ID
    4
    Y
    NUMBER
    Height Balanced
    FLSA_STATUS_ID
    5
    Y
    NUMBER
    Frequency
    FULL_NAME
    6
    N
    VARCHAR2 (250 Byte)
    Height Balanced
    FIRST_NAME
    7
    N
    VARCHAR2 (20 Byte)
    Height Balanced
    MIDDLE_NAME
    8
    Y
    VARCHAR2 (60 Byte)
    Height Balanced
    LAST_NAME
    9
    N
    VARCHAR2 (40 Byte)
    Height Balanced
    PREFERRED_NAME
    10
    Y
    VARCHAR2 (80 Byte)
    None
    EMAIL
    11
    Y
    VARCHAR2 (250 Byte)
    None
    MAILSTOP
    12
    Y
    VARCHAR2 (100 Byte)
    None
    HIRE_DATE
    13
    N
    DATE
    None
    2. ems_candidate
    EMS_CANDIDATE_ID
    1
    1
    N
    NUMBER
    None
    EMS_JOB_ID
    2
    Y
    NUMBER
    Frequency
    NAME
    3
    N
    VARCHAR2 (255 Byte)
    Frequency
    EMAIL
    4
    Y
    VARCHAR2 (255 Byte)
    None
    TELEPHONE
    5
    Y
    VARCHAR2 (25 Byte)
    None
    EMS_SOURCE_ID
    6
    Y
    NUMBER
    Frequency
    RECEIVED_DATE
    7
    Y
    DATE
    Frequency
    COMMENTS
    8
    Y
    VARCHAR2 (4000 Byte)
    None
    3. employee_resources
    EMP_RES_ID
    1
    1
    N
    NUMBER
    None
    PERSON_ID
    2
    Y
    NUMBER
    Height Balanced
    CANDIDATE_ID
    3
    Y
    NUMBER
    Frequency
    EMP_START_DATE
    4
    Y
    DATE
    None
    CUSTOM_RESOURCE_FLAG
    5
    Y
    NUMBER (1)
    None
    RESOURCE_GROUP_ID
    6
    N
    NUMBER
    Frequency
    RESOURCE_STATUS_ID
    7
    N
    NUMBER
    Frequency
    GROUP_LOC_ID
    8
    N
    NUMBER
    Height Balanced
    ASSIGNED_JIRA
    9
    Y
    VARCHAR2 (250 Byte)
    None
    REVOKED_JIRA
    10
    Y
    VARCHAR2 (250 Byte)
    None
    CREATED_DATE
    11
    Y
    DATE
    SYSDATE
    None
    UPDATED_DATE
    12
    Y
    DATE
    None
    Now i want to create trigger when new record get inserted in employee table wanted to update person_id in employee_resources table.
    So i want to match ems_candidate.name with employee.full_name , ems_candidate.ems_job_id with employee.ems_job_id. And if it matched then update person_id in employee_resources table else through an exception and insert record in temp table.
    If anybody has an idea can u please help me.
    Thanks,
    Gayatri.

    I created below trigger
    CREATE TRIGGER emp_resources_upd_person_id
    AFTER INSERT ON ems.employee
    FOR EACH ROW
    BEGIN
        UPDATE ems.employee_resources
           SET person_id = :new.person_id
         WHERE candidate_id = (SELECT ems_candidate_id  
                                 FROM ems.ems_candidate cand, ems.employee emp
                                WHERE TRIM(UPPER(emp.first_name)) = TRIM(UPPER(SUBSTR (cand.name, 1, INSTR (cand.name, ' ') - 1)))
                                  AND TRIM(UPPER(emp.last_name)) = TRIM(UPPER(SUBSTR (cand.name,INSTR (cand.name, ' ') + 1,DECODE (INSTR (SUBSTR (cand.name, INSTR (cand.name, ' ') + 1), ' '),0,LENGTH (cand.name),(INSTR (SUBSTR (cand.name, INSTR (cand.name, ' ') + 1), ' ') - 1)))))
                                  AND emp.person_id = :new.person_id);
    EXCEPTION
      WHEN OTHERS THEN
        INSERT INTO ems.update_person_id_exception(person_id,first_name,last_name,full_name) VALUES(:new.person_id,:new.first_name,:new.last_name,:new.full_name);
    END;
    Now when i am trying to insert row in ems.employee  table it gives me an error
    ORA-04091
    table string.string is mutating, trigger/function may not see it
    Cause: A trigger (or a user defined plsql function that is referenced in this statement) attempted to look at (or modify) a table that was in the middle of being modified by the statement which fired it.
    Action: Rewrite the trigger (or function) so it does not read that table.
    Can anybody please help me to come out from these error.
    Thanks,
    Gayatri.

  • Please trace what is wrong in TRIGGER script , doesnt create trigger.

    Hi Oracle Gurus,
    Please help me, in finding what is wrong in trigger statement. It doesn not create trigger, instead it displays line numbers..like 1 2 3 4 ....after pressing the enter key,
    I am attaching the full script, where it alters table, then creates new table, the creates sequence..lastly it fails in creating the trigger.
    ==================================================================================
    SQL> ALTER TABLE MOBILE.MOBILE_USER ADD (LAST_LOGIN TIMESTAMP);
    Table altered.
    SQL> CREATE TABLE "MOBILE"."AUDIT_LOG"
    2 3 "AUDIT_LOG_ID" NUMBER(16,0) NOT NULL ENABLE,
    4 "DATE_CREATED" TIMESTAMP (6) NOT NULL ENABLE,
    5 "AUDIT_TYPE" VARCHAR2(20 BYTE) NOT NULL ENABLE,
    6 "AUDIT_DATA" CLOB,
    7 CONSTRAINT "AUDIT_LOG_PK" PRIMARY KEY ("AUDIT_LOG_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "SERVICES_DATA" ENABLE
    8 )
    9 PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
    INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
    10 11 12 )
    TABLESPACE "SERVICES_DATA" LOB
    13 14 (
    15 "AUDIT_DATA"
    16 )
    17 STORE AS
    18 (
    19 TABLESPACE "SERVICES_DATA" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10 NOCACHE LOGGING STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    20 ) ;
    Table created.
    SQL> CREATE SEQUENCE "MOBILE"."AUDIT_LOG_SEQ" INCREMENT BY 1 START WITH 1000 CACHE 20 NOCYCLE ;
    Sequence created.
    SQL> create or replace
    TRIGGER "MOBILE"."AUDIT_LOG_TRGR" before
    INSERT ON "AUDIT_LOG" FOR EACH row BEGIN IF inserting THEN IF :NEW."AUDIT_LOG_ID" IS NULL THEN
    SELECT AUDIT_LOG_SEQ.nextval
    INTO :NEW."AUDIT_LOG_ID"
    FROM dual;
    END IF;
    END IF;
    END;

    Ok great..but it gives the same error, we have already checked that AUDIT_LOG does exist.
    Is it checking something else..or it shoud be INSERT INTO instead of INSERT ON.
    Please help.
    create or replace
    TRIGGER "MOBILE"."AUDIT_LOG_TRGR" before
    INSERT ON "AUDIT_LOG" FOR EACH row BEGIN IF inserting THEN IF :NEW."AUDIT_LOG_ID" IS NULL THEN
    SELECT AUDIT_LOG_SEQ.nextval
    INTO :NEW."AUDIT_LOG_ID"
    FROM dual;
    END IF;
    END IF;
    END; /
    INSERT ON "AUDIT_LOG" FOR EACH row BEGIN IF inserting THEN IF :NEW."AUDIT_LOG_ID" IS NULL THEN
    ERROR at line 3:
    ORA-00942: table or view does not exist

  • Create trigger on view belong to different schema of same db

    Hi Guru's,
    I have two different schema in the same DB.
    Example : schema1 and schema2
    I have one view on schema1 and i have grant select to schema2 and create synonym for that view.
    Now i need to create trigger on synonym which created from view in schema1 and insert the data into different table from trigger when insert happen on view.
    first of all , is it possible?
    if its possible then do i need to give create any trigger on view to schema2.
    Or is there any other we can get this done..
    Many thanks.

    Hi,
    user590978 wrote:
    Hi Guru's,
    I have two different schema in the same DB.
    Example : schema1 and schema2
    I have one view on schema1 and i have grant select to schema2 and create synonym for that view.
    Now i need to create trigger on synonym I'm not sure I understand you.
    Triggers operate on tables and views (but I'll just say "table" from now on). It doesn't matter if the statement that caused the trigger to fire used the actual table name or a synonym.
    which created from view in schema1 and insert the data into different table from trigger when insert happen on view.
    first of all , is it possible?I'm not sure I understand you here, either.
    It is possible to have a trigger on a view in schema1, which INSERTs data into a table. That table can be in any schema, just so long as the trigger owner has privilges on INSERT into it.
    if its possible then do i need to give create any trigger on view to schema2.It's very dangerous, and usually a terrible idea, to grant the CREATE ANY privileges to users.
    Schema2 needs the CREATE ANY TRIGGER system privilege only to create a trigger in another schema, such as schema1. There's probably no reason to do that. Let schmea1 create the objects in its own schema.
    Post a test script that shows what you want to do. Include CREATE TABLE, CREATE VIEW, CREATE TRIGGER, CONNECT and INSERT statements, and the results you want (the contents of tables where the trigger INSERTed data). If you don't know how to code something, post the closest thing you can, and explain what you really want to do in that place.

  • Getting error while creating trigger!!

    Hi Guys,
    I am getting the following error while creating trigger in Oracle10g Database in TOAD environment.
    Error: PLS-00306: wrong number or types of arguments in call to '='
    Table details:
    One of the column having BLOB Data type in the table.
    In the trigger, I have compared :old and :new values.
    CREATE OR REPLACE TRIGGER INPL.trigger_new
    AFTER INSERT OR UPDATE OR DELETE
    ON TABLE_NEW REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    action_flag VARCHAR2(1);
    new_image BLOB;
    BEGIN
    IF UPDATING
    THEN
    action_flag := 'U';
    ELSIF DELETING
    THEN
    action_flag := 'D';
    ELSIF INSERTING
    THEN
    action_flag := 'I';
    END IF;
    IF (:NEW.image = :OLD.image)
    THEN
    new_image := '';
    ELSE
    new_image := :NEW.image;
    END IF;
    INSERT INTO TABLE_NEW(action_flag, date_changed,nimage,oimage) values(new_image,:old.image);
    end;
    Any one knows about this issue, please let me know with the proper solution.
    Thanks for your immediate response!
    Regards,
    Lakshman

    CREATE OR REPLACE TRIGGER INPL.trigger_new
    AFTER INSERT OR UPDATE OR DELETE
    ON TABLE_NEW REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    action_flag VARCHAR2(1);
    new_image BLOB;
    BEGIN
    IF UPDATING
    THEN
    action_flag := 'U';
    ELSIF DELETING
    THEN
    action_flag := 'D';
    ELSIF INSERTING
    THEN
    action_flag := 'I';
    END IF;
    IF (:NEW.image = :OLD.image)
    THEN
    new_image := '';
    ELSE
    new_image := :NEW.image;
    END IF;
    INSERT INTO TABLE_AUD(action_flag, date_changed,nimage,oimage) values(new_image,:old.image);
    end;
    I am getting the error in line at If condition
    Error: PLS-00306: Wrong number or tpyes of arguments in call '='
    Please let me know if any one knows exact solution!
    Thanks in advance!
    Regards,
    Lakshman

  • Error while create trigger on for nested table

    I want to insert a record into a nested table.For this, I created a view for the table, which includes the nested table.It told me ORA-25015 cannot perform DML on this nested table view column.So I created a trigger for the nested table.However, it told me that ORA-25010 Invalid nested table column name in nested table clause.I think my nested table is valid, i don't konw why did it appear this kind of problem?
    My table is
    CREATE TABLE ENT
    ID NUMBER(7) NOT NULL,
    CREATE_DATE VARCHAR2(11 BYTE),
    UPDATE_DATE VARCHAR2(11 BYTE),
    DEPTS VARRAY_DEPT_SEQ
    CREATE OR REPLACE
    TYPE DEPT AS OBJECT
    ID NUMBER(8),
    ANCHOR VARCHAR2(20),
    CREATE OR REPLACE
    TYPE " VARRAY_DEPT_SEQ" as varray(930) of DEPT
    CREATE OR REPLACE VIEW ENT_NESTED_VIEW
    (ID, CREATE_DATE, UPDATE_DATE, DEPTS)
    AS
    select e.ID,cast(multiset(select r.id,r.anchor from ent z, table(z.depts) r where z.ID=e.ID )as varray_dept_seq)
    FROM ENT e
    Then when I created trigger;
    CREATE OR REPLACE TRIGGER EMP.ENT_NESTED_TRI
    INSTEAD OF INSERT
    ON NESTED TABLE DEPTS OF EMP.ENT_NESTED_VIEW
    REFERENCING NEW AS New OLD AS Old PARENT AS Parent
    FOR EACH ROW
    BEGIN
    END ;
    I met the problem: ORA-25010 Invalid nested table column name in nested table clause
    Could you please tell me the reason
    Thank you!
    My insert SQL is:
    insert into table(select depts from ent_nested_view where id=1856) values(varray_dept_seq(dept(255687,'AF58743')))
    Message was edited by:
    user589751

    Hi,TongucY
    Compared with the "Referencing Clause with Nested Tables" part of this reference -
    http://psoug.org/reference/instead_of_trigger.html, I found the answer of this
    quesion. That is "CREATE OR REPLACE TYPE " VARRAY_DEPT_SEQ" as[b] varray(930) of
    DEPT". It turns to be a varying array, not a nested table. It should be "CREATE OR
    REPLACE TYPE " VARRAY_DEPT_SEQ" as table of DEPT". That is OK. Thank you very
    much!
    While there is an another question, if I create a varying array like" CREATE OR
    REPLACE TYPE " VARRAY_DEPT_SEQ" as[b] varray(930) of DEPT " and I want to insert
    a record into the varying array, which the record has been existed.The method that
    create a view and a trigger seems not to be effective.
    For instance,
    There is a record in the table
    ID:1020
    CREATE_DATE:2005-10-20
    UPDATE_DATE:2007-2-11
    DETPS: ((10225,AMY))
    I want to ask this record to be
    ID:1020
    CREATE_DATE:2005-10-20
    UPDATE_DATE:2007-2-11
    DETPS: ((10225,AMY),(10558,TOM))
    How should I do?
    Could you please help me?
    Best regards.
    Message was edited by:
    user589751

  • Bad bind variable error on creating trigger

    hi
    im trying to create a trigger on a table in Oracle and I keep gettin this error:
    PLS-00049: bad bind variable 'NEW.ID'
    TeamID is a primary Key, it creates the sequence fine, but i get the error on the create trigger,
    CREATE TABLE TBLTEAMS
    TEAMID NUMBER(5),
    NAME VARCHAR2(50 BYTE),
    MANAGER VARCHAR2(50 BYTE),
    COSTCENTRE NUMBER(9),
    PARENTTEAMID NUMBER(5)
    create sequence seq_Teamsautonumber;
    create trigger trg_Teamsautonumber
    before insert on tblteams
    for each row
    begin
    select seq_Teamsautonumber.nextval into :new.id from dual;
    end;
    any ideas?

    You have said
    :new.idthat means you are trying to load the sequence value into a column that doesn't exist in your table.
    you would need to use
    :new.teamidAssuming you are trying to auto-populate the TEAMID column on your table.

  • How do I stop iphoto from creating events automatically when I import photos from an external hard drive?

    IPhoto is creating events automatically when I import photos and when I merge events and then go to finder>all images, I see iphoto has created several copies of each picture....I try to delete the extra copies but then the albums or events also get affected, even if there is one copy of each photo left in all images...have someone had this problem?

    You don't have a problem at all.
    IPhoto is creating events automatically when I import photos
    This is how iPhoto works. Every photo is in an Event. Events are the basic organisation of the Library. Every import means at least one new Event. Yes you can merge Events after import and so on, but there is at least one Event created at each import.
    I see iphoto has created several copies of each picture....
    No it hasn't. It hs created versions of the photos, not copies. There will be a couple of thumbnails  for viewing in the iPhoto Window plus the Master and then a edited version for pics that are modified. The icons for each of these may be similar but they are not copies - for a start they are different sizes - and all are required for iPhoto to work.
    go to finder>all images
    Don't. This is simply a list of all the images on your computer. It makes no account or allowance for the purpose of these images. Really, if you're using iPhoto ignore this because if you
    I try to delete the extra copies
    Then you are trashing your Library.
    So, this is how iPhoto works, there is no problem and stay away from All Images.
    Regards
    TD

  • I create trigger but not display massage after insert in oracle 10g

    I create trigger but not display massage after insert in oracle 10g
    **CREATE OR REPLACE TRIGGER TableName**
    **AFTER INSERT OR DELETE OR UPDATE ON test**
    **BEGIN**
    **if inserting then**
    **dbms_output.put('Message');**
    **end if;**
    **END;**

    What user interface are you using?
    If the tool doesn't support the SQL*Plus syntax (set serveroutput on), it probably has an option somewhere to enable DBMS Output. Not even knowing what tool you're using, it's impossible for us to guess where that option might be configured.
    As others have suggested, using DBMS Output to test code is less than ideal because you're dependent on the application you're using to display it to you and not every application can or will do that. If you want to use DBMS_Output, you may need to switch to a different GUI (SQL Developer or SQL*Plus are both free utilities from Oracle). Otherwise, you'd probably be better off having the trigger do something that you can subsequently query (i.e. write a row to a log table).
    Justin

  • How to create an automatically increment column in Oracle DB Table?

    Hi To All
    Here I am trying to create a table in Oracle that creates an automatically increment column in Oracle DB Table. i searched almost all Forums.(Even in Oracle). They are saying that, that logic u must implement in Java Code.(*Takes Maximum no from table, add +1 to it, and store it back again)*. apart from this, while creating an table in Oracle, is there any facility like MySQL Database? please help me. Thanks in advance.

    Hi BalusC
    Thanks for Your Response and clue. with that, i succeeded in my application. Thank you very much. here i am giving you the details which i did.
    1. I Created a table named orders in Oracle like this.
       CREATE TABLE ORDERS (ORDER_ID NUMBER, CUSTOMER_ID NUMBER, ISBN NUMBER,
                                   DESCRIPTION NCHAR(5));
                       2. I created one sequence in Oracle like    CREATE SEQUENCE SEQ01 INCREMENT BY 1 START WITH 1000     3. Then i have written jdbc program like this
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    public class SequenceTest {
         public static void main(String[] args)throws Exception{
              try {
              Class.forName("oracle.jdbc.driver.OracleDriver");
              Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
              String cols[] = {"ORDER_ID", "DESCRIPTION"};
              PreparedStatement pstmt = con.prepareStatement("INSERT INTO ORDERS (ORDER_ID, CUSTOMER_ID, ISBN,DESCRIPTION) VALUES            (SEQ01.NEXTVAL, 104, 966431505,?)", cols);
              pstmt.setString(1,"Desc3");          
              pstmt.executeUpdate();
              ResultSet rs=pstmt.getGeneratedKeys();     
                    System.out.println("---- One Row Inserted ----");
              } catch (Exception e) {
                   System.out.println("---- Failed Due To "+e);               
       4. When i ran above program 5 times, i got the following Data into my Oracle Table (select * from orders)
      ORDER_ID CUSTOMER_ID       ISBN DESCR
          1000         101  966431502 Desc0
          1001         102  966431503 Desc1
          1002         103  966431504 Desc2
          1003         104  966431505 Desc3
          1004         104  966431505 Desc3
          1005         105  966431506 Desc4
    6 rows selected.
      But i dont know how to do this type of program with out using prepared statements. i tried, and i got exception *"Missing Expression"* .
    Once again Thank You very much for your clue.

Maybe you are looking for

  • Elements 9 organizer won't load on mac

    I am running a mac book pro with snow leopard. I have been using elements organizer for about 3 months now. Since yesterday however, every time I try to run the program, it crashes. This happened after running organizer and I had to do a force quit a

  • How to create a CD/DVD slideshow that cab be vewed on a TV

    In LightRoom/Mac can I create a slideshow that can viewed on a TV? I only see an option to export to a pdf file but that is not readable by a cd/dvd player.

  • Qty at Posting date

    I need to prepare report ,which display comined stock for all the material for a particular material type at the end of each month for last three year.how can i get. please tell the logic with tables Regards, vivek

  • Error Exception disply on Page

    Hi All I am using ADF I have using jspx login screen try{ if (rset.next()){ password = rset.getString(3); // System.out.println("Password:" + rset.getString(2)); if(!password.equals(pass)){ System.out.println("Wrong Password !!!!"); setInputBlank();

  • What's best manual for pages and numbers?

    I'm seeing there's a lot ot learn from pages and numbers... Does anyone rec a book to go over the features of pages/numbers?