1

In Oracle, I can issue the following command to get me the table structure and list down all the columns of a table.

desc table_name

TABLE

COL1 <DATA TYPE> <NOT NULL ETC>
COL2 ................
COL3
.
.
.
COL N

Is there any command that I can execute in Developer Console (Query Editor) to get the list of all the columns in a particular SObject ?

4 Answers 4

3

There isn't a command (other than doing a describe as Samuel posted), but you can do File -> Open and open the object to see the list of fields.

There are other tools such as workbench that can list your fields and gives you a query builder tool.

1
  • This was a fantastic suggestion.Tx :)
    – Varun
    Commented Apr 23, 2014 at 16:24
1

If your main concern is to see them, you can easily use the describe methods in anonymous apex like such:

Schema.DescribeSObjectResult a_desc = Account.sObjectType.getDescribe(); //for the Account object, you can replact that with any object you have, standard or custom
Map<String, Schema.SObjectField> a_fields = a_desc.fields.getMap();

for(Schema.sObjectField fld:a_fields.values()){ 
               system.debug(fld);
}
0

No, there isn't really any easy to way to do this in a query. The closest thing you can get to is in Eclipse, you can open up the Schema browser and then navigate to the object. You can then click the checkbox next to fields and it will automatically build you a query that brings back all fields. Not extremely useful, but really the closest you can get with the normal given tools.

0

select fields(custom) from user limit 1

SOQL documentation

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .