Skip to Main Content

Oracle Database Discussions

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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

SQL Developer: Generate WITH clause from resultset

User_1871Apr 16 2022 — edited Apr 16 2022

I've run a query in Oracle SQL Developer:
User: 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!

Comments

Processing

Post Details

Added on Apr 16 2022
0 comments
169 views