Is it better to use a single query as many times as possible or have specific queries for different sets of data?
For example:
Use
SELECT x,y FROM table_name WHERE name = :name;
on page 1 that needs x and page 2 that needs y
vs
SELECT x FROM table_name WHERE name = :name;
on page 1 that needs x
SELECT y FROM table_name WHERE name :name;
on page 2 that needs y
I'm storing all my queries on a separate page that gets included and using the OCIBindBy and OCIDefineBy functions to fill out the queries and my variables.
I wasn't sure if maybe there were some caching benefits going on or if it is just a style preference.
Any thoughts would be appreciated.