PL/SQL: ORA-01747... trigger?

Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

PL/SQL Release 11.2.0.3.0 - Production

CORE Production 11.2.0.3.0

AMT for Solaris: 11.2.0.3.0 - Production Version

NLSRTL Version 11.2.0.3.0 - Production

I create instead of relaxing and it is to compile with error and gives me the error of:

PL/SQL: ORA-01747: invalid column, table.column, or user.table.column specification

I compared the columns all the way back to the original table and I can't choose where or it fails on.

Here is the original table:

DROP TABLE NRIS_WBETTERS. NRN_TOTAL_SUMMARY CASCADE CONSTRAINTS;

CREATE THE TABLE NRIS_WBETTERS. NRN_TOTAL_SUMMARY

(

Sys_guid() TOTAL_CN VARCHAR2 (40 BYTE) DEFAULT is NOT NULL.

ROUND NUMBER (3) NOT NULL,

REGION_CODE VARCHAR2 (5 BYTE) NOT NULL,

AFOREST_CODE VARCHAR2 (15 BYTE) NOT NULL,

SUBUNIT VARCHAR2 (15 BYTE),

TYPESITE VARCHAR2 (15 BYTE) NOT NULL,

SAMP_STRATUM VARCHAR2 (6 BYTE) NOT NULL,

SAMPLEYEAR VARCHAR2 (5 BYTE) NOT NULL,

SAMPLED_DAYS NUMBER (3).

AGREEDTO NUMBER 4,

LERNUM NUMBER 4,

NNH NUMBER (8).

SITE_VISITS NUMBER (10),

SVPERDAY NUMBER (8,1).

DAYSNOINTS NUMBER 4,

DAYSNOLER NUMBER 4,

LERPERDAY NUMBER (4.1).

SVCONFINT NUMBER (5.1).

LAST_UPDATE DATE DEFAULT sysdate is NOT NULL,

VPDUNIT_ID VARCHAR2 (10 BYTE) NOT NULL

)

TABLESPACE USERS

PCTUSED 0

PCTFREE 10

INITRANS 1

MAXTRANS 255

STORAGE)

80K INITIAL

MINEXTENTS 1

MAXEXTENTS UNLIMITED

PCTINCREASE 0

DEFAULT USER_TABLES

)

LOGGING

NOCOMPRESS

NOCACHE

NOPARALLEL

MONITORING;

GRANT SELECT, UPDATE ON NRIS_WBETTERS. NRN_TOTAL_SUMMARY TO TEMP_NVUM_FY;

Here is the view that the trigger is activated on:

DROP VIEW NVUM_FY. NRN_TOTAL_SUMMARY_V;

/ * Formatted on 14/03/2014 07:47:04 (PS5 v5.256.13226.35538) * /.

CREATE OR REPLACE FORCE VIEW NVUM_FY. NRN_TOTAL_SUMMARY_V

(

TOTAL_CN,

ID,

AFOREST_CODE,

SUBUNIT,

TYPESITE,

SAMP_STRATUM,

SAMPLED_DAYS,

AGREEDTO,

LERNUM,

NNH,

DAYSNOINTS,

DAYSNOLER,

LERPERDAY,

SVCONFINT,

SITE_VISITS,

SVPERDAY

)

AS

(SELECT 'TOTAL_CN',

"ID."

"AFOREST_CODE,"

"SUBUNIT."

"TYPESITE."

"SAMP_STRATUM,"

"SAMPLED_DAYS,"

"AGREEDTO."

"LERNUM,"

"NNH."

"DAYSNOINTS,"

"DAYSNOLER,"

"LERPERDAY,"

"SVCONFINT,"

"SITE_VISITS,"

'SVPERDAY '.

OF NRIS_WBETTERS. FY07_RECONCILED_TOTAL_SUMMARY);

CREATE OR REPLACE TRIGGER NVUM_FY. NRN_TOTAL_SUMMARY_II

INSTEAD OF UPDATE

ON NVUM_FY.nrn_total_summary_v

FOR EACH LINE

BEGIN

UPDATE nris_wbetters.nrn_total_summary

SET SAMP_STRATUM =: NEW. SAMP_STRATUM,

SAMPLED_DAYS =: NEW. SAMPLED_DAYS,

AGREEDTO =: NEW. AGREEDTO,

LERNUM =: NEW. LERNUM,

LONG =: NEW. ROUND,

REGION_CODE =: NEW. REGION_CODE,

NNH =: NEW. NNH,

DAYSNOINTS =: NEW. DAYSNOINTS,

DAYSNOLER =: NEW. DAYSNOLER,

LERPERDAY =: NEW. LERPERDAY,

SVCONFINT =: NEW. SVCONFINT,

SITE_VISITS =: NEW. SITE_VISITS,

SVPERDAY =: NEW. SVPERDAY,

SAMPLEYEAR =: NEW. SAMPLEYEAR,

WHERE total_cn =: NEW.total_cn

AND aforest_code =: NEW.aforest_code

AND sitenumber =: NEW.sitenumber

AND TypeSite =: NEW.sitetype;

END nrn_proxy_summary_ii;

/

And here's the trigger.

DROP TRIGGER NVUM_FY. NRN_TOTAL_SUMMARY_II;

CREATE OR REPLACE TRIGGER NVUM_FY. NRN_TOTAL_SUMMARY_II

INSTEAD OF UPDATE

ON NVUM_FY.nrn_total_summary_v

FOR EACH LINE

BEGIN

UPDATE nris_wbetters.nrn_total_summary

SET SAMP_STRATUM =: NEW. SAMP_STRATUM,

SAMPLED_DAYS =: NEW. SAMPLED_DAYS,

AGREEDTO =: NEW. AGREEDTO,

LERNUM =: NEW. LERNUM,

NNH =: NEW. NNH,

DAYSNOINTS =: NEW. DAYSNOINTS,

DAYSNOLER =: NEW. DAYSNOLER,

