I am using Oracle Express Edition and I want to get table information (column name,type,size,etc..) programmatically , inside my program (.Net C#, Microsoft oracle connector).
In SqlPlus, when i give command "desc <tablename>" it works perfectly and print all information about table.
Now i want to do it programmatically. I tried to give query "desc <tablename>" but it failed. Then i read somewhere that desc is a stored procedure and we have to call it as a stored procedure,then i tried following code, its failing with error,
Code 1
private OracleDataReader OracleDescribe(string tablename)
{
OracleCommand cmd = new OracleCommand("describe " + tablename, OracleConn);
return cmd.ExecuteReader();
}
Error 1
Invalid SQL Statement
Code 2
private OracleDataReader OracleDescribe(string tablename)
{
OracleCommand cmd = new OracleCommand("describe", OracleConn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("table", OracleType.VarChar).Value = tablename;
return cmd.ExecuteReader();
}
Error 2
Encountered the symbol ">" when expecting one of the following: (