Forum Stats

  • 3,872,797 Users
  • 2,266,476 Discussions
  • 7,911,321 Comments

Discussions

SQL Developer: Generate WITH clause from resultset

User_1871
User_1871 Member Posts: 247 Red Ribbon

I've run a query in Oracle SQL Developer:

Scenario:

I want to share the resultset data on a forum — in a format that's easy for answerers to grab and use.

From my experience, WITH clauses are preferred by forum members, since WITHs avoid the need to create data in a local Oracle environment.

Example:

with cte as(
select 10 as asset_id, 1 as vertex_num, 118.56 as x, 3.8 as y from dual
union all
select 10 as asset_id, 2 as vertex_num, 118.62 as x, 1.03 as y from dual
union all
select 10 as asset_id, 3 as vertex_num, 121.93 as x, 1.03 as y from dual)

 --There are lots more rows. But it's too much work to write them all out.
   
select * from cte

Idea:

Could functionality be added to SQL Developer that automatically generates a WITH clause from the resultset? (as one of the data export options)

I had originally posted this in the SQL Developer community: https://community.oracle.com/tech/developers/discussion/4494489/idea-generate-with-clause-from-resultset

But the custom solutions provided there were beyond my skill level. Long term, it would be helpful if that functionality were available OOTB, similar to what we have in other SQL clients.

Cheers!



User_1871
1 votes

Active · Last Updated