Convert * to columns?

Is there a way in toad that I can convert a select * to a list of columns it would return? I looked in a few places and didn't see it.

There's no feature to do this in one motion, but you can remove the * and then at that position in the query invoke Code Insight using CTRL+T. You can then multiselect the columns which will be up top and Toad will insert them into the SQL comma delimited.

That will do it, I generally can't use code insight automatically so I forgot all about it

I have a different technique. It's probably a little more effort than Mike's suggestion, but for what it's worth....

StarToColumns

2 Likes

Good afternoon,
For the "pick list" to work in the sentence we need, it is necessary that all the sentences in the entire editor have the ";".
They could make it work without the need to put the ";" to all the statements of the editor. ?

Cordially,

All statements must be properly terminated with a ; for Code Insight to work completely. We use a parser that adheres to the SQLPlus rules where statements must be terminated. If you have a single statement in Toad and omit the terminator then it works. This differs from SQLPlus, but once you introduce multiple statements you'll need to terminate them.

Toad does have the Ctrl+Enter shortcut for execution that bypasses the parser and uses simple string searching rules for making a best guess as to where the statement boundaries are, but this is a lazy execution path. That logic is restricted to just Ctrl+Enter. To make the most of Toad you should be accustomed to properly using terminators. The parser is used for a lot of Editor features.

If you prefer to not terminate then use Ctrl+Enter to execute and follow the suggestion by @JohnDorlon.

Ok Michael,

As a comment, let me tell you that, in my case, one (of many) of the wonders that toad has and that the rest of the programs do not have (sql developer, plsql developer, sql navigator, etc) is that when you execute with Ctrl + Enter you don't need to end the statement with ";"

This is very valuable for me because I have many scripts that are really single queries that help me a lot on a day-to-day basis due to the speed in executing them and obtaining information instantly without having to analyze or validate all the other editor statements that are there. correctly written and ending with ";"

Best regards,

Why so difficult?
If you are using Toad and you only need the columns of one table in your select, use the schema browser. In the column tab select all wanted columns (you have to activate "Row select") and press CRTL+ALT+S then you will get a select with the selected columns in your clipboard...

EDIT: @ccevallos - I forgot about an option added a few releases back to treat blank lines as terminators! Checkout the Execute/Compile page in options and check "Treat blank line as statement terminator" and see how that plays out.

1 Like

Excellent Michael!!
...enable it and the "pick list" works very well.

Thank you very much for the effort!

1 Like

That's great. I apologize for not remembering that option sooner.

1 Like