Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Test data in query

Greg SpallMay 29 2013 — edited May 31 2013
Ok, I've seen this done here before but cannot find it again, and have no idea what to search for (tried, but not finding anything).

I suspect it uses TABLE, CAST and/or MULTISET functions in a query .. but reading the docs on those, I can't seem to piece together how to do it.

When I piece together a sample/test query, I usually do something like this:
WITH data AS
    ( SELECT 123  id,  'abc'  col1  FROM dual UNION ALL
      SELECT 234, 'def' FROM dual UNION ALL
      SELECT 345, 'xyz' FROM dual
    )
SELECT *
  FROM data -- usually more complex query here
/
However, I saw somebody do this without using the UNION ALL .. they did something with TABLE ( ... ) ??
Anyone know how to do this? I'm just curious, as it seemed "simpler" than the UNION ALL method I've used previously, and I figured it would be a nice trick to learn and leverage in other ways if I can understand how it works :)

Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 28 2013
Added on May 29 2013
10 comments
1,392 views