LERPERDAY =: NEW. LERPERDAY,

SVCONFINT =: NEW. SVCONFINT,

SITE_VISITS =: NEW. SITE_VISITS,

SVPERDAY =: NEW. SVPERDAY,

WHERE TOTAL_CN =: NEW. TOTAL_CN

AND AFOREST_CODE =: NEW. AFOREST_CODE

AND TYPESITE =: NEW. TYPESITE;

END;

/

In relaxation, the line that is highlighted when the script ends is the clause WHERE of TOTAL_CN.  I know not true but if it is a false witness or what, but I could not figure out where the error is or why.

Is anyone able to see what I can't do?

Thank you.

Hello

LostInPermuation wrote:

...
CREATE OR REPLACE TRIGGER NVUM_FY. NRN_TOTAL_SUMMARY_II

INSTEAD OF UPDATE

ON NVUM_FY.nrn_total_summary_v

FOR EACH LINE

BEGIN

UPDATE nris_wbetters.nrn_total_summary

SET SAMP_STRATUM =: NEW. SAMP_STRATUM,

SAMPLED_DAYS =: NEW. SAMPLED_DAYS,

AGREEDTO =: NEW. AGREEDTO,

LERNUM =: NEW. LERNUM,

LONG =: NEW. ROUND,

REGION_CODE =: NEW. REGION_CODE,

NNH =: NEW. NNH,

DAYSNOINTS =: NEW. DAYSNOINTS,

DAYSNOLER =: NEW. DAYSNOLER,

LERPERDAY =: NEW. LERPERDAY,

SVCONFINT =: NEW. SVCONFINT,

SITE_VISITS =: NEW. SITE_VISITS,

SVPERDAY =: NEW. SVPERDAY,

SAMPLEYEAR =: NEW. SAMPLEYEAR,

WHERE total_cn =: NEW.total_cn

AND aforest_code =: NEW.aforest_code

AND sitenumber =: NEW.sitenumber

AND TypeSite =: NEW.sitetype;

END nrn_proxy_summary_ii;

/

And here's the trigger.

DROP TRIGGER NVUM_FY. NRN_TOTAL_SUMMARY_II;

CREATE OR REPLACE TRIGGER NVUM_FY. NRN_TOTAL_SUMMARY_II

INSTEAD OF UPDATE

ON NVUM_FY.nrn_total_summary_v

FOR EACH LINE

BEGIN

UPDATE nris_wbetters.nrn_total_summary

SET SAMP_STRATUM =: NEW. SAMP_STRATUM,

SAMPLED_DAYS =: NEW. SAMPLED_DAYS,

AGREEDTO =: NEW. AGREEDTO,

LERNUM =: NEW. LERNUM,

NNH =: NEW. NNH,

DAYSNOINTS =: NEW. DAYSNOINTS,

DAYSNOLER =: NEW. DAYSNOLER,

LERPERDAY =: NEW. LERPERDAY,

SVCONFINT =: NEW. SVCONFINT,

SITE_VISITS =: NEW. SITE_VISITS,

SVPERDAY =: NEW. SVPERDAY,

WHERE TOTAL_CN =: NEW. TOTAL_CN

AND AFOREST_CODE =: NEW. AFOREST_CODE

AND TYPESITE =: NEW. TYPESITE;

END;

/

In relaxation, the line that is highlighted when the script ends is the clause WHERE of TOTAL_CN.  I know not true but if it is a false witness or what, but I could not figure out where the error is or why.

Is anyone able to see what I can't do?

Thank you.

You don't want the last comma just before the keyword WHERE.

I get an error of re-creation of the view, so I can't say if there are problems.

Tags: Database

Similar Questions

  • ORA-01747

    Hello

    When executing this query, Iam getting error.

    PL/SQL: ORA-01747: invalid column, table.column, or user.table.column specification
    declare
    
    cursor c1 is
    select * from SCTS05MAR12.M09_NT_UV_CONTACT;
    
    cur c1%rowtype;
    
    begin
    
    open c1;
    loop
    fetch c1 into cur;
    insert into MCA20APR12.M09_NT_UV_CONTACT (ADABAS_ISN   ,       
    (                                         CONTACT_NAME,        
                                              PTT_CARRIER_CD,      
                                              PTT_SEQ_NBR,         
                                              TEL_NBR     ,        
                                              FAX_NBR      ,       
                                              TELEX_NBR     ,      
                                              CONTACT_ST     ,     
                                              NETPRO_TRANSM_DT,    
                                              NETPRO_TRANSM_TM ,   
                                              NETPRO_TRANSM_ST  ,  
                                              NETPRO_TRANSM_ST_DT, 
                                              NETPRO_TRANSM_ST_TM ,
                                              NETPRO_TRANSM_ERR_CD,
                                              CRTE_DT             ,
                                              CRTE_TM             ,
                                              UPDT_DT             ,
                                              UPDT_TM             ,
                                              UPDT_PGM            ,
                                              CREATOR_ID          ,
                                              LAST_CHG_ID         ,
                                              CONTACT_ID          )
                                         values ( cur.ADABAS_ISN,          
                                                   cur.   CONTACT_NAME,        
                                                      cur.PTT_CARRIER_CD ,     
                                                      cur.PTT_SEQ_NBR,         
                                                      cur.TEL_NBR   ,          
                                                      cur.FAX_NBR   ,          
                                                      cur.TELEX_NBR    ,       
                                                      cur.CONTACT_ST   ,       
                                                      cur.NETPRO_TRANSM_DT  ,  
                                                      cur.NETPRO_TRANSM_TM  ,  
                                                      cur.NETPRO_TRANSM_ST   , 
                                                      cur.NETPRO_TRANSM_ST_DT ,
                                                      cur.NETPRO_TRANSM_ST_TM ,
                                                      cur.NETPRO_TRANSM_ERR_CD,
                                                      cur.CRTE_DT  ,           
                                                      cur.CRTE_TM   ,          
                                                      cur.UPDT_DT  ,           
                                                      cur.UPDT_TM  ,           
                                                      cur.UPDT_PGM  ,          
                                                      cur.CREATOR_ID  ,        
                                                      cur.LAST_CHG_ID  ,       
                                                       STG_NT_UV_CONTACT.NEXTVAL);
                                                       
                                                       end loop;
                                                       close c1;
                                                       
            EXCEPTION
            WHEN others THEN
          DBMS_OUTPUT.PUT_LINE('Exception: ' || sqlerrm);
          close c1;
          end;        

    First step would be to remove the clause WHEN OTHERS and simply allow the error appears on the screen with the exact line where its been triggered.

    Once you get that check if the name of the specified object is correct. If it is, check for privileges on the table for the current user.

  • MERGER into slider throws the error message: ORA-01747

    Hi guys,.
    I'm new in PL/SQL and I'm taking the last row of a database table and add the same data in another table with the same structure, but for the ancestors of the current employee. Something like:

    Day EmpID LOB (key fields)
    12-1007-29

    EmpID has 24 and 95 ancestors. That's why in the destination table I have to insert (or update of status and idforum if these three key areas already exists):

    EmpID LOB day
    24 1007 29
    95-1007-29


    There are 4 tables:

    X - table base;
    Y - destination table (same structure as X);
    Z - the relationship between the employee and ancestor;
    W - plays the role of a temporary table, but is a real table - only for the MERGER;
    ============================================================================================
    create or replace
    PROCEDURE INSERT_PARENTS AS
    BEGIN

    DECLARE
    EMP_VAR NUMBER (38.0). -employee
    NUMBER OF ANCESTOR_ID; -relative of the employee
    NUMBER OF LOB_VAR; -LOB
    NUMBER OF DAY_VAR; -date of
    NUMBER OF FORUMID_VAR; -Idforum
    STATUS_VAR VARCHAR2 (20); -Status
    Parents of CURSOR
    IS
    SELECT ancestor_key FROM Z WHERE member_key = EMP_VAR; -This slider will go through all the ancestors of the employee

    Number EMPROWID_VAR; -It's the key to the table Y (destination table)

    BEGIN
    -extract the last line of the table of database variables

    SELECT EMPL_KEY in the EMP_VAR OF X WHERE EMPROW_ID = (SELECT Max (EMPROW_ID) OF X);
    SELECT LOB_KEY in the LOB_VAR OF X WHERE EMPROW_ID = (SELECT Max (EMPROW_ID) OF X);
    SELECT DAY_KEY in the DAY_VAR OF X WHERE EMPROW_ID = (SELECT Max (EMPROW_ID) OF X);
    SELECT IDFORUM in FORUMID_VAR OF X WHERE EMPROW_ID = (SELECT Max (EMPROW_ID) OF X);
    SELECT STATUS in STATUS_VAR OF X WHERE EMPROW_ID = (SELECT Max (EMPROW_ID) OF X);

    SELECT NVL (Max (EMPROW_ID), 0) + 1 in EMPROWID_VAR OF Y; -initialize the key to the table max + 1 of the existing key Y


    Parents OPEN.

    LOOP
    EXTRACT the parents in ANCESTOR_ID;

    EXIT WHEN parents % NOTFOUND;

    EMPROWID_VAR: = EMPROWID_VAR + 1;
    -the value of the new key for Y
    INSERT w (emprowid_var, lob_var, ancestor_id, day_var, forumid_var, status_var)
    VALUES (EMPROWID_VAR, LOB_VAR, ANCESTOR_ID, DAY_VAR, FORUMID_VAR, STATUS_VAR); -prepare the source for the MERGE statement


    -merge data between 2 tables:
    -If a parent already exists in the destination, to update just idforum and the new status
    -If that parent does not exist in the dest table, will be inserted with the status ' U/R '.

    MERGE TO Y Dest
    USING the W
    WE (Dest.LOB_KEY = Surce.LOB_VAR AND)
    Dest.EMPL_KEY = Surce.ANCESTOR_ID AND
    Dest.DAY_KEY = Surce.DAY_VAR)

    WHEN MATCHED, THEN update to SET (Dest.FORUMID = Surce.FORUMID_VAR,
    Dest.STATUS = Surce.STATUS_VAR)

    WHEN NOT MATCHED THEN INSERT (Dest.EMPROW_ID, Dest.LOB_KEY, Dest.EMPL_KEY, Dest.DAY_KEY, Dest.FORUMID, Dest.STATUS)
    VALUES (Surce.EMPROWID_VAR, Surce.LOB_VAR, Surce.ANCESTOR_ID, Surce.DAY_VAR, Surce.FORUMID_VAR, ' U/R');

    END LOOP;
    END;

    END INSERT_PARENTS;

    When I try to run this procedure (compile) I get this error message:

    Error (53,37): PL/SQL: ORA-01747: invalid column, table.column, or user.table.column specification

    Can you tell me where I am doing wrong? (I'm pretty sure that it's in the Merge statement, but what is it?)

    Thanks in advance.

    Published by: petresion on November 19, 2011 14:02

    without the paintings I never would have found

    MERGE INTO y dest
    USING w surce
    ON (dest.lob_key = surce.lob_var AND dest.empl_key = surce.ancestor_id AND
    dest.day_key = surce.day_var )
    WHEN matched THEN
      UPDATE SET dest.forumid = surce.forumid_var,
                 dest.status = surce.status_var
    WHEN NOT matched THEN
      INSERT ( dest.emprow_id,
               dest.lob_key,
               dest.empl_key,
               dest.day_key,
               dest.forumid,
               dest.status)
      VALUES ( surce.emprowid_var,
               surce.lob_var,
               surce.ancestor_id,
               surce.day_var,
               surce.forumid_var,
               'U/R');
    
  • [SQL * Loader] ORA-01747 on column name 'INDEX '.

    Hello

    I use SQL * Loader to load the test data for the CSV files. I have a column whose name is "INDEX". SQL * Loader works very well under Linux (Red Hat 6 - Client Oracle 11.2.0.1.0) but I encounter ORA-01747 launch my Workstation Windows (Oracle Server 11.2.0.1.0).

    For more information, I target the same instance (Red Hat 6 - Oracle Server 11.2.0.1.0).

    You have an idea how to solve the problem (without renaming the column )?

    Thanks for any help you can provide.

    I finally find the solution surrounding the column name with double quotes ("") within the control file. Thank you to remember the format of "protector".

  • Database trigger - PL/SQL: ORA-00984: column not allowed here

    I am trying to create a trigger that will update a table of audit used when a row is changed. Using a sequence number to assign an identifier unique to each line as it is created. Need to capture the user ID, date modified and action (update), the image of the front line.
    CREATE SEQUENCE emp_audit_seq START WITH 10;                
    Create table emp (
       empno       NUMBER(4)      Primary Key,
       ename       VARCHAR2(10),
       job            VARCHAR2(9),
       mgr           NUMBER(4),
       hiredate     DATE,
       sal             NUMBER(7,2),
       comm        NUMBER(7,2),
       deptno       NUMBER(2));
    CREATE TABLE emp_audit   (
         audit_uid          NUMBER(15)      Primary Key,
         change_date          DATE,
         change_user          VARCHAR2(30),
         action                  CHAR(1),
         empno                  NUMBER(4),
         ename                  VARCHAR2(10),          
         job               VARCHAR2(9),
         mgr               NUMBER(4),
         hiredate          DATE,
         sal               NUMBER(7,2),
         comm                  NUMBER(7,2),
         deptno                  NUMBER(2));
    CREATE OR REPLACE TRIGGER trig_emp_audit
      BEFORE UPDATE ON emp
      FOR EACH ROW
    BEGIN
      INSERT INTO emp_audit
        VALUES(emp_audit_seq.nextval, change_date, change_user, action, :old.empno, :old.ename, :old.job, :old.mgr, :old.hiredate, :old.sal, :old.comm, deptno);
    END;
    /
    
    Warning: Trigger created with compilation errors.
    
    SQL> show errors
    Errors for TRIGGER TRIG_EMP_AUDIT:
    
    LINE/COL ERROR
    -------- -----------------------------------------------
    2/3      PL/SQL: SQL Statement ignored
    3/149    PL/SQL: ORA-00984: column not allowed here
    Can someone help to help me find what I'm doing wrong with the trigger?

    Published by: LostNoob on August 25, 2012 14:24

    First of all, when you write an INSERT statement, it is always good for the columns that you insert in the list. Which makes the code easier to follow - you do not have separately pull toward the top of the table definition to know what order of columns is inserted. And it makes the code easier to manage because the declaration become invalid if you add a new column to the table in the future.

    Second, CHANGE_DATE, CHANGE_USER and ACTION are not (probably) functions and are not local variables so it is not supposed to use them in an INSERT statement. You need to write code or to take advantage of the existing functions to fill in these columns. I suppose, for example, that you want to use SYSDATE to fill the CHANGE_DATE and the USER to fill the column CHANGE_USER. My guess is that ACTION must always be a 'U' for UPDATE.

    Thirdly, it seems that you left the: old man on the DEPTNO column.

    Put them all together, you would have something like

    CREATE OR REPLACE TRIGGER trig_emp_audit
      BEFORE UPDATE ON emp
      FOR EACH ROW
    BEGIN
      INSERT INTO emp_audit(
          audit_uid,
          change_date,
          change_user,
          action,
          enpno,
          ename,
          job,
          mgr,
          hiredate,
          sal,
          comm,
          deptno )
        VALUES(
          emp_audit_seq.nextval,
          sysdate,
          user,
          'U',
         :old.empno,
         :old.ename,
         :old.job,
         :old.mgr,
         :old.hiredate,
         :old.sal,
         :old.comm,
         :old.deptno);
    END;
    / 
    

    Justin

  • Error in Trigger (PL/SQL: ORA-01744: INTO inappropriate)

    Hello
    I wrote the trigger in the following format... As the initial trigger is about 700 lines, as well, everything is written here... Please cooperate...
     CREATE OR REPLACE TRIGGER --
    AFTER UPDATE OF COL1
    ON TAB1
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    WHEN (NOT(OLD.COL1 IS NULL AND NEW.COL1=0))
    DECLARE
     --
     --
    rowToins PAK1.fdList;
    i number;
    BEGIN
     IF :NEW.COL2='V' THEN
     INSERT INTO DEST(
      ---
      ---
      D_AT)
     SELECT * FROM ( SELECT --
       ----
       ----
       PAK2.FUN1('AD',TAB10.ID) AS D_AT
     FROM ---
     WHERE --- )
       WHERE D_AT IS NOT NULL;
    ELSEIF :NEW.COL2 ='H' THEN
     SELECT * FROM ( SELECT --
       ----
       ----
       PAK2.FUN1('AD',TAB9.ID) AS D_AT
     BULK COLLECT INTO rowToins
     FROM ---
     WHERE --- )
       WHERE D_AT IS NOT NULL;
    
     i:=rowToins.FIRST;
     WHILE i IS NOT NULL LOOP
     --insert row 1
      PAK1.fun2(rowToins(i).<col>,
      ----
      );
     i:=rowToins.NEXT(i);
     END LOOP;
    END IF;
    END;
    /
    The above code gives the error...
    PL/SQL: ORA-01744: inappropriate INTO
    So, how can I fix the code...

    Thank you

    Sorry my mistake, it should be like this

     SELECT * BULK COLLECT INTO rowToins
     FROM ( SELECT --
       ----
       ----
       PAK2.FUN1('AD',TAB9.ID) AS D_AT
    
     FROM ---
     WHERE --- )
       WHERE D_AT IS NOT NULL;
    
  • Error in ODI, ORA-01747: invalid column, table.column, or user.table.column specification

    ODI-1227: SrcSet0 (load) task fails on the source of ORACLE STAGING_YYY connection.

    Caused by: java.sql.SQLSyntaxErrorException: ORA-01747: invalid column, table.column, or user.table.column specification

    We get the above error whenever we run an ODI interface,
    This interface is straight forrwad a mapping update incremental IKM Oracle, although we have identified the problem but do not know how it could be fixed

    Source table that contains two columns that are generally identified as the key of DB

    NAME

    / / DESC

    the target too has the same columns. If we disable these mappings to columns from the Active maps the interface works very well, however, with the latter, it fails. We will not be able to change the name of the column in the target because it is a table of Oracle products and has several dependencies to the breast.

    Please suggest an alternative and also if our understanding is correct.

    Thanks in advance.

    Jay

    HI Jay

    change the column as DESC and put "DESC" in the name, and save it for all the source concerned target and remapping to remove the column from the interface

    Thank you

    P

  • Why this error ORA-01747: invalid user.table.column, table.column or colu

    Hello

    Run immediately is to give different results
    SQL>  declare
      2   v varchar2(30):='SAL';
      3   Begin
      4   execute immediate 'update emp set :1=1000 where empno=7900' using v;
      5   end;
      6   /
     declare
    *
    ERROR at line 1:
    ORA-01747: invalid user.table.column, table.column, or column specification
    ORA-06512: at line 4
    But,
    SQL> declare
      2  v varchar2(30):='SAL';
      3  Begin
      4  execute immediate 'update emp set ' ||v||'=1000 where empno=7900';
      5  end;
      6  /
    old 7900 new 7900
    
    PL/SQL procedure successfully completed.
    Can someone kindly explain to me the reason.

    I need to accomplish a task using the first way.

    What could be the solution to the above ORA error?

    Thank you

    Column names cannot be used as a bind variable.
    If you do not need to do this using method 1 as method 1 does not work by design.
    On the other hand, you need replace the literal (7500,7900) with a variable binding.

    --------
    Sybrand Bakker
    Senior Oracle DBA

  • PL/SQL: ORA-00904: invalid identifier

    Hello

    Run the script after and encountered the error.

    SQL > create or replace FUNCTION p_CQTicketUsu

    () 2

    3 v_TicketUserID IN NUMBER by DEFAULT NULL,-it's the [CQTicketUsers]. TicketUserID generated on update

    4 v_TicketID IN NUMBER by DEFAULT NULL,-it's the [CQTicketUsers]. TicketID update

    5 v_AdminUserID IN NUMBER by DEFAULT NULL,-it's the [CQTicketUsers]. AdminUserID update

    6 v_TicketUserTypeID IN NUMBER by DEFAULT NULL - this is the [CQTicketUsers]. TicketUserTypeID update

    7)

    8 RETURN NUMBER

    9, ACCORDING TO

    10 v_sys_error NUMBER: = 0;

    11 v_ERRSQL NUMBER (10,0);

    12 v_UpdCount NUMBER (10,0);

    13

    BEGIN 14

    15

    16 UPDATE CQTicketUsers

    17 SET v_TicketUserID = TicketUserID,

    18 v_TicketID = TicketID,

    19 v_AdminUserID = AdminUserID,

    20 v_TicketUserTypeID = TicketUserTypeID

    21 WHERE TicketUserID = v_TicketUserID;

    22 v_ErrSQl: = v_sys_error;

    23 v_UpdCount: = SQL % ROWCOUNT;

    24 IF v_ErrSQL <>0 THEN

    25 RETURN-1;

    26 END IF;

    27 IF v_Updcount < 1 THEN

    28 RETURN - 2;

    29 END IF;

    30 RETURN 0;

    ENDS 31;

    32.

    WARNING: Function created with compilation errors.

    SQL > show error

    Errors for the P_CQTICKETUSU FUNCTION:

    16/4 PL/SQL: statement ignored

    20/11 PL/SQL: ORA-00904: "V_TICKETUSERTYPEID": invalid identifier

    Please note, I said v_TicketUserTypeID to the #6 line. Advice kindly.

    Kind regards

    Ballanger

    It's going to be kind of embarrassing, but you have the update parameters reversed. It should be

    TicketUserTypeID = v_TicketUserTypeID

    and is not

    v_TicketUserTypeID = TicketUserTypeID

    You get this error for database columns not only for pl/sql variables.

  • ORA-01747: invalid user.table.column... on the REPLACEMENT notice

    Oracle 11g Release 2

    I run an UPDATE statement. In the 'set' I am trying to update a column by using a subquery on the right side. REPLACE the statement Gets the error ORA-01747: specification of invalid column, table.column, or user.table.column.

    create table tab1
    ( file_id   number  ,
      record_id number  ,
      part_type_id number ,
      part_number  number ,
      positon_id   number ,
      notes        varchar2(255) ,
      mapped       varchar2(1) default 'N'
    )
    /
    insert into tab1 values(1,1,123,777,1,'NEW|A/C COMPRESSOR KIT','N') ;
    insert into tab1 values(1,2,123,777,2,'REMAN|A/C LINE','N') ;
    insert into tab1 values(1,3,123,777,2,'TEST NOTE','N') ;
    commit;
    select * from tab1;
    /*
      FILE_ID  RECORD_ID PART_TYPE_ID PART_NUMBER POSITON_ID NOTES                     MAPPED
    --------- ---------- ------------ ----------- ---------- ------------------------- ------
            1          1          123         777          1 NEW|A/C COMPRESSOR KIT         N
            1          2          123         777          2 REMAN|A/C LINE                 N
            1          3          123         777          1 TEST NOTE                      N
    */
    
    
    DECLARE
       v_note2 varchar2(255) := 'NEW' ;
    BEGIN
    UPDATE tab1 t 
             SET 
              , t.notes =  (select REPLACE(t.notes,v_note2,null) 
                            from dual )
          WHERE t.file_id = 1         -- value comes from another source
          AND   t.part_type_id = 123  -- value comes from another source
          AND   t.part_number = 777   -- value comes from another source
          AND   t.position_id = 1  ;  -- value comes from another source
    END ;
    /
    
    ERROR at line 3:
    ORA-01747: invalid user.table.column, table.column, or column specification
    

    Here's what the end result should be:

      FILE_ID  RECORD_ID PART_TYPE_ID PART_NUMBER POSITON_ID NOTES                     MAPPED
    --------- ---------- ------------ ----------- ---------- ------------------------- ------
            1          1          123         777          1 |A/C COMPRESSOR KIT            N
            1          2          123         777          2 REMAN|A/C LINE                 N
            1          3          123         777          1 TEST NOTE                      N
    

    Hello

    orclrunner wrote:

    Oracle 11g Release 2

    I run an UPDATE statement. In the 'set' I am trying to update a column by using a subquery on the right side. REPLACE the statement Gets the error ORA-01747: specification of invalid column, table.column, or user.table.column.

    1. create table tab1
    2. (file_id number,
    3. number of record_id,
    4. number of part_type_id
    5. number of PART_NUMBER,
    6. number of positon_id
    7. Notes VARCHAR2 (255),
    8. mapped by default varchar2 (1) ' don't
    9. )
    10. /
    11. insert into tab1 values (1,1,123,777,1,'NEW |) Kit COMPRESSOR / it, ' don't);
    12. insert into tab1 values (1,2,123,777,2,'REMAN |) A/C LINE ',' don't);
    13. insert into tab1 values (1,3,123,777,2, 'NOTE of TEST', ' don't);
    14. commit;
    15. Select * from tab1;
    16. /*
    17. FILE_ID RECORD_ID PART_TYPE_ID PART_NUMBER POSITON_ID MAPPED NOTES
    18. --------- ---------- ------------ ----------- ---------- ------------------------- ------
    19. 1 1 123 777 1 NEW | A/C COMPRESSOR KIT N
    20. 1 2 123 777 2 REMAN | A/C LINE N
    21. 1 3 123 777 1 TEST NOTES N
    22. */
    23. DECLARE
    24. VARCHAR2 (255) v_note2: = "NEW";
    25. BEGIN
    26. Tab1 t UPDATE
    27. SET
    28. t.notes = (select REPLACE(t.notes,v_note2,null)
    29. the double)
    30. WHERE t.file_id = 1 - value comes from another source
    31. AND t.part_type_id = 123 - value comes from another source
    32. AND t.part_number = 777 - value comes from another source
    33. AND t.position_id = 1;  -value comes from another source
    34. END;
    35. /
    36. ERROR at line 3:
    37. ORA-01747: invalid column, table.column, or user.table.column specification

    Here's what the end result should be:

    1. FILE_ID RECORD_ID PART_TYPE_ID PART_NUMBER POSITON_ID MAPPED NOTES
    2. --------- ---------- ------------ ----------- ---------- ------------------------- ------
    3. 1          1          123         777          1 | A/C COMPRESSOR KIT N
    4. 1 2 123 777 2 REMAN | A/C LINE N
    5. 1 3 123 777 1 TEST NOTES N

    The comma after SET is a syntax error.

    Why you use double?  Why not just

    UPDATE tab1

    SET of notes = REPLACE (notes, v_note2)

    WHERE file_id = 1

    ...

    ?

  • Error (301,28): PL/SQL: ORA-00942: table or view does not exist

    Hi all

    11.2.0.3.10

    AIX6

    I was installing store_procedures on our PROD several times, and they are successful. This stored_procedures are created by developers and once tested on DEV & UAT, they are transferred to the PROD through me.

    But this time I install a new SP, but I got error > Error (301,28): PL/SQL: ORA-00942: table or view does not exist

    Even if the synonym. The owner of the schema of the SP has grant select on the table and synonym of created. Why not MS can see this synonym?

    Is there something that I missed?

    Help, please... I'm going crazy

    Thank you all,

    MK

    Since there is only one user in your role, so I'll suggest to directly grant you the user rather than role - it's the easiest and simplest account according to your needs. The roles are best used to organize all of the users. If ever it is necessary to use roles (i.e. multiple users/schemas in a role) then, I think, you can play with AUTHID clause creating blocks.

  • Error (21,100): PL/SQL: ORA-00997: illegal use of the LONG data type

    CREATE or REPLACE (name in varchar2) procedure Compress_tab_partition
    is
    last_mnth_var varchar2 (8);
    curr_mnth_var varchar2 (8);
    number of last_mnth;
    number of curr_mnth;
    last_partition varchar2 (8);
    high_val varchar2 (4000);
    Start

    Select to_char (add_months (trunc (sysdate, 'MM'),-1), 'YYYYMM') | ' 00' in the double last_mnth_var;
    Select to_char (sysdate, 'YYYY') | TO_CHAR (sysdate, 'mm') | ' 00' in the double curr_mnth_var;
    Select to_number (last_mnth_var) in the double last_mnth;
    Select to_number (curr_mnth_var) in the double curr_mnth;

    Dbms_output.put_line ('Compression of GOLDMGR Table scores.' | table-name |) "to go". ») ;
    Dbms_output.put_line(' ');

    / * Step 1 - identify the name of the partition of the specified table must be compressed * /.
    Select high_value from high_val from user_tab_partitions where table_name = table-name;
    Select nom_partition into last_partition from user_tab_partitions where table_name = table-name and high_value = rtrim (high_val);

    / * Step 2 - Alter partition table to compress * /.

    run immediately "ALTER TABLE GOLDMGR." | table_name | ' CHANGE THE PARTITION '. last_partition | "COMPRESS by low query";

    / * Step 3 - Index rebuild step * /.

    I'm in (select index_name in user_indexes where table_name = table-name)
    loop
    run immediately "ALTER INDEX GOLDMGR." | i.index_name |' REBUILD ";
    end loop;

    Dbms_output.put_line (' COMPLETED: compress the Table partitions change.) ") ;

    end;
    /

    I'm getting an error like: Error (21,100): PL/SQL: ORA-00997: illegal use of the LONG data type

    Please resolve.

    HIGH_VALUE datatype is LONG. You may not use for a long TIME in WHERE clause expressions. You need to loop through the partitions by selecting HIGH_VALUE and then comparing. Secondly, there is no need to select double to calculate expressions. For example:

    Select to_char (add_months (trunc (sysdate, 'MM'),-1), 'YYYYMM') | ' 00' in the double last_mnth_var;

    should be replaced by

    last_mnth_var: = to_char (add_months (trunc (sysdate, 'MM'),-1), 'YYYYMM') | ' 00'.

    and there is no need to add_months here:

    last_mnth_var: = to_char (trunc (sysdate, 'MM') - 1, "YYYYMM"). ' 00'.

    But the main question is simply ALTER TABLE MODIFY PARTITION COMPRESS allows compression but does not compress. You must issue ALTER TABLE MOVE PARTITION COMPRESS:

    SQL > create table tbl (n) partition by range (n)
    2 (partition p1 values less than (maxvalue))
    3. Select lpad('X',4000,'X') from dual connect by level<=>
    4.

    Table created.

    SQL > select bytes
    2 from WHERE user_segments
    3 where nom_segment = 'TBL '.
    4 and nom_partition = 'P1 '.
    5.

    BYTES
    ----------
    830472192

    SQL > alter table tbl
    2. change the partition p1 compress
    3.

    Modified table.

    SQL > select bytes
    2 from WHERE user_segments
    3 where nom_segment = 'TBL '.
    4 and nom_partition = 'P1 '.
    5.

    BYTES
    ----------
    830472192

    SQL > alter table tbl
    2. move the partition p1 compress
    3.

    Modified table.

    SQL > select bytes
    2 from WHERE user_segments
    3 where nom_segment = 'TBL '.
    4 and nom_partition = 'P1 '.
    5.

    BYTES
    ----------
    8388608

    SQL >

    SY.

  • Error Type 2 SCD: ODI - 1228:ORA - 01747: invalid column, table.column, or user.table.column specification

    ODI error. When you try to import.

    Error Type 2 SCD: ODI - 1228:ORA - 01747: invalid column, table.column, or user.table.column specification

    It is a common question.

    Allow your SCD SCD table column properties if you do not select "crush on change."
    This property simply

    -Online CPC IKM goto => select ignore option error on update of existing lines.

  • PL/SQL: ORA-00904 invalid identifier, PLS-00225: reference of the subprogram or cursor is out of reach

    Hi gurus,

    Your help is greatly appreciated.

    Will I have a fucntion where we have the object it contains.

    The changes that I have doen are: 2 new cusrosrs, but its failure with the error below.

    Highlighted are the changes I made. his length very well before your help is greatly appreciated.

    1) PL/SQL: ORA-00904: "GET_ACQ_ID.". ' ACQ_ID ': invalid identifier.

    (2) PLS-00225: subprogram or cursor reference 'GET_ACQ_ID' is out of range

    Here is the code:

    _________________________________________________________________________

    FUNCTION GET_IP_COMM_INFO return PROD. TERMINAL_IP_COMM_INFO_TAB IS

    vTer TER.ter_id%TYPE;
    vAPPL_ID TAC.appl_id%TYPE;
    vValue TSF.vALUE%TYPE;

    IP_COMM_INFO_LIST PROD. TERMINAL_IP_COMM_INFO_TAB: = PROD. TERMINAL_IP_COMM_INFO_TAB();

    CURSOR GET_ACQ_ID IS
    SELECT ACQ_ID
    TER TAHA, MERC M, PROF
    WHERE T.MER_ID = M.MER_ID
    AND M.PROFID = P.PROF_ID
    AND T.TER_ID = vTer_id;


    CURSOR GET_INFO_CURSOR IS
    SELECT H.DESCRIPTION AS HOST_DESCRIPTION
    PROD. HOST H, PROD. APP_IP_COMM_ACCESS_INFO AICAI
    WHERE (AICAI. HOST_ID = H.HOST_ID) and
    (AICAI. APPL_ID = vAPPL_ID);

    CURSOR GET_ACQ_CURSOR IS
    SELECT H.DESCRIPTION AS HOST_DESCRIPTION
    PROD. HOST H, PROD. APP_IP_COMM_ACCESS_INFO AICAI, PROD. ACQUIRER_IP_COMM_ACCESS_INFO ACICAI
    WHERE (AICAI. HOST_ID = H.HOST_ID) and
    (AICAI. APPL_ID = vAPPL_ID) AND
    (ACQUIRER_ID = GET_ACQ_ID. ACQ_ID);
    BEGIN

    vTer_id: = GLOBAL_VARIABLES.gv_ref_Ter_id;

    BEGIN
    SELECT the VALUE IN vvalue OF Tsf
    WHERE TER_id = vTEr_ID AND APPL_ID is vAPPL_ID and FEATURE_ID = 861;.

    Vvalue = '04' IF THEN
    For GET_ACQ_REC IN GET_ACQ_CURSOR
    LOOP
    IP_COMM_INFO_LIST. EXTEND;
    IP_COMM_INFO_LIST (IP_COMM_INFO_LIST. (COUNTY): = PROD. TERMINAL_IP_COMM_INFO_OBJ (GET_ACQ_REC. HOST_DESCRIPTION);
    END LOOP;
    ON THE OTHER
    FOR GET_INFO_REC IN GET_INFO_CURSOR
    LOOP
    IP_COMM_INFO_LIST. EXTEND;
    IP_COMM_INFO_LIST (IP_COMM_INFO_LIST. (COUNTY): = PROD. TERMINAL_IP_COMM_INFO_OBJ (GET_INFO_REC. HOST_DESCRIPTION);
    END LOOP;
    END IF;

    RETURN IP_COMM_INFO_LIST;
    EXCEPTION WHEN OTHERS THEN
    LIFT;
    END GET_IP_COMM_INFO;

    ----------------------------------------------------------

    You try to access another variable of slider within the slider...

    CURSOR GET_ACQ_CURSOR IS

    SELECT H.DESCRIPTION AS HOST_DESCRIPTION

    PROD. HOST H, PROD. APP_IP_COMM_ACCESS_INFO AICAI, PROD. ACQUIRER_IP_COMM_ACCESS_INFO ACICAI

    WHERE (AICAI. HOST_ID = H.HOST_ID) and

    (AICAI. APPL_ID = vAPPL_ID) AND

    (ACQUIRER_ID = GET_ACQ_ID. ACQ_ID );

    But you have not opened this slider, or anything like that.

    You will probably need to pass as a parameter, just like a function:

    (not sure of the type of data, so I assumed that the NUMBER)

    CURSOR GET_ACQ_CURSOR (NUMBER in_acq_id) IS

    SELECT H.DESCRIPTION AS HOST_DESCRIPTION

    PROD. HOST H, PROD. APP_IP_COMM_ACCESS_INFO AICAI, PROD. ACQUIRER_IP_COMM_ACCESS_INFO ACICAI

    WHERE (AICAI. HOST_ID = H.HOST_ID) and

    (AICAI. APPL_ID = vAPPL_ID) AND

    (ACQUIRER_ID = in_acq_id );

    When you call this type, you must pass a value... So, it seems that you first call the other cursor.

    Change this code:

    IF Vvalue = ' 04 "THEN

    FOR GET_ACQ_REC IN GET_ACQ_CURSOR

    LOOP

    IP_COMM_INFO_LIST. EXTEND;

    IP_COMM_INFO_LIST (IP_COMM_INFO_LIST. (COUNTY): = PROD. TERMINAL_IP_COMM_INFO_OBJ (GET_ACQ_REC. HOST_DESCRIPTION);

    END LOOP;

    ON THE OTHER

    To do this:

    IF Vvalue = ' 04 "THEN

    FOR GET_ACQ_ID_REC IN GET_ACQ_ID IS

    LOOP

    FOR GET_ACQ_REC IN GET_ACQ_CURSOR (get_acq_id_rec.acq_id)

    LOOP

    IP_COMM_INFO_LIST. EXTEND;

    IP_COMM_INFO_LIST (IP_COMM_INFO_LIST. (COUNTY): = PROD. TERMINAL_IP_COMM_INFO_OBJ (GET_ACQ_REC. HOST_DESCRIPTION);

    END LOOP;

    END LOOP;

    ON THE OTHER

    (Or something like that)

    I wasn't sure if your GET_ACQ_ID cursor returns only 1 row or not? If it returns more than 1 row, how to cope, you do not specify.

    If it's just 1 row, then you can probably simplify it a little more:

    IF Vvalue = ' 04 "THEN

    SELECT ACQ_ID

    in l_acq_id

    TER TAHA, MERC M, PROF

    WHERE T.MER_ID = M.MER_ID

    AND M.PROFID = P.PROF_ID

    AND T.TER_ID = vTer_id;

    FOR GET_ACQ_REC IN GET_ACQ_CURSOR (l_acq_id)

    LOOP

    IP_COMM_INFO_LIST. EXTEND;

    IP_COMM_INFO_LIST (IP_COMM_INFO_LIST. (COUNTY): = PROD. TERMINAL_IP_COMM_INFO_OBJ (GET_ACQ_REC. HOST_DESCRIPTION);

    END LOOP;

    ON THE OTHER

    Hope that helps.

  • PL/SQL: ORA-00947

    Hello

    I have a package body as shown below

    CREATE OR REPLACE PACKAGE BODY DF AS
    FUNCTION T24_GetCOPYBatchKeyAndDate (RECKEY VARCHAR2)
    RETURN RTNVAL
    IS
    RTNVAL1 RTNVAL;
    DELPOS INTEGER.
    LISTSTRING VARCHAR2 (4000);
    BEGIN
    SELECT XMLRECORD IN LISTSTRING OF V_F_RO_COPY_KEYLIST WHERE RECID = RECKEY;

    LISTSTRING: = TRIM (LISTSTRING);
    WHILE LENGTH (LISTSTRING) <>0
    LOOP
    DELPOS: = INSTR (LISTSTRING, ' ');
    IF DELPOS = 0 THEN
    DELPOS: = LENGTH (LISTSTRING) + 1;
    END IF;
    -SELECT SUBSTR (LISTSTRING, 9, DELPOS - 9) INTO RTNVAL FROM DUAL;
    SELECT TO_DATE (SUBSTR (LISTSTRING, 1, 8), 'YYYYMMDD'), SUBSTR (LISTSTRING, 9, DELPOS - 9) IN THE DOUBLE RTNVAL1;
    LISTSTRING: = SUBSTR (LISTSTRING, DELPOS + 1, LENGTH (LISTSTRING) - DELPOS);
    END LOOP;
    RETURN (RTNVAL1);
    END T24_GetCOPYBatchKeyAndDate;
    END DF;
    /

    but I get compilation errors below is the error can someone let me know what is the problem here and earlier, I used this function as PIPILINED and PIPE_ROW (RTNVAL).

    It was working fine now, I wanted to test this without pipeline fucntion.

    SQL > SHOW ERRORS;

    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    19/5 PL/SQL: statement ignored
    19/105 PL/SQL: ORA-00947: not enough values
    SQL >

    I think you should do a

    SELECT TO_DATE (SUBSTR (LISTSTRING, 1, 8), 'YYYYMMDD'), SUBSTR (LISTSTRING, 9, DELPOS - 9) BULK COLLECT INTO RTNVAL1 FROM DUAL;

    that your target is an array, which must be initialized and expanded what is done by a transaction block.

    HTH

Maybe you are looking for