views:

350

answers:

1

I'm new to the Oracle Platform (having primarily used MySQL, with a little Postgres and SQL Server as well). I recently discovered the following statment

DESC TABLE_NAME;

will only work in the SQL*Plus tool I use to test my queries. It will NOT work when I use PHP's standard functions to connect to the oracle database. I need to use something like

SELECT * FROM USER_TAB_COLUMNS WHERE TABLE_NAME = 'TABLE_NAME'

instead.

From what I understand, this is because the "DESC" statment is an add-on in the SQL*Plus application.

My questions are

  1. Is my understanding correct, or is there something more subtle going on?
  2. What other special additions are there to SQL*Plus?
  3. Is there a way to turn off these special additions while I'm coming up to speed on Oracle?
  4. Any other general advice for an Oracle newb from vetrans of the platform is appreciated.
+10  A: 
  1. Yes. SQL*Plus is a client tool. SQL is what actually gets run on the server.
  2. Documentation for SQL*Plus is here and here A lot of the 'extensions' are presentation related (eg how wide your screen is)
  3. Not really in SQL*Plus. If you use SQL*Plus for long, you'll soon find out you really NEED to be able to change the default linesize, page size, column sizes, number formatting...
  4. Personally, while it is good to know how to do things in SQL*Plus, one of the GUI client tools can be a lot easier. Personally I use SQL Squirrel for most stuff, and my favourite editor and SQL*Plus for PL/SQL program development.
Gary
1/ or more specifically, SQL is the language that the server understands and uses to return results. So you can only run SQL queries from PHP. Oracle understands standard SQL but does have some of it's own extensions... DESC is only built into sql*plus.4/ If you're working on Linux or Solaris without any GUI tools like I am then you might be stuck with using sqlplus. sqlplus by default doesn't the old up-arrow for the last typed command. If you download/build and install rlwrap library then you can run sqlplus with rlwrap sqlplus ... There is also gqlplus but your milage may vary.
Matt H