Ad hoc is a Latin phrase meaning "for this". It generally signifies a solution designed for a specific problem or task, non-generalizable, and not intended to be able to be adapted to other purposes.
Common examples are organizations, committees, and commissions created at the national or international level for a specific task. In other fields the term may refer, for example, to a military unit created under special circumstances, a tailor-made suit, a handcrafted network protocol, or a purpose-specific equation.
Ad hoc can also have negative connotations, suggesting a makeshift solution, inadequate planning, or improvised events.
Ad hoc querying is a term in information science.
Many application software systems have an underlying database which can be accessed by only a limited number of queries and reports. Typically these are available via some sort of menu, and will have been carefully designed, pre-programmed and optimized for performance by expert programmers.
By contrast, "ad hoc" reporting systems allow the users themselves to create specific, customized queries. Typically this would be via a user-friendly GUI-based system without the need for the in-depth knowledge of SQL, or database schema that a programmer would have.
Because such reporting has the potential to severely degrade the performance of a live system, it is usually provided over a data warehouse.
Ad hoc querying/reporting is a business intelligence subtopic, along with OLAP, data warehousing, data mining and other tools.
The term ad hoc networking typically refers to a system of network elements that combine to form a network requiring little or no planning.