ORA - 00918:column defined ambiguosly

select ha.kod_daerah,kb.nama bpm,kn.nama,pi.NAMA,pi.ALAMAT1,pi.ALAMAT2,pi.ALAMAT3,pi.ALAMAT4,pi.POSKOD,to_char(lp.trh_keluar,'DD') day,
        DECODE (TO_CHAR (lp.trh_keluar, 'MM'),
               '01', 'JANUARI',
                  '02', 'FEBRUARI',
                  '03', 'MAC',
                  '04', 'APRIL',
                  '05', 'MEI',
                  '06', 'JUN',
                  '07', 'JULAI',
                  '08', 'OGOS',
                  '09', 'SEPTEMBER',
                  '10', 'OKTOBER',
                  '11', 'NOVEMBER',
                  '12', 'DISEMBER'
                 ) month , to_char(lp.trh_keluar,'YYYY') year ,mh.LOKASI,mh.LUAS,mh.NO_PAJAKAN,mh.ID_HAKMILIK
,lp.ID_BHN_BATU,lp.KUANTITI_MAX,lp.KOD_UOM_KNTT,lp.KADAR_BYRN,lp.KOD_UOM,lp.PERUNTUKAN_TMBHN,lp.NO_PERMIT,lp.NO_RESIT,lp.BYRN,lp.BYRN_PKATAAN,
pi.NO_PENGENALAN
from mohon mo,mohon_hakmilik mh,lupus_permit lp,pemohon pe,pihak pi join kod_negeri kn on (pi.kod_negeri=kn.kod),hakmilik ha join kod_bpm kb on
(ha.kod_bpm=kb.bpm),hakmilik ha join kod_daerah kd on(ha.kod_daerah=kd.kod)
 where mo.ID_MOHON=mh.ID_MOHON and mo.ID_MOHON=lp.ID_MOHON 
and  mo.id_mohon=:p_id_mohon and lp.ID_MOHON = pe.ID_MOHON and pe.id_pihak = pi.ID_PIHAK and ha.id_hakmilik=mh.ID_HAKMILIK
and ha.kod_bpm=kb.bpm and ha.kod_daerah=kd.kod 

error;ora-00918:column ambiguosly defined

Try Thie below,

Select ha.kod_daerah,
KB. NAMA bpm,
kN.Nama,
PI. NAMA,
PI. ALAMAT1,
PI. ALAMAT2,
PI. ALAMAT3,
PI. ALAMAT4,
PI. POSKOD,
TO_CHAR (LP.trh_keluar, 'DD') day,
DECODE (TO_CHAR (lp.trh_keluar, 'MM'),
'01', 'JANUARY',
'02', 'FEBRUARY',
'03', 'MAC ',.
'04', 'APRIL ',.
'05', 'MEI ',.
'06', 'JUNE ',.
'07', 'JULAƏ ',.
"08', 'OGOS."
'09', 'SEPTEMBER',
'10', 'OCTOBER',
'11', 'NOVEMBER',
'12', 'DISEMBER.
) months.
TO_CHAR (LP.trh_keluar, 'YYYY') year,
HD. MAP,
HD. LUAS,
mh.NO_PAJAKAN,
mh.ID_HAKMILIK
lp.ID_BHN_BATU,
LP. KUANTITI_MAX,
LP. KOD_UOM_KNTT,
LP. KADAR_BYRN,
LP. KOD_UOM,
LP. PERUNTUKAN_TMBHN,
lp.NO_PERMIT,
lp.NO_RESIT,
LP. BYRN,
LP. BYRN_PKATAAN,
pi.NO_PENGENALAN
of please MB.
mohon_hakmilik HD,
lupus_permit lp,
pemohon pe,
pihak pi join kod_negeri kn on (pi.kod_negeri = kn.kod).
hakmilik ha kod_bpm Ko on(ha.kod_bpm=kb.bpm) join
Join kod_daerah kd on(ha.kod_daerah=kd.kod)
where mo.ID_MOHON = mh.ID_MOHON and
mo.ID_MOHON = lp.ID_MOHON and
Mo.id_mohon =: p_id_mohon and
lp.ID_MOHON = pe.ID_MOHON and
PE.id_pihak = pi.ID_PIHAK and
HA.id_hakmilik = MH.id_hakmilik and
HA.kod_bpm = KB. BPM and
HA.kod_daerah = KD.kod;

P. S.) I didn't test this.

Kind regards
Florian...

Tags: Database

Similar Questions

  • Failed to parse the SQL query: ORA-00918: column ambiguously defined

    I have an application that generates a report that says what indicator is connected to what size. For this, a package is created called and under this function is there that generates and returns a dynamic SQL strings that indicates which indicators depends on what size. In my report under the defination of region identification section, the type is mentioned the SQL (sql query return function body) and in the section source it returning



    Thanks in advance. Any suggestions on this will be useful for me to traceout the issue.

    Concerning
    ADI

    Published by: Adi on January 4, 2010 01:04
  • strange behaviuor (bug?) with view (ora-918 column ambiguously defined)

    Hello everyone,
    the following code works as expected;

    Select substr(fire_id,-4,2) ct, zone_id, (fire_id), sum (a_total) count of
    (select *)
    fire join fire_zone using (fire_id) right
    where definition_id = 1
    and checked = 1
    and substr (fire_id, 2, -4) in (21.23)
    and fire_id between 190400000000 and 200900000000)
    Group zone_id substr (fire_id, 2, -4),
    order of ct, zone_id


    but when to define a vision for the subquery:

    create or replace view tempfire as
    Select *.
    fire join fire_zone using (fire_id) right
    where definition_id = 1
    and checked = 1
    and substr (fire_id, 2, -4) in (21.23)
    and fire_id between 190400000000 and 200900000000


    then run

    Select substr(fire_id,-4,2) ct, zone_id, count of tempfire (fire_id), sum (a_total)
    Group zone_id substr (fire_id, 2, -4),
    order of ct, zone_id

    I got the error ora-00918 ambiguous column defined for zone_id.

    Is this a bug or is there a reason?

    Thank you in advance,

    See you soon,.
    Boris

    Published by: boris on November 19, 2009 06:49

    Published by: boris on November 19, 2009 06:52

    In fact, it's a bug. As a fix, the problem:

    alter session set "_column_elimination_off"=true
    /
    

    before you run the query:

    SQL> select  substr(fire_id,-4,2) as ct,zone_id,
      2          count(fire_id),sum(a_total)
      3    from  tempfire
      4    group by substr(fire_id,-4,2),
      5             zone_id
      6    order by ct,
      7             zone_id
      8  /
            count(fire_id),sum(a_total)
                               *
    ERROR at line 2:
    ORA-00918: column ambiguously defined
    
    SQL> alter session set "_column_elimination_off"=true
      2  /
    
    Session altered.
    
    SQL> select  substr(fire_id,-4,2) as ct,zone_id,
      2          count(fire_id),sum(a_total)
      3    from  tempfire
      4    group by substr(fire_id,-4,2),
      5             zone_id
      6    order by ct,
      7             zone_id
      8  /
    
    no rows selected
    
    SQL> 
    

    SY.

  • Ambigiously column defined

    I receive the error: ORA-20001: get_dbms_sql_cursor error ORA-00918: column ambiguously defined
    But do not understand why it gives me this error because I checked the prefix of columns and they are ok...

    select 
    
    a.CSNCONTACTPERSON, 
    a.FIRSTNAMECONTACTPERSON, 
    a.LASTNAMECONTACTPERSON, 
    a.CHAMBEROFCOMMERCE, 
    a.MOBPHONECONTACTPERSON, 
    b.CHAMBEROFCOMMERCE
    
    from bi_contacts a, bi_relations b
    where a.chamberofcommerce = :P5_CoC
    : P5_CoC contains the value of b.CHAMBEROFCOMMERCE

    Any thoughts on what I am doing wrong?

    TheStudent wrote:
    I receive the error: ORA-20001: get_dbms_sql_cursor error ORA-00918: column ambiguously defined
    But do not understand why it gives me this error because I checked the prefix of columns and they are ok...

    select 
    
    a.CSNCONTACTPERSON,
    a.FIRSTNAMECONTACTPERSON,
    a.LASTNAMECONTACTPERSON,
    a.CHAMBEROFCOMMERCE,
    a.MOBPHONECONTACTPERSON,
    b.CHAMBEROFCOMMERCE
    
    from bi_contacts a, bi_relations b
    where a.chamberofcommerce = :P5_CoC
    

    : P5_CoC contains the value of b.CHAMBEROFCOMMERCE

    Any thoughts on what I am doing wrong?

    You try to use it in a report? If so, APEX will wrap your query inside another to support various features (paging, interactive reports, etc.), this query see 2 CHAMBEROFCOMMERCE columns in the SELECT list. These columns must be particularly well named, so add appropriate aliases for columns:

    select 
    
    a.CSNCONTACTPERSON,
    a.FIRSTNAMECONTACTPERSON,
    a.LASTNAMECONTACTPERSON,
    a.CHAMBEROFCOMMERCE chamber_a,
    a.MOBPHONECONTACTPERSON,
    b.CHAMBEROFCOMMERCE chamber_b
    
    from bi_contacts a, bi_relations b
    where a.chamberofcommerce = :P5_CoC
    

    (Joins/absence looks always doubtful...)

  • Problem of ORA-00918 join of tables for the update

    Hello

    I have 2 tables: PAR_SPEC_OPS and T_PAR and I'm trying to update the 2 columns with values from the second table in the first.

    Here is my script:

    Update
    (
    Select membership_id, membership_status
    Of Par_Spec_Ops P, T_Par T
    Where P.Tracking_ID = T.Tracking_ID
    )
    Set P.membership_id = T.membership_id,
    P.membership_status = T.membership_status;

    Running this gives me ORA-00918: column ambiguously defined. I watched this and it is said that happens when there is a common column in tables 2 and I'm not using prefixes, but as you can see on my order, I'am using prefixes. I tried with and without alias, but I get the same error.

    You guys have any ideas?

    Thank you and best regards,
    Ionut

    Published by: 837311 November 8, 2011 04:24

    Select membership_id, membership_status

    Columns of the table P or T? Oracle does not know...

  • ORA-20001, ORA-00918

    Hello
    I have to show the same names of columns in different tables.
    I have following error message although there is no problem at home > workshop SQL > SQL commands.


    ORA-20001: get_dbms_sql_cursor error ORA-00918: column ambiguously defined

    I need expert help, once again.

    Thanks in advance,

    EB NY

    Hello

    Prefix the names of column (even) with the table name (or alias):
    SELECT E.DEPTNO, D.DEPTNO
    FROM EMP E, DEPT. D

    Greetings,
    Roel

    http://roelhartman.blogspot.com/

  • ORA-00984: column not allowed here, when you try to use a default UDF

    I am wanting to create a table that has a default value of a user-defined function, and because this default is intended to be used in a few different places so I would use a function rather than in the table definition.

    This is my current code that works very well:
    CREATE TABLE DEPT_HIST
    (
      DEPTNO      NUMBER(2) not null,
      DNAME       VARCHAR2(14),
      LOC         VARCHAR2(13),
      SQL_ACTV_C  CHAR(1) not null,
      EFFT_STRT_S TIMESTAMP(6) default SYSTIMESTAMP not null,
      EFFT_END_S  TIMESTAMP(6) default TO_TIMESTAMP('9999/12/30 00:00:00.000000', 'YYYY/MM/DD:HH24:MI:SS.FF6') not null,
      DELT_F      CHAR(1) default 'N' not null
    );
    but I would get something similar to this work:
    CREATE OR REPLACE FUNCTION EOT
       RETURN timestamp
    IS
       Result   timestamp;
    BEGIN
       RETURN (TO_TIMESTAMP ('9999/12/30 00:00:00.000000',
                             'YYYY/MM/DD:HH24:MI:SS.FF6'));
    END EOT;
    /
    
    select eot from dual;
    
    EOT
    ---------------------------------------------------------------------------
    30/DEC/99 12:00:00.000000000 AM
    
    CREATE TABLE DEPT_HIST
    (
      DEPTNO      NUMBER(2) not null,
      DNAME       VARCHAR2(14),
      LOC         VARCHAR2(13),
      SQL_ACTV_C  CHAR(1) not null,
      EFFT_STRT_S TIMESTAMP(6) default SYSTIMESTAMP not null,
      EFFT_END_S  TIMESTAMP(6) default EOT not null,
      DELT_F      CHAR(1) default 'N' not null
    );
    but I get an error of:
      EFFT_END_S  TIMESTAMP(6) default EOT not null,
                                       *
    ERROR at line 8:
    ORA-00984: column not allowed here
    Any ideas? I guess I could use a trigger but not exactly what I'm after.

    Hello

    Sorry; No function defined by the user in the DEFAULT clause.
    From SQL, under "CREATE TABLE Statement" language manual
    http://download.Oracle.com/docs/CD/B28359_01/server.111/b28286/statements_7002.htm#sthref7119

    Restriction on default column values


    A DEFAULT expression cannot contain references to the functions PL/SQL or other columns, the nickname CURRVAL, NEXTVAL, LEVEL, PRIOR and ROWNUM, or date constants that are not completely specified.

    I wouldn't use a trip just for that. If you need a trigger for other reasons, then maybe you can include the definition of this column in the trigger, too, but, in general, avoid triggers when there is an alternative.

  • ORA-02074: cannot DEFINE NLS in a distributed transaction

    Short - installation of pre-production

    After Doc ID 1683074.1 for installation quick config, executing a link ' run charts ' task errors and clover logs show the error below:

    08-18 15:08:01, 654 execution [WatchDog] ERROR WatchDog 96200 chart completed with error

    08-18 15:08:01, 658 WatchDog [WatchDog] ERROR 96200 node SET_SESSION_LANGUAGE completed with status: ERROR caused by: ORA-20001: Oracle - 20001 error: ORA-20001: 2074-Oracle error: ORA-02074: cannot DEFINE NLS in a distributed transaction

    has been detected in fnd_global.set_nls.set_parameter ('NLS_LANGUAGE', 'AMERICAN').

    has been detected in fnd_global.set_nls.

    ORA-06512: at the 'APPS '. APP_EXCEPTION", line 72

    ORA-06512: at the 'APPS '. FND_GLOBAL', line 271

    ORA-06512: at the 'APPS '. FND_GLOBAL', line 1575

    ORA-06512: at the 'APPS '. FND_GLOBAL', line 1603

    ORA-06512: at line 1

    08-18 15:08:01, 658 [WatchDog] WatchDog ERROR 96200 node SET_SESSION_LANGUAGE Error Details:

    java.sql.SQLException: ORA-20001: Oracle - 20001 error: ORA-20001: 2074-Oracle error: ORA-02074: cannot DEFINE NLS in a distributed transaction

    has been detected in fnd_global.set_nls.set_parameter ('NLS_LANGUAGE', 'AMERICAN').

    has been detected in fnd_global.set_nls.

    ORA-06512: at the 'APPS '. APP_EXCEPTION", line 72

    ORA-06512: at the 'APPS '. FND_GLOBAL', line 271

    ORA-06512: at the 'APPS '. FND_GLOBAL', line 1575

    ORA-06512: at the 'APPS '. FND_GLOBAL', line 1603

    ORA-06512: at line 1

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445)

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)

    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)

    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450)

    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)

    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)

    at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:193)

    at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1033)

    I discovered the problem.

    I thought he should be a configuration of data source problem. During installation, for some reason, the ebsdb data source is not created on the server of clover, so I added it.

    It's the driver being used. I used the default is generic.

    I've updated the data source "oracle.jdbc.OracleDriver" and restarted the server.

    Looks like it will work now.

  • UNPIVOT: Column defined Ambiguosuly

    Dear all,

    During the race below set out, I get "column defined Ambiguosuly '...

    Please help me on this...

    [code]

    SELECT *.

    Of

    (

    SELECT activity_type,

    COUNT (decode (CASE WHEN activity_type = 'K' then 1 when activity_type = END 'BH', 1, 1, 1)) vacation,.

    COUNT (decode (CASE WHEN activity_type = 1 then 'SL' where activity_type = '2' then 1 END, 1, 1)) leave.

    Annual Count(case when activity_type = 'AL' Then 1 else null end)

    Count (case when activity_type = 'OL' Then 1 else null end) Other_no,

    Count (case when activity_type = 'IM' Then 1 else null end) InternalMeeting,

    Count (case when activity_type = 'TR' Then 1 else null end) training,

    Office Count (case when activity_type = 'ISM' Then 1 else null end),

    COUNT (decode (CASE WHEN activity_type = "CS" then 1 when activity_type = '10' then 1 when activity_type = END 'customer Service', 1, 1, 1, 1)) ExternalMeeting,.

    Count (case when activity_type = '9' Then 1 else null end) Symposium,

    Count (case when activity_type = '12' Then 1 else null end) Transit,

    The result of the Count (case when activity_type = 'H' Then 1 else null end),

    Count (case when activity_type = '10' Then 1 else null end) CME

    OF planner_activity pa

    WHERE tenant_id = 500020

    GROUP BY activity_type

    )

    UNPIVOT

    (

    monthly_count

    FOR activity_type (HOLIDAYS, ANNUAL LEAVE, OTHER_NO, INTERNALMEETING, TRAINING, OFFICE, EXTERNALMEETING, SYMPOSIUM, TRANSIT, RESULT, CME)

    )


    [/ code]

    I want to make the sum of the result... Please help me...

    Thanks a lot for your help...

    What you do are a little weird: you use the count instructions (box) to transform the data from rows into columns, and then you do a upivot to return the columns in lines.

    I think what you really want to do is the following:

    Select activity_label, count (*)

    Of

    (SELECT activity_type,

    CASE WHEN activity_type in ('K', 'BH') then 'holiday '.

    When in activity_type ('SL', ' 2') and then click "exit".

    WHEN activity_type = 'AL' and 'annual '.

    ...

    end activity_label

    of planner_activity pa

    WHERE tenant_id = 500020

    )

    Activity_label group

  • 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

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

    Sorry, it's probably easy and I forgot something simple, but it's driving me crazy :-)
    VARIABLE g_fk_deduction      VARCHAR2(30)
    VARIABLE g_fk_empno          NUMBER
    VARIABLE g_before_or_after_flag     CHAR(1)
    VARIABLE g_deduction_amount     NUMBER
    
    BEGIN
      :g_fk_deduction           := '401K';
      :g_fk_empno               := 7369;
      :g_before_or_after_flag     := 'B';
      :g_deduction_amount          := 150.00;
    END;
    /
    BEGIN
      INSERT INTO emp_deductions      (fk_deduction, fk_empno, before_or_after_flag, deduction_amount)
       VALUES               (g_fk_deduction, g_fk_empno, g_before_or_after_flag, g_deduction_amount);
      COMMIT;
    END;
    /
    Error: PL/SQL: ORA-00984: column not allowed here on g_deduction_amount
    in the value clause.
    Any help would be appreciated.

    Table is below:
    CREATE TABLE emp_deductions     (
          fk_deduction            VARCHAR2(30),
          fk_empno                  NUMBER(4),
          before_or_after_flag         CHAR(1),
          deduction_amount            NUMBER(6,2));
    Published by: LostNoob on August 23, 2012 19:06

    rp0428 wrote:
    >
    : g_fk_deduction: = "401k".
    : g_fk_empno: = 7369;
    : g_before_or_after_flag: = 'B ';.
    : g_deduction_amount: = 150.00;
    >
    Why did you put a colon here? Get rid of them.

    They are necessary, since they are declared SQL * more variable.

    The problem for the OP, is that in the clause values in the insert the colon are missing.

    Published by: Mark Williams on August 23, 2012 22:31

    Here is your example requested:

    SQL> create table test (c number);
    
    Table created.
    
    SQL> variable v_c number
    SQL> begin
      2    :v_c := 46;
      3  end;
      4  /
    
    PL/SQL procedure successfully completed.
    
    SQL> begin
      2    insert into test values (:v_c);
      3  end;
      4  /
    
    PL/SQL procedure successfully completed.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> select * from test;
    
             C
    ----------
            46
    
    1 row selected.
    
    SQL>
    
  • ORA-00984: column not allowed here

    Hi all

    Kindly someone please shed some light on this called error "ORA-00984: column not allowed here?

    I created a table:

    CREATE TABLE JB (ENAME VARCHAR (20));

    Table created.

    Now, if I INSERT:

    INSERT INTO VALUES JB (sintes);

    ORA-00984: column not allowed here

    Why this error, if I insert a number instead of "Sinti", implementation is also possible. No character is not allowed.

    What is the column name in this area, its totally strange to me.

    Please someone help me.

    Thank you and best regards,
    SINTES

    Hello
    Use quotes around Zack:

    INSERT INTO JB VALUES ('Sathik');
    
  • ORA-02267: column type incompatible with the type of the referenced column

    create table employee)
    emp_id varchar (10) constraint Primary Key of PK_employee,.
    First name varchar2 (20).
    LastName varchar2 (20).
    Phone number (11));

    Table created.

    create the empinformation table
    (
    primary key pk_empinformation number (6) MobileNo constraint
    Address varchar (100),
    number (10) of salary.
    personalid number (10) constraints fk_employees_section references employee (emp_id));



    ERROR on line 6:
    ORA-02267: column type incompatible with the type of the referenced column

    This error comes because the data type of the columns of refernce incompatible with reference tables.
    Foreign key column data type is the same as the reference column.

    type database foreign key and primary key data type must myself.

    create the empinformation table
    (
    primary key pk_empinformation number (6) MobileNo constraint
    Address varchar (100),
    number (10) of salary.
    personalid varchar (10) constraints fk_employees_section references employee (emp_id));

    table created

  • Create Materialized View ORA-01723: columns of length zero are not allowed

    I am trying to create a materialized view that derives from a column of a function and I get: ORA-01723: columns null are not allowed.

    I use 10 gr 2 with the following definition (simple version):

    CREATE MATERIALIZED VIEW ACES
    SELECT
    function_name (column_name) alias_de_colonne
    FROM table_name;

    I even tried to cast it as below:

    CREATE MATERIALIZED VIEW ACES
    SELECT
    Cast (function_name (column_name) AS VARCHAR2 (200)) alias_de_colonne
    FROM table_name;

    My function has an exception to return a value, even if no value are.

    I looked everywhere for the solution. Someone at - there a way around this problem? I really need my function to calculate the column because it has business rules that I can't join in my definition of the materialized view. My only hope around this is to insert values into a table and then create a materialized table view, I don't want to do that if someone has a solution around this.

    Any help would be greatly appreciated.

    Thank you

    Kyle

    Published by: Kyle Miller on April 19, 2011 08:28

    Have you tried to create a table with the correct structure and then by creating the view materialized, based on the predefined table as described here...

    http://www.oaktable.NET/content/ultra-fast-MV-alteration-using-prebuilt-table-option

    ?

    See you soon

    Ben

  • ORA-01723: columns of length zero are not allowed

    Hello

    I try to combine the 2 tables (one of the tables as a single column and the other has 2 columns)... Here's the query that I'm running

    create the table temp_combine
    as
    SELECT the CITY, NULL AS TABLE_A Prov.
    Union of all the
    SELECT CITY, Prov. OF TABLE_B

    Here is the error message I got:

    ORA-01723: columns of length zero are not allowed

    Please advice, how to solve this problem

    How do I solve this problem

    Or reverse the order of the union of all the

    SELECT CITY, Prov FROM TABLE_B
    union all
    SELECT CITY, NULL AS Prov FROM TABLE_A
    

    or a cast of NULL for the Prov. data type (for example assuming that it is varchar2 (10)):

    SELECT CITY, CAST(NULL AS VARCHAR2(10)) AS Prov FROM TABLE_A
    union all
    SELECT CITY, Prov FROM TABLE_B
    

Maybe you are looking for