PL/SQL Object Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • daviscomp20

    PL/SQL Object Question

    Hi -

    I've created the following SuperType object in Oracle :

    CREATE OR REPLACE TYPE CT_CALC_UT as object (
    ct_plant_nm varchar2(50),
    ct_value number,
    MEMBER function get_PlantNm return varchar2,
    MEMBER procedure set_CT_Val(pi_c t_val in number)
    ) not final

    and the following Type Body :

    create or replace type body ct_calc_ut is

    member function get_PlantNm return varchar2 is
    v_plant_nm varchar2(50);
    begin
    v_plant_nm := self.ct_plant_n m;
    return v_plant_nm;
    end get_PlantNm;

    member procedure set_ct_val(pi_c t_val in number) is
    begin
    ct_value := pi_ct_val;
    end set_ct_val;

    end;

    Also, I've created the following subtype with it's own type body:

    CREATE OR REPLACE TYPE CT_CALC_SP_UT UNDER CT_CALC_UT
    (
    Sed_Basins_in_s ervice number(2),
    Sed_Raw_flow_ra te number(7,3),
    Sed_flocc_free_ cl number(7,3),
    Sed_settled_fre e_cl number(7,3),
    App_ph number(7,3),
    Fltrs_free_cl number(7,3),
    Fltrs_flow_rate number(7,3),
    Fltrs_temp number(7,3),
    Fltrs_ph number(7,3),
    MEMBER function displayVals return varchar2
    )

    create or replace type body ct_calc_sp_ut is
    member function displayVals return varchar2 is
    ....
    ...
    ...
    ...
    ...
    v_ct_value := v_tot_LGiardia_ Rmvl_Cred / v_log_giardia_r emoval_const

    self.set_ct_val (v_ct_value); !!!! Error Message is Coming here !!!!!

    ....
    ....
    end displayVals;

    I keep getting an error message, Compilation errors for TYPE BOD
    BMARINI.CT_CALC _SP_UT

    Error: PLS-00363: expression 'SELF' cannot be used as an assignmen
    target
    Line: 138
    Text: self.set_ct_val (v_ct_value);

    Error: PL/SQL: Statement ignored
    Line: 138
    Text: self.set_ct_val (v_ct_value);

    I'm not sure what is going on with this....I have seen plenty o
    examples where an object type is being modified from within
    procedure...and I'm prety stumped as to what is going on. If anyon
    has any help...or ideas, please let me know.

    Thanks

  • Frank van Bortel

    #2
    Re: PL/SQL Object Question

    daviscomp20 wrote:
    Hi -
    >
    I've created the following SuperType object in Oracle :
    >
    CREATE OR REPLACE TYPE CT_CALC_UT as object (
    ct_plant_nm varchar2(50),
    ct_value number,
    MEMBER function get_PlantNm return varchar2,
    MEMBER procedure set_CT_Val(pi_c t_val in number)
    ) not final
    >
    >
    and the following Type Body :
    >
    create or replace type body ct_calc_ut is
    >
    member function get_PlantNm return varchar2 is
    v_plant_nm varchar2(50);
    begin
    v_plant_nm := self.ct_plant_n m;
    return v_plant_nm;
    end get_PlantNm;
    >
    member procedure set_ct_val(pi_c t_val in number) is
    begin
    ct_value := pi_ct_val;
    end set_ct_val;
    >
    end;
    >
    Also, I've created the following subtype with it's own type body:
    >
    CREATE OR REPLACE TYPE CT_CALC_SP_UT UNDER CT_CALC_UT
    (
    Sed_Basins_in_s ervice number(2),
    Sed_Raw_flow_ra te number(7,3),
    Sed_flocc_free_ cl number(7,3),
    Sed_settled_fre e_cl number(7,3),
    App_ph number(7,3),
    Fltrs_free_cl number(7,3),
    Fltrs_flow_rate number(7,3),
    Fltrs_temp number(7,3),
    Fltrs_ph number(7,3),
    MEMBER function displayVals return varchar2
    )
    >
    create or replace type body ct_calc_sp_ut is
    member function displayVals return varchar2 is
    ...
    ..
    ..
    ..
    ..
    v_ct_value := v_tot_LGiardia_ Rmvl_Cred / v_log_giardia_r emoval_const;
    >
    >
    self.set_ct_val (v_ct_value); !!!! Error Message is Coming here !!!!!!
    >
    >
    ...
    ...
    end displayVals;
    >
    I keep getting an error message, Compilation errors for TYPE BODY
    BMARINI.CT_CALC _SP_UT
    >
    Error: PLS-00363: expression 'SELF' cannot be used as an assignment
    target
    Line: 138
    Text: self.set_ct_val (v_ct_value);
    >
    Error: PL/SQL: Statement ignored
    Line: 138
    Text: self.set_ct_val (v_ct_value);
    >
    I'm not sure what is going on with this....I have seen plenty of
    examples where an object type is being modified from within a
    procedure...and I'm prety stumped as to what is going on. If anyone
    has any help...or ideas, please let me know.
    >
    Thanks.
    >
    This ng is dead - not all isp's carry it, regulars do not read it.
    Repost in c.d.o.tools
    --
    Regards,
    Frank van Bortel

    Comment

    Working...