DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Error with Abstract Datatype creation

  1. #1
    Join Date
    Sep 2000
    Posts
    77
    How can i declare a abstract datatype with not null columns.
    I tried this
    create or replace type temp_type as object
    (id number not null) ;
    /

    but i am getting following error
    Warning: Type created with compilation errors.

    SQL> sho err
    Errors for TYPE CCAS_TEMP_OBJ:

    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    2/2 PLS-00218: a variable declared NOT NULL must have an
    initialization assignment

    Then i tried
    SQL> create or replace type ccas_temp_obj as object
    2 (id number not null := 12) ;
    3 /

    Warning: Type created with compilation errors.

    SQL> sho err
    Errors for TYPE CCAS_TEMP_OBJ:

    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    0/0 PL/SQL: Compilation unit analysis terminated
    2/2 PLS-00363: expression 'RESP_CD' cannot be used as an assignment
    target

    Can someone please advise how should i do this.
    Thanks,
    Thanks

  2. #2
    Join Date
    Feb 2001
    Posts
    103
    Hi Chalavadi,
    You cannot use constraints while creating abstract data types. Instead you can write triggers on corresponding columns to check out that column values are not null. I hop this will help.
    When the going gets tough, the tough gets going

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width