* COUNT 1 *
select distinct count (CUSTOMER_ID) from DEMO_CUSTOMERS;
* COUNT 2 *
select count (CUSTOMER_ID)
from DEMO_CUSTOMERS
where instr(upper(CUST_LAST_NAME), upper ( nvl (:P1_CUST_LAST_NAME,CUST_LAST_NAME))) > 0
AND instr(upper(CUST_FIRST_NAME), upper ( nvl (:P1_CUST_FIRST_NAME,CUST_FIRST_NAME))) > 0
order by 1
* COUNT 3 *
select count (*) from (
select CUSTOMER_ID, Initcap( CUST_LAST_NAME ||','|| CUST_FIRST_NAME ) Name,
CUST_CITY, CREDIT_LIMIT, CUST_EMAIL, NLS_TERRITORY,
case ACCOUNT_MGR_ID
when 1 then 'John'
when 2 then 'Bill'
when 3 then 'Smith'
when 4 then 'Joe'
when 5 then 'Ron' else
'N/A'
end as MGR_id
from DEMO_CUSTOMERS
where instr(upper(CUST_LAST_NAME), upper ( nvl (:P1_CUST_LAST_NAME,CUST_LAST_NAME))) > 0
AND instr(upper(CUST_FIRST_NAME), upper ( nvl (:P1_CUST_FIRST_NAME,CUST_FIRST_NAME))) > 0
order by 1)
where (
instr(upper("NAME"),upper(nvl(:P1_SEARCH,"NAME"))) > 0 or
instr(upper("CUST_CITY"),upper(nvl(:P1_SEARCH,"CUST_CITY"))) > 0 or
instr(upper("CUST_EMAIL"),upper(nvl(:P1_SEARCH,"CUST_EMAIL"))) > 0 or
instr(upper("NLS_TERRITORY"),upper(nvl(:P1_SEARCH,"NLS_TERRITORY"))) > 0 or
instr(upper("MGR_ID"),upper(nvl(:P1_SEARCH,"MGR_ID"))) > 0
)