我的数据库中有一个视图,其中有一堆从数据库中的其他信息派生的字段,这就是视图的定义方式:
create view patient_account_view AS 
  select patient.p_mrn,
         p_fname,
         p_lname,
         ammount_paid,
         quantity*item_cost + repeats*item_cost  "ammount_owing", 
         (quantity*item_cost + repeats*item_cost) - ammount_paid "balance"
    from patient_account,
         patient,
         diagnosis,
         prescribed_treatment,
         items_used,
         item,
         perscription
    where patient.p_mrn = diagnosis.p_mrn AND
          patient_account.p_mrn = patient.p_mrn AND
          diagnosis.prescribed_treatment_id = prescribed_treatment.prescribed_treatment_id AND 
          prescribed_treatment.prescribed_treatment_id = perscription.prescribed_treatment_id AND
          items_used.ptreatment_id = prescribed_treatment.prescribed_treatment_id AND
          items_used.item_number = item.item_number;
我想使用 pl/sql 访问视图中的信息以将其粘贴到表单中,但我收到“错误绑定变量”错误。如何在无需重新计算存储在那里的信息的情况下访问这种属性?
这是有问题的plsql:
DECLARE
    pmrn patient.p_mrn%TYPE;
    var_ptuple patient%ROWTYPE;
    var_accttuple patient_account%ROWTYPE;
BEGIN
    pmrn := :PATIENT_BLOCK.MRN_FIELD;
    SELECT * INTO var_ptuple from patient WHERE patient.p_mrn = pmrn;
    SELECT * INTO var_accttuple from patient_account_view WHERE patient_account_view.p_mrn = pmrn;
    :PATIENT_BLOCK.FNAME := var_ptuple.p_fname;
    :PATIENT_BLOCK.LNAME := var_ptuple.p_lname;
    :PATIENT_BLOCK.BALACNCE_OWING := var_accttuple.balance;
END;