Mark Joseph Del Rosario Mark Joseph Del Rosario - 1 month ago 9
SQL Question

Is there a way of adding a single row from an SQL result Table temporarily?

SQL Example:

WITH temp_roles as
(
SELECT * FROM
ROLE_ WHERE NAME IN (
'User','Owner','Portal Content Reviewer','Community Owner','Administrator'
)
)


I am creating a temporary table in which I would like to add an additional row of values, just for this query, is there any way of doing it.

Note:
I am using Oracle SQL.
tnx :D

Answer

If you use a UNION you could add the values manually, i.e.:

WITH temp_roles 
  as (     
      SELECT *
        FROM role_
       WHERE name IN ('User', 'Owner', 'Portal Content Reviewer', 
                      'Community Owner', 'Administrator')
      UNION
      SELECT <values>
        FROM dual
     )

BTW, i'm not sure why you are using the WITH clause?