Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    3

    Unanswered: inconsistent datatype!

    Hi,

    Im trying to implement a function in oracle and i have this error msg:

    // THIS IS THE FUNCTION

    CREATE OR REPLACE TYPE BODY Empresa_objtyp AS
    MEMBER FUNCTION recupera_empregados_por_nome(nome IN VARCHAR2) RETURN
    EmpregadoList_ntabtyp IS
    listaEmp EmpregadoList_ntabtyp;
    BEGIN
    SELECT emp.empregado into listaEmp
    FROM table (SELF.tem_empregados_ntab)
    emp;
    RETURN listaEmp;
    END;
    end;


    // THIS IS THE ERROR I GET
    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    5/6 PL/SQL: SQL Statement ignored
    5/13 PL/SQL: ORA-00932: inconsistent datatype: ... ... REF
    BDII_GRUPOII.EMPREGADO_OBJTYP get
    BDII_GRUPOII.EMPREGADOLIST_NTABTYP


    THE OBJECT TYPES ARE
    Empregado_objtyp AS OBJECT (.....)

    EmpregadoRef As OBJECT (
    empregado REF Empregado_objtyp;
    )

    EmpregadoList_ntabtyp AS TABLE OF EmpregadoRef;

    Empresa_objtype as object (
    ...
    tem_empregados_ntab EmpregadoList_ntabtyp;
    )


    what should i do to put the values contained in atributte 'tem_empregados_ntab' in var 'listaEmp' ???

    Thanks

    Camilo Porto

  2. #2
    Join Date
    Mar 2004
    Posts
    23

    Re: inconsistent datatype!

    listaEmp EmpregadoList_ntabtyp;

    SELECT emp.empregado into listaEmp

    You can't select 1 item into a structure (record type) that
    has many items. I assume 'listaEmp' is a user-defined
    record type and emp.empregado is a column in a table?
    The select list has to match the 'into' target.

  3. #3
    Join Date
    Mar 2004
    Posts
    3

    Re: inconsistent datatype!

    Originally posted by lluf44
    listaEmp EmpregadoList_ntabtyp;

    SELECT emp.empregado into listaEmp

    You can't select 1 item into a structure (record type) that
    has many items. I assume 'listaEmp' is a user-defined
    record type and emp.empregado is a column in a table?
    The select list has to match the 'into' target.

    lisaEmp isn't a record is Table of EmpregadoRef (that is an user defined object type)

    And emp.empregado is the same type of listaEmp (as shown before)

  4. #4
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >SELECT emp.empregado into listaEmp
    >FROM table (SELF.tem_empregados_ntab)
    ---------^^^^ "table"?
    Why not
    SELECT emp.empregado into listaEmp
    FROM SELF.tem_empregados_ntab
    ??????????????????????????????????
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  5. #5
    Join Date
    Mar 2004
    Posts
    3
    Originally posted by anacedent
    >SELECT emp.empregado into listaEmp
    >FROM table (SELF.tem_empregados_ntab)
    ---------^^^^ "table"?
    Why not
    SELECT emp.empregado into listaEmp
    FROM SELF.tem_empregados_ntab
    ??????????????????????????????????
    Because, oracle show this error:
    /3 PL/SQL: SQL Statement ignored
    6/13 PL/SQL: ORA-00942: the table or view dos not exists

Posting Permissions

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