PL / SQL数据库

时间:2011-10-02 05:21:37

标签: sql

  

可能重复:
  COUNT in PLSQL ORACLE

下面是我的PL / SQL脚本,而不是我得到的总数与给定的郊区相等,我得到了表中的总人数。我有什么不对的吗?

create or replace 
PROCEDURE getSuburb(suburb varchar2 ) 
IS
        person_count NUMBER;
    property_count NUMBER;
BEGIN
    SELECT count(p.peid) INTO person_count
    FROM person p where p.suburb = suburb;

    SELECT count(pp.pno) INTO property_count 
    FROM property pp where pp.suburb = suburb;

    dbms_output.put_line('Number of People :'||to_char(person_count));
    dbms_output.put_line('Number of property :'||to_char(property_count));
END;
/

0 个答案:

没有答案