1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

virtual coloum not allowed

Discussion in 'SQL PL/SQL' started by SANKARIPR, Sep 8, 2012.

  1. SANKARIPR

    SANKARIPR Active Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    55
    in my database table are create

    in this table insert value error occur
    virtual coloum how can i solve
     
  2. Bharat

    Bharat Community Moderator Forum Guru

    Messages:
    1,747
    Likes Received:
    147
    Trophy Points:
    1,805
    Location:
    Vijayawada, India
    Hi sankar,

    I think in your table you have virtual column which is not able to insert manually. It will generate automatically based on the structure of that column. Please provide table description by that we can resolve this issue for you.
     
  3. mediaad

    mediaad Active Member

    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    55
    Location:
    mediaad
    Thanks!!!!!!!!!!!!!!!!!!!!!!!!!
     
  4. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,347
    Likes Received:
    348
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    Code (SQL):
    SQL> CREATE TABLE plch_departure(
      2        destination varchar2(100),
      3        departure_time DATE,
      4        delay   NUMBER(10),
      5        expected generated always AS (departure_time + (delay/24/60/60))
      6  );
     
    TABLE created.
     
    SQL>
    SQL> BEGIN
      2        INSERT INTO plch_departure
      3        VALUES('Sisimut', sysdate, 1500, sysdate+1500/24/60/60);
      4  END;
      5  /
    BEGIN
    *
    ERROR at line 1:
    ORA-54013: INSERT operation disallowed ON virtual COLUMNS
    ORA-06512: at line 2

    SQL>
    SQL> BEGIN
      2        INSERT INTO plch_departure(destination, departure_time, delay)
      3        VALUES('Qaanaaq', sysdate, 1500);
      4  END;
      5  /
     
    PL/SQL PROCEDURE successfully completed.
     
    SQL>
     
    As mentioned before you cannot insert into a virtual (generated) column; the value is generated from the source columns.