You can automatically populate the Having clause in the SQL generated by the Query Builder in one of two ways.
Note: To create a HAVING clause, you must have added columns to the GROUP BY node.
HAVING entries should be in the form of <expression1> <operator> <expression2>.
To populate the HAVING clause
In order to include a global HAVING clause, there must be a GROUP BY clause as well.
To create a global HAVING clause
To construct the following query:
SELECT emp.empno, emp.ename, emp.job, emp.mgr, emp.sal,
GROUP BY emp.deptno, emp.comm, emp.sal, emp.mgr, emp.job,
HAVING ((emp.sal + NVL (emp.comm, 0)> 4000))
Do the following:
Enter the Having clause to say:
EMP.SAL + NVL(EMP.COMM, 0) > 4000
View the generated query. It should display as described above. This query selects all the employees whose salary plus commission is greater than 4000.
The NVL command substitutes a null value in the specified column with the specified value, in this case, 0.
Any of Toad's window query results can be saved to the Windows Clipboard or to a file by the procedure below. Some dialog boxes do NOT have a Copy to Clipboard or Save to Disk function. This duplicates that functionality.
To save query results
Toad provides an intuitive and efficient way to write, run, and test your SQL and PL/SQL code. Toad supports efficient code management for a single developer or a whole team of developers